# Problem with LogDetConeSquare

**URL:** https://discourse.julialang.org/t/problem-with-logdetconesquare/80915
**Category:** Optimization (Mathematical)
**Tags:** question
**Created:** [May 11, 2022, 9:07pm UTC](https://discourse.julialang.org/t/problem-with-logdetconesquare/80915 "2022-05-11T21:07:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Zheming\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zheming_wang/32/35881_2.png) [@Zheming\_Wang](https://discourse.julialang.org/u/Zheming_Wang)
#### Post date: [May 11, 2022, 9:07pm UTC](https://discourse.julialang.org/t/problem-with-logdetconesquare/80915/1 "2022-05-11T21:07:48Z")

</div>

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

```julia
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

```

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [May 11, 2022, 9:17pm UTC](https://discourse.julialang.org/t/problem-with-logdetconesquare/80915/2 "2022-05-11T21:17:24Z")

</div>

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](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:

```julia
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.)

---

<div class="post-metadata">

### Author: ![Zheming\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zheming_wang/32/35881_2.png) [@Zheming\_Wang](https://discourse.julialang.org/u/Zheming_Wang)
#### Post date: [May 11, 2022, 9:23pm UTC](https://discourse.julialang.org/t/problem-with-logdetconesquare/80915/3 "2022-05-11T21:23:58Z")

</div>

> [@odow](#):
>
> LogDetConeTriangle

Yes, it works! Thanks a lot!
