Skip to main content

A multi-parametric quadratic programming solver

Project description

pdaqp is a Python package for solving multi-parametric quadratic programs of the form

$$ \begin{align} \min_{z} & ~\frac{1}{2}z^{T}Hz+(f+F \theta)^{T}z \ \text{s.t.} & ~A z \leq b + B \theta \ & ~\theta \in \Theta \end{align} $$

where $H \succ 0$ and $\Theta \triangleq \lbrace l \leq \theta \leq u : A_{\theta} \theta \leq b_{\theta}\rbrace$.

pdaqp is based on the Julia package ParametricDAQP.jl and the Python module juliacall. More information about the underlying algorithm and numerical experiments can be found in the paper "A High-Performant Multi-Parametric Quadratic Programming Solver".

pdaqp is also the used in CVXPYgen to compute explicit solutions. For more information, see the following manuscript.

Installation

pip install pdaqp

Citation

If you use the package in your work, consider citing the following paper

@inproceedings{arnstrom2024pdaqp,
  author={Arnström, Daniel and Axehill, Daniel},
  booktitle={2024 IEEE 63rd Conference on Decision and Control (CDC)}, 
  title={A High-Performant Multi-Parametric Quadratic Programming Solver}, 
  year={2024},
  volume={},
  number={},
  pages={303-308},
}

Example

The following code solves the mpQP in Section 7.1 in Bemporad et al. 2002

import numpy

H =  numpy.array([[1.5064, 0.4838], [0.4838, 1.5258]])
f = numpy.zeros((2,1))
F = numpy.array([[9.6652, 5.2115], [7.0732, -7.0879]])
A = numpy.array([[1.0, 0], [-1, 0], [0, 1], [0, -1]])
b = 2*numpy.ones((4,1));
B = numpy.zeros((4,2));

thmin = -1.5*numpy.ones(2)
thmax = 1.5*numpy.ones(2)

from pdaqp import MPQP
mpQP = MPQP(H,f,F,A,b,B,thmin,thmax)
mpQP.solve()

To construct a binary search tree for point location, and to generate corresponding C-code, run

mpQP.codegen(dir="codegen", fname="pointlocation")

which will create the following directory:

├── codegen
│   ├── pointlocation.c
│   └── pointlocation.h

The critical regions and the optimal solution can be plotted with the commands

mpQP.plot_regions()
mpQP.plot_solution()

which create the following plots

critical_regions

solution_component

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

pdaqp-0.6.7.tar.gz (215.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdaqp-0.6.7-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file pdaqp-0.6.7.tar.gz.

File metadata

  • Download URL: pdaqp-0.6.7.tar.gz
  • Upload date:
  • Size: 215.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for pdaqp-0.6.7.tar.gz
Algorithm Hash digest
SHA256 69518e2819cc2030830b10328de2a5f8dbbaec37832e8c12915116a03d9137bc
MD5 f4ebcf5dd1b2c6ba5b4f59922a4290f8
BLAKE2b-256 d3d7e80a05bdd029132df03a2f5d61a8f016549000adc9e5c4f7c6436752c9ff

See more details on using hashes here.

File details

Details for the file pdaqp-0.6.7-py3-none-any.whl.

File metadata

  • Download URL: pdaqp-0.6.7-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for pdaqp-0.6.7-py3-none-any.whl
Algorithm Hash digest
SHA256 24d6b3c53bc0b95828194a20ac320da88d2f22179242d92d20d87c38224c4ef9
MD5 fa7f30d3a32467f5bff9d7d5637fdd03
BLAKE2b-256 a1a2307cd9734cd7b2320d02f7bbf1a07eff2b129a571e2550a798af567f5c40

See more details on using hashes here.

Supported by

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