Problem with LogDetConeSquare

I’m trying to use LogDetConeSquare with Mosek. I got the following error:

julia> solver = optimizer_with_attributes(Mosek.Optimizer, MOI.Silent() => false)
MathOptInterface.OptimizerWithAttributes(Mosek.Optimizer, Pair{MathOptInterface.AbstractOptimizerAttribute, Any}[MathOptInterface.Silent() => false])

julia> model = Model(solver)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Mosek

julia> @variable(model, Q[1:3, 1:3] in PSDCone())
3×3 Symmetric{VariableRef, Matrix{VariableRef}}:
 Q[1,1]  Q[1,2]  Q[1,3]
 Q[1,2]  Q[2,2]  Q[2,3]
 Q[1,3]  Q[2,3]  Q[3,3]

julia> @variable(model,t)
t

julia> @constraint(model, [t; 1; vec(Q)] in MOI.LogDetConeSquare(3))
ERROR: Constraints of type MathOptInterface.VectorAffineFunction{Float64}-in-MathOptInterface.LogDetConeSquare are not supported by the solver.

If you expected the solver to support your problem, you may have an error in your formulation. Otherwise, consider using a different solver.

The list of available solvers, along with the problem types they support, is available at https://jump.dev/JuMP.jl/stable/installation/#Supported-solvers.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] _moi_add_constraint(model::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{MosekTools.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, f::MathOptInterface.VectorAffineFunction{Float64}, s::MathOptInterface.LogDetConeSquare)
   @ JuMP ~/.julia/packages/JuMP/0C6kd/src/constraints.jl:599
 [3] add_constraint(model::Model, con::VectorConstraint{AffExpr, MathOptInterface.LogDetConeSquare, VectorShape}, name::String)
   @ JuMP ~/.julia/packages/JuMP/0C6kd/src/constraints.jl:625
 [4] macro expansion
   @ ~/.julia/packages/JuMP/0C6kd/src/macros.jl:816 [inlined]
 [5] top-level scope
   @ REPL[42]:1
1 Like

The problem is that Mosek supports LogDetConeTriangle, but not LogDetConeSquare.

Ideally, this would happen automatically via a bridge, but doing so is non-trivial: https://github.com/jump-dev/MathOptInterface.jl/issues/541

Instead, you should manually construct the upper-triangular component of the Q matrix, and then use LogDetConeTriangle directly:

model = Model()
@variable(model, Q[1:3, 1:3] in PSDCone())
@variable(model, t)
u_q = [Q[i, j] for j in 1:3 for i in 1:j]
@constraint(model, vcat(t, 1, u_q) in MOI.LogDetConeTriangle(3))

(I don’t have Mosek installed so I haven’t tested this, but it should work. Let me know if there is a problem.)

1 Like

Yes, it works! Thanks a lot!

1 Like