Skip to content

Python implementation of Sum-of-Squares optimization built on picos

License

Notifications You must be signed in to change notification settings

yuanchenyang/SumOfSquares.py

Repository files navigation

SumOfSquares.py

Documentation Build Status
Build Status

Sum of squares optimization built on top of picos. Easy access to pseudoexpectation operators for both formulating problems and extracting solutions via rounding algorithms.

Installation

To install from pypi:

pip install SumOfSquares

Examples

To compute the sum of squares decomposition of a polynomial:

>>> import sympy as sp
>>> x, y = sp.symbols('x y')
>>> p = 2*x**4 + 2*x**3*y - x**2*y**2 + 5*y**4
>>> prob = SOSProblem()
>>> c = prob.add_sos_constraint(p, [x, y])
>>> prob.solve()
>>> c.get_sos_decomp()
Matrix([
[5.0*(-0.306*x**2 + y**2)**2],
[2.057*(0.486*x**2 + x*y)**2],
[                 1.047*x**4]])

More Examples

Citation

If you use this library in your work, please consider citing:

@software{Yuan_SumOfSquares_py,
author = {Yuan, Chenyang},
license = {MIT},
title = {{SumOfSquares.py}},
url = {https://github.com/yuanchenyang/SumOfSquares.py}
}

About

Python implementation of Sum-of-Squares optimization built on picos

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •