Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge for PositiveSemidefiniteConeSquare weird behavior #1476

Closed
jd-lara opened this issue Sep 19, 2018 · 0 comments · Fixed by jump-dev/MathOptInterface.jl#524
Closed

Bridge for PositiveSemidefiniteConeSquare weird behavior #1476

jd-lara opened this issue Sep 19, 2018 · 0 comments · Fixed by jump-dev/MathOptInterface.jl#524
Assignees

Comments

@jd-lara
Copy link
Contributor

jd-lara commented Sep 19, 2018

I have been testing a simple SDP problem from Boyd's book (skipping creating matrices A and b). Tried the formulation with both MathOptInterfaceMosek and SCS.

The CVX code is as follows

Version 1: same as CVX example
cvx_begin SDP
variable X(n,n) symmetric
variable x(n)
minimize(trace(A'*A*X)-2*b'*A*x+b'*b)
subject to
[X,x;x',1]>=0;
for i=1:n
X(i,i) == 1;
end
cvx_end

The Julia/JuMP implementation is

SDP_bool = Model()
@variable(SDP_bool, small_x[1:10]);
@variable(SDP_bool, big_X[1:10,1:10], Symmetric);
@constraint(SDP_bool, diag_ones[i=1:10], big_X[i,i] == 1);
M = [big_X small_x; small_x' 1]
@SDconstraint(SDP_bool, SD_con, M >= 0)
@objective(SDP_bool, Min, tr(A'*A*big_X) - (2*b'*A*small_x) + (b'b)[1])

This formulation, when paired with any of the solvers above throws this error in both cases:

Constraints of type MathOptInterface.VectorAffineFunction{Float64}-in-MathOptInterface.PositiveSemidefiniteConeSquare are not supported by the solver and there are no bridges that can reformulate it into supported constraints.

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] add_constraint(::Model, ::JuMP.VectorAffExprConstraint{VariableRef,MathOptInterface.PositiveSemidefiniteConeSquare,JuMP.SquareMatrixShape}, ::String) at /Users/jdlara/.julia/packages/JuMP/KjUjh/src/JuMP.jl:532
 [3] top-level scope at /Users/jdlara/.julia/packages/JuMP/KjUjh/src/macros.jl:479
 [4] top-level scope at In[59]:21

If the problem is reformulated as follows:

SDP_bool = Model(with_optimizer(MosekOptimizer))
#also works with SCS.Optimizer
@variable(SDP_bool, M[1:11,1:11], PSD);
@constraint(SDP_bool, diag_ones[i=1:11], M[i,i] == 1);
@constraint(SDP_bool, eq_offdiag[i=1:11], M[11,i] == M[i,11])
@objective(SDP_bool, Min, tr(A'*A*M[1:10, 1:10]) - (2*b'*A*M[1:10,11]) + (b'b)[1])
JuMP.optimize!(SDP_bool)

Which I believe is what the bridge does on the background, then the problem optimizes successfully and the answer is consistent with CVX. Moreover, if I re-write the equivalent formulation as follows:

SDP_bool = Model(with_optimizer(MosekOptimizer))
#same problem with SCS.Optimizer
@variable(SDP_bool, M[1:11,1:11], Symmetric);
@constraint(SDP_bool, diag_ones[i=1:11], M[i,i] == 1);
@constraint(SDP_bool, eq_offdiag[i=1:10], M[11,i] == M[i,11])
@SDconstraint(SDP_bool, SD_con, M >= 0)
@objective(SDP_bool, Min, tr(A'*A*M[1:10, 1:10]) - (2*b'*A*M[1:10,11]) + (b'b)[1])
JuMP.optimize!(SDP_bool)

JuMP throws the same error Constraints of type MathOptInterface.VectorAffineFunction{Float64}-in-MathOptInterface.PositiveSemidefiniteConeSquare are not supported by the solver and there are no bridges that can reformulate it into supported constraints.

It isn't clear if the error originates in MOI or JuMP, given that the last line in the stack trace is in JuMP the decision was to post here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants