Skip to main content

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

Metadata

Release files for pdaqp 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdaqp 0.7.1
File Size Uploaded
pdaqp-0.7.1.tar.gz 215.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pdaqp 0.7.1
File Interpreter ABI Platform
pdaqp-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 223.0 kB

Release files / pdaqp-0.7.1.tar.gz

Download URL pdaqp-0.7.1.tar.gz
Size 215.2 kB
Tags Source
SHA-256 checksum
How to use checksums
eacc4017f9ac6777c3f74a499635bef79f52ae2a68211ef5a96490dd9f76f6c7
BLAKE2b-256 checksum
How to use checksums
529d5a0a7481083c294ae0dbcfb7169f7608ead8974d04676f05735357bb4dc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Release files / pdaqp-0.7.1-py3-none-any.whl

Download URL pdaqp-0.7.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1c0ac1c2484bfdfeadca01be31f97e17468743fe4f20618ad26efa79a8c961d
BLAKE2b-256 checksum
How to use checksums
cc0cbf39b587c1c5174ab65d2ca2ad903a347696591298c9d2208d0ef9688006
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.7.1 This release

2 release files

0.7.0

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page