# JuMP Empty Constraint when using SumOfSquares

**URL:** https://discourse.julialang.org/t/jump-empty-constraint-when-using-sumofsquares/95208
**Category:** Optimization (Mathematical)
**Tags:** jump
**Created:** [February 25, 2023, 10:47pm UTC](https://discourse.julialang.org/t/jump-empty-constraint-when-using-sumofsquares/95208 "2023-02-25T22:47:09Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Kevin\_Shu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin_shu/32/47032_2.png) [@Kevin\_Shu](https://discourse.julialang.org/u/Kevin_Shu)
#### Post date: [February 25, 2023, 10:47pm UTC](https://discourse.julialang.org/t/jump-empty-constraint-when-using-sumofsquares/95208/1 "2023-02-25T22:47:09Z")

</div>

Hello,

I’m trying to find some sum of squares representation for some polynomials, but I have been receiving some errors. Here is a shortened version of this code that gives this error:

```julia
using TypedPolynomials
using Combinatorics
using CSDP
using SumOfSquares

@polyvar a b
@polyvar x[1:2]

q = (a *x[1]+b*x[2])^2
Derb = subs(differentiate(q, b), a=> 1, b => -1)

solver = optimizer_with_attributes(CSDP.Optimizer)
model = SOSModel(solver)
@variable(model, c)
@constraint(model, cref, Derb in SOSCone())
@objective(model, Min, 0)
JuMP.optimize!(model)

```

This gives the error

```julia
ERROR: LoadError: ArgumentError: Empty constraint MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}[MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(1), MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(2)]: MathOptInterface.ScalarAffineFunction{Float64}(MathOptInterface.ScalarAffineTerm{Float64}[], 0.0)-in-MathOptInterface.EqualTo{Float64}(2.0). Not supported by CSDP.

```

What is the issue here? The actual polynomials I would like to prove are SOS are somewhat more complicated than this, but are also the derivatives of some other polynomials, with some variables then fixed to specific values.

Thanks - Kevin

---

<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: [February 26, 2023, 12:25am UTC](https://discourse.julialang.org/t/jump-empty-constraint-when-using-sumofsquares/95208/2 "2023-02-26T00:25:26Z")

</div>

It looks like the issue is that SumOfSquares is trying to add a constraint like `0 == 2`

@blegat is this expected?

---

<div class="post-metadata">

### Author: ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)
#### Post date: [February 26, 2023, 7:47am UTC](https://discourse.julialang.org/t/jump-empty-constraint-when-using-sumofsquares/95208/3 "2023-02-26T07:47:48Z")

</div>

This is because the Newton Polytope makes it trivial that this polynomial is not SOS. The degree in `x1` is odd so it will be negative either at Info or -Inf

---

<div class="post-metadata">

### Author: ![Kevin\_Shu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin_shu/32/47032_2.png) [@Kevin\_Shu](https://discourse.julialang.org/u/Kevin_Shu)
#### Post date: [February 26, 2023, 5:13pm UTC](https://discourse.julialang.org/t/jump-empty-constraint-when-using-sumofsquares/95208/4 "2023-02-26T17:13:48Z")

</div>

Yes, in the more complicated examples, something similar was happening. I would expect that this would immediately output “infeasible”, instead of this error. I will put in an issue on github.

---

<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: [February 26, 2023, 7:21pm UTC](https://discourse.julialang.org/t/jump-empty-constraint-when-using-sumofsquares/95208/5 "2023-02-26T19:21:33Z")

</div>

This is an issue with CSDP then. A probable work-around is to use a different solver, like Mosek or SCS.

---

<div class="post-metadata">

### Author: ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)
#### Post date: [February 27, 2023, 9:49am UTC](https://discourse.julialang.org/t/jump-empty-constraint-when-using-sumofsquares/95208/6 "2023-02-27T09:49:29Z")

</div>

Yes, this is an issues with CSDP and it works with other solvers. I know this bug for a while but I’m not sure what’s the right fix without adding a lot of extra complexity either in CSDP or SumOfSquares. It’s usually a sign of incorrect modeling so I’ve always found the error actually helpful
