Python implementation of Sum-of-Squares optimization built on picos
Project description
SumOfSquares.py
Documentation | 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]])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SumOfSquares-1.2.2.tar.gz
(11.7 kB
view hashes)
Built Distribution
Close
Hashes for SumOfSquares-1.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69c0dbebbb1a8985b77b416be695b162a75daa9e146b5cab0112c4dfa6a1370d |
|
MD5 | 9cfc04305ea49027467d71e3252a5ac8 |
|
BLAKE2b-256 | 2e05f3bb9ff712f5f235d4fb1b048bcc78e4157843c25a485f64b308721d218d |