Hi this is a very elementary questions but I’m still trying to understand the code from this example for the correlation problem.
The example I am using is the bounding correlation coefficients problem from “Convex Optimization” by Boyd. (See Convex Optimization p.408 Ex. 8.3). Given the Correlation Coefficients of (1,2) , (1,3), (2,4) and (3,4) I am trying to solve for the min/max values of Correlation(1,4) and Correlation(2,3) in R4.
Because I am now solving 4 SDP’s instead of two SDP’s I modified the code from the Jump example. To do this I simply added an objective and ran optimize! two additional times in the following manner:
function example4_corr_sdp()
model = Model(SCS.Optimizer)
set_silent(model)
@variable(model, X[1:4, 1:4], PSD)
# Diagonal is 1s
@constraint(model, X[1, 1] == 1)
@constraint(model, X[2, 2] == 1)
@constraint(model, X[3, 3] == 1)
@constraint(model, X[4, 4] == 1)
# Bounds on the known correlations
@constraint(model, X[1, 2] >= 0.6)
@constraint(model, X[1, 2] <= 0.9)
@constraint(model, X[1, 3] >= 0.8)
@constraint(model, X[1, 3] <= 0.9)
@constraint(model, X[2, 4] >= 0.5)
@constraint(model, X[2, 4] <= 0.7)
@constraint(model, X[3, 4] >= -0.8)
@constraint(model, X[3, 4] <= -0.4)
# Find upper bound
@objective(model, Max, X[1, 4])
optimize!(model)
println("An upper bound for X[1, 4] is $(value(X[1, 4]))")
# added additional SDP
@objective(model, Max, X[2, 3])
optimize!(model)
println("An upper bound for X[2, 3] is $(value(X[2, 3]))")
# Find lower bound
@objective(model, Min, X[1, 4])
optimize!(model)
println("A lower bound for X[1, 4] is $(value(X[1, 4]))")
#added additional SDP
@objective(model, Min, X[2, 3])
optimize!(model)
println("A lower bound for X[2, 3] is $(value(X[2, 3]))")
return
end
I receive the following output which is the correct answer for X[1,4] and what I assume to be the correct answer for X[2,3], although X[2,3] has not been verified.
julia> example4_corr_sdp()
An upper bound for X[1, 4] is 0.22990770904303592
An upper bound for X[2, 3] is 0.5937251240363608
A lower bound for X[1, 4] is -0.39281984069804604
A lower bound for X[2, 3] is 7.756695268806519e-11
I am just wondering if this is the correct approach to solving multiple SDP’s with the same constraints? Is there is a more efficient way to go about it? Also if there are any other elementary misunderstandings here I’d appreciate it if anyone could point me in the right direction thanks!