Skip to main content

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

Project description

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}
}

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

sumofsquares-1.3.1.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

SumOfSquares-1.3.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

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

Hashes for sumofsquares-1.3.1.tar.gz
Algorithm Hash digest
SHA256 92dfe91e558dbf475bd045c6634d22e2d9ab3527e6ea2b959830f6b9b8d6c509
MD5 ba2756683104b43b26506a91cbf24afe
BLAKE2b-256 cbffe23a2fff37720c68bd23f2a0cc4ab29e264d44264384ebabab198fe30e74

See more details on using hashes here.

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

Hashes for SumOfSquares-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99275abe5a3226113d80b595b70576f59926006cbd516568707050eafb43b301
MD5 7e7b2541ab9f2173da50cf6adea6276e
BLAKE2b-256 c1fb6969c171fbaf245c01755efac7eb0516c5d3c8b540a85ef559b8ec9255d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page