Skip to main content

Quadratic Programming solvers for Python with a unified API

Project description

This module provides a single function solve_qp(P, q, G, h, A, b, solver=X) with a solver keyword argument to select the backend solver. The quadratic program it solves is, in standard form:

https://raw.githubusercontent.com/stephane-caron/qpsolvers/master/.qp.png

where vector inequalities are taken coordinate by coordinate.

Solvers

The list of supported solvers currently includes:

Example

To solve a quadratic program, simply build the matrices that define it and call the solve_qp function:

from numpy import array, dot
from qpsolvers import solve_qp

M = array([[1., 2., 0.], [-8., 3., 2.], [0., 1., 1.]])
P = dot(M.T, M)  # quick way to build a symmetric matrix
q = dot(array([3., 2., 3.]), M).reshape((3,))
G = array([[1., 2., 1.], [2., 0., 1.], [-1., 2., -1.]])
h = array([3., 2., -2.]).reshape((3,))

print "QP solution:", solve_qp(P, q, G, h)

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

qpsolvers-1.0.3.tar.gz (7.1 kB view details)

Uploaded Source

File details

Details for the file qpsolvers-1.0.3.tar.gz.

File metadata

  • Download URL: qpsolvers-1.0.3.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for qpsolvers-1.0.3.tar.gz
Algorithm Hash digest
SHA256 b0b17adc66ac54fc7103f4cb1284657eff2df7bc2c58dae856fd520beca363d6
MD5 8d7e9f1adf4c9b8eca6ce041f2286ba6
BLAKE2b-256 d9ed9088ecc74f40fcb59a14429b07c39b3e2689edddf7401522dc009c632b89

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