You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default SumOfSquares handles equality constraints in the domain by working over the quotient ring R[x]/I where I is the ideal generated by the equality constraints.
This can lead to unexpected behaviour when dealing with noisy data, e.g., when the equality constraints are the result of some preprocessing step which involved floating point computations. A common source for such rounding errors could emmerge from normalizing data.
If we minimize pd[1] over the ideal intersected with (pd[1]-0.5)*(1.5-pd[1]) >=0 we could expect that the mimum is between 0.5 and 1. However, the problem is infeasible.
using SumOfSquares
using MosekTools
m =SOSModel(Mosek.Optimizer)
@variable m t
@objective m Max t
@constraint(m,
pd[1]-t >=0,
domain =basicsemialgebraicset(algebraicset(p), [(pd[1]-0.5)*(1.5-pd[1])]),
maxdegree =4
)
optimize!(m)
termination_status(m)
# DUAL_INFEASIBLE::TerminationStatusCode = 3
This problem could be solved by introducing an option to encode equality constraints differently. A common way is to introduce polynomial multipliers for the equality (such as SOSPoly multipliers are introduced for inequalities).
vars =sort!(collect(keys(sub)); rev =true)
m =SOSModel(Mosek.Optimizer)
@variable m t
@objective m Max t
lhs =let
lhs = pd[1] - t
for poly in p
pi=@variable m variable_type =Poly(monomials(vars, 0:4-maxdegree(poly)))
lhs -=pi*poly
end
lhs
end@constraint(m,
lhs >=0,
domain =@set((pd[1]-0.5)*(1.5-pd[1])>=0),
maxdegree =4
)
optimize!(m)
termination_status(m)
# OPTIMAL::TerminationStatusCode = 1
Now the problem solves with optimal and actually returns an expected solutions.
The text was updated successfully, but these errors were encountered:
By default SumOfSquares handles equality constraints in the domain by working over the quotient ring R[x]/I where I is the ideal generated by the equality constraints.
This can lead to unexpected behaviour when dealing with noisy data, e.g., when the equality constraints are the result of some preprocessing step which involved floating point computations. A common source for such rounding errors could emmerge from normalizing data.
Symbolically the ideal is empty:
However, if we allow for some numerical error the following point can be seen as a solution:
If we minimize
pd[1]
over the ideal intersected with(pd[1]-0.5)*(1.5-pd[1]) >=0
we could expect that the mimum is between0.5
and1
. However, the problem is infeasible.This problem could be solved by introducing an option to encode equality constraints differently. A common way is to introduce polynomial multipliers for the equality (such as SOSPoly multipliers are introduced for inequalities).
Now the problem solves with optimal and actually returns an expected solutions.
The text was updated successfully, but these errors were encountered: