A Python interface to conic optimization solvers

GitLabPyPI Anaconda AURLicense Coverage

Welcome to the documentation of PICOS, a powerful and user friendly Python API for convex and mixed integer optimization that dispatches your problem to the best fit solver that is available at runtime. A PDF version of this documentation is available for offline use. Here’s a quick example:

>>> import picos
>>> x = picos.RealVariable("x", 5)
>>> a = picos.Constant("a", range(5))
>>> P = picos.Problem()
>>> P.objective = "min", abs(x - a)                    # abs() - Euclidean norm
>>> con = P.add_constraint(picos.sum(x) == 1)
>>> opt = P.solve(solver="cvxopt")                     # Optional: Solver choice
>>> print(x.T)                                         # .T - Transpose
[-1.80e+00 -8.00e-01  2.00e-01  1.20e+00  2.20e+00]
>>> round(P.value, 3)
4.025

Quickstart guide