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]])
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}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sumofsquares-1.3.1.tar.gz.
File metadata
- Download URL: sumofsquares-1.3.1.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92dfe91e558dbf475bd045c6634d22e2d9ab3527e6ea2b959830f6b9b8d6c509
|
|
| MD5 |
ba2756683104b43b26506a91cbf24afe
|
|
| BLAKE2b-256 |
cbffe23a2fff37720c68bd23f2a0cc4ab29e264d44264384ebabab198fe30e74
|
File details
Details for the file SumOfSquares-1.3.1-py3-none-any.whl.
File metadata
- Download URL: SumOfSquares-1.3.1-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99275abe5a3226113d80b595b70576f59926006cbd516568707050eafb43b301
|
|
| MD5 |
7e7b2541ab9f2173da50cf6adea6276e
|
|
| BLAKE2b-256 |
c1fb6969c171fbaf245c01755efac7eb0516c5d3c8b540a85ef559b8ec9255d5
|