jump-dev / SumOfSquares.jl

Sum of Squares Programming for Julia
Other
114 stars 24 forks source link

A trivial example that returns infeasible #290

Open AlexandreAmice opened 1 year ago

AlexandreAmice commented 1 year ago

The following univariate example returns infeasible even though it should be a very simple problem. For the purposes of debugging, is it possible to have the domain of the SOS constraint printed out?

using DynamicPolynomials
using SumOfSquares
using MosekTools
@polyvar x
S = @set -1 <= x && x <= 1

import Mosek
model = SOSModel(Mosek.Optimizer)
set_silent(model)
con_ref = @constraint(model, x^2 <= 1.1, domain = S)
optimize!(model)
solution_summary(model)
odow commented 1 year ago

@blegat is this expected?

I think it's because you don't actually have a free decision variable in your model?

blegat commented 1 year ago

is it possible to have the domain of the SOS constraint printed out?

Yes, that shouldn't be too hard

Maybe try increasing the maxdegree in the constraint keyword argument ?

I'm guessing the issue is that you're using the Putinar certificate instead of the Schmudgen one which would add (x + 1) * (x - 1) as well. See https://jump.dev/SumOfSquares.jl/latest/generated/Extension/certificate We could add an easy way to do Schmudgen (or even do it by default). I was a bit worried that it would add 2^(n-1) polynomials but you quickly get a too high degree anyway so you never really add that many polynomials.