# Bounding Correlation Coefficients with JuMP

New to julia and this discussion group so I’m sorry if this is not a typical discussion topic or if I am breaching any norms here. I will do my best to pick up on things as I go.

In “Convex Optimization” by Boyd there is an example of bounding correlation coefficients. (See Convex Optimization p.408 Ex. 8.3) I tried solving this example with Julia using JuMP and the code provided in The Correlation Problem tutorial.

While the optimizer returns the correct minimum value, the maximum value returned is not the lowest upper bound. The code returns a maximum value of 1, whereas the books lists the maximum value as .23. I think the book is correct because Joelle Skaf posted a solution to the same problem solved with Mosek also received .23 as the sup. Just wondering if anyone had any insights as to why the code is not returning the correct upper bound.

This is the code I used. Again aside from changing the parameters and variables, the code was taken directly from the Correlation Problem tutorial on the Jump website.

``````
function example_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]))")
# Find lower bound
@objective(model, Min, X[1, 4])
optimize!(model)
println("A lower bound for X[1, 4] is \$(value(X[1, 4]))")
return
end

example_corr_sdp()

``````

and this is the output I received:

``````julia> example_corr_sdp()
An upper bound for X[1, 4] is 0.9999999984486035
A lower bound for X[1, 4] is -0.392820503716742
``````

Again the correct upper bound should be around .23. Any thoughts on what I am doing wrong would be very much appreciated. Thank you.

1 Like

In this line:

``````@constraint(model, X[3, 4] >= -0.4)
``````

The `>=` should be `<=`

3 Likes

Thank you so much for pointing that out!

With the corrected code i’m getting the following:

``````julia> example_corr_sdp()
An upper bound for X[1, 4] is 0.22990770904303592
And X[2, 3] is 0.30474113837332384
A lower bound for X[1, 4] is -0.39281984069804604
And X[2, 3] is 0.32938098165316343
``````

The book lists X[2,3] for the upper bound of X[1,4] as .31 as opposed to .30 and Mosek returns .3042. I’m just wondering as a practical rule how many sig figs can we usually go out in terms of accuracy?