Sum of Squares Programming for Julia
Clone or download
blegat Merge pull request #54 from lkapelevich/renameresult
result_value -> value and result_dual -> dual
Latest commit 0110ae1 Nov 15, 2018

Sum of Squares Programming for Julia.

Documentation PackageEvaluator Build Status Social References to cite
Build Status Build Status Gitter DOI
Coveralls branch Codecov branch

This packages contains the Sum of Squares reformulation for polynomial optimization. When used in conjunction with MultivariatePolynomial and PolyJuMP, it provides a Sum of Squares Programming extension for JuMP. Enabling the creation of sum of squares variables and constraints.


The most recently tagged version of this package works with most recently tagged version of JuMP, i.e. JuMP v0.18.x, to try this package with JuMP v0.18, simply do

] add SumOfSquares

The development of this package for JuMP v0.18.x is done in the release-0.2 branch. The master branch of this package works with the JuMP master. To try this package with JuMP master, do:

] add JuMP#master
] add PolyJuMP#master
] add SumOfSquares#master


  • STABLEmost recently tagged version of the documentation.
  • LATESTin-development version of the documentation.

Some presentations on, or using, SumOfSquares:

The following example shows how to find lower bounds for the Goldstein-Price function using this package with MultivariatePolynomial and PolyJuMP.

using MultivariatePolynomials
using JuMP
using PolyJuMP
using SumOfSquares
using DynamicPolynomials
using Mosek

# Create symbolic variables (not JuMP decision variables)
@polyvar x1 x2

# Create a Sum of Squares JuMP model with the Mosek solver
m = SOSModel(solver = MosekSolver())

# Create a JuMP decision variable for the lower bound
@variable m γ

# f(x) is the Goldstein-Price function
f1 = x1+x2+1
f2 = 19-14*x1+3*x1^2-14*x2+6*x1*x2+3*x2^2
f3 = 2*x1-3*x2
f4 = 18-32*x1+12*x1^2+48*x2-36*x1*x2+27*x2^2

f = (1+f1^2*f2)*(30+f3^2*f4)

# Constraints f(x) - γ to be sum of squares
@constraint m f >= γ

@objective m Max γ

status = solve(m)

# The lower bound found is 3