Mosek w/ multiple bound SecondOrderCones

#1

Good evening!

I have ‘multiple bound set’ issue regarding SecondOrderCone constraints with Mosek.
(JuMP 0.19 / Mosek v8.1.0.80 )

using JuMP, Mosek, MosekTools, SCS
m = Model(with_optimizer(Mosek.Optimizer))
@variables(m, begin
   x >= 1
   y <= 2
   z <= 3
end)
@objective(m, Max, x)
@constraint(m, [y, x] in SecondOrderCone())
@constraint(m, [z, x] in SecondOrderCone())
optimize!(m)

SCS solves the same problem successfully without any issue.

m = Model(with_optimizer(SCS.Optimizer))

I’d like to know if Mosek does not accept multiple bound sets or this is related to the Mosek wrapper.

Thanks!

ERROR: LoadError: Cannot multiple bound sets of the same type to a variable
Stacktrace:
 [1] add_constraint(::MosekModel, ::MathOptInterface.VectorOfVariables, ::MathOptInterface.SecondOrderCone) at /Users/jipkim/.julia/packages/MosekTools/GeypE/src/constraint.jl:391
 [2] _broadcast_getindex_evalf at ./broadcast.jl:578 [inlined]
 [3] _broadcast_getindex at ./broadcast.jl:551 [inlined]
 [4] getindex at ./broadcast.jl:511 [inlined]
 [5] macro expansion at ./broadcast.jl:843 [inlined]
 [6] macro expansion at ./simdloop.jl:73 [inlined]
 [7] copyto! at ./broadcast.jl:842 [inlined]
 [8] copyto! at ./broadcast.jl:797 [inlined]
 [9] copy at ./broadcast.jl:773 [inlined]
 [10] materialize at ./broadcast.jl:753 [inlined]
 [11] add_constraints(::MosekModel, ::Array{MathOptInterface.VectorOfVariables,1}, ::Array{MathOptInterface.SecondOrderCone,1}) at /Users/jipkim/.julia/packages/MathOptInterface/C3lip/src/constraints.jl:139
 [12] add_constraints at /Users/jipkim/.julia/packages/MathOptInterface/C3lip/src/Bridges/bridgeoptimizer.jl:342 [inlined]
 [13] copyconstraints!(::MathOptInterface.Bridges.LazyBridgeOptimizer{MosekModel,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}, ::MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}, ::Bool, ::MathOptInterface.Utilities.IndexMap, ::Type{MathOptInterface.VectorOfVariables}, ::Type{MathOptInterface.SecondOrderCone}) at /Users/jipkim/.julia/packages/MathOptInterface/C3lip/src/Utilities/copy.jl:157
 [14] default_copy_to(::MathOptInterface.Bridges.LazyBridgeOptimizer{MosekModel,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}, ::MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}, ::Bool) at /Users/jipkim/.julia/packages/MathOptInterface/C3lip/src/Utilities/copy.jl:200
 [15] #automatic_copy_to#61 at /Users/jipkim/.julia/packages/MathOptInterface/C3lip/src/Utilities/copy.jl:15 [inlined]
 [16] #automatic_copy_to at ./none:0 [inlined]
 [17] #copy_to#1 at /Users/jipkim/.julia/packages/MathOptInterface/C3lip/src/Bridges/bridgeoptimizer.jl:91 [inlined]
 [18] (::getfield(MathOptInterface, Symbol("#kw##copy_to")))(::NamedTuple{(:copy_names,),Tuple{Bool}}, ::typeof(MathOptInterface.copy_to), ::MathOptInterface.Bridges.LazyBridgeOptimizer{MosekModel,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}, ::MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}) at ./none:0
 [19] attach_optimizer(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}}) at /Users/jipkim/.julia/packages/MathOptInterface/C3lip/src/Utilities/cachingoptimizer.jl:130
 [20] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}}) at /Users/jipkim/.julia/packages/MathOptInterface/C3lip/src/Utilities/cachingoptimizer.jl:166
 [21] #optimize!#77(::Bool, ::Bool, ::Function, ::Model, ::Nothing) at /Users/jipkim/.julia/packages/JuMP/jnmGG/src/optimizer_interface.jl:132
 [22] optimize! at /Users/jipkim/.julia/packages/JuMP/jnmGG/src/optimizer_interface.jl:105 [inlined] (repeats 2 times)
 [23] top-level scope at none:0
#2

I don’t know about Mosek here, but SCIP would fail with an error, because it requires nonnegative lower bounds for y and z. Maybe Mosek is adding these bound constraints implictly, resulting in the error you posted.

Did you try

@variables(m, begin
   x >= 1
   0 <= y <= 2
   0 <= z <= 3
end)@variables(m, begin
   x >= 1
   y <= 2
   z <= 3
end)
1 Like
#3

Maybe this issue is relevant: https://github.com/JuliaOpt/MathOptInterface.jl/pull/703
Apparently Mosek does not support having the same variable belong to multiple cones.

1 Like
#4

It is not an issue with the wrapper, the variables of a conic solver belong to a cartesian product of cones so the cones cannot overlap. For SCS, it works because the problem is written in the dual form where the variables are free and affine expressions belongs to a cartesian product of cones so the VectorOfVariables-in-SecondOrderCone is transformed by the VectorFunctionizeBridge into VectorAffineFunction-in-SecondOrderCone.
If you manualy convert one of the constraint to VectorAffineFunction, e.g. by writing 1x instead of x, the problem written to SCS will be the same and it will work with Mosek

1 Like