jump-dev / SumOfSquares.jl

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

Primal residual computation #327

Closed htadashi closed 7 months ago

htadashi commented 8 months ago

Hi @blegat, is there (or any plans to add) a function in SumOfSquares.jl that checks the difference between the SOS decomposition found by the solver and the original polynomial (similar to YALMIP's checkset command)?

blegat commented 8 months ago

You can do

con_ref = @constraint(model, p in SOSCone())
gram_matrix(con_ref) - p
# or
sos_decomposition(con_ref, tol) - p

The difference is that gram_matrix gives you the plain gram matrix while sos_decomposition additionally discards the negligible eigenvalues with tol.

htadashi commented 7 months ago

Thanks for clarifying! :)