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.
Installation
pip install pdaqp
Example
The following code solves the mpQP in Section 7.1 in Bemporad et al. 2002
import pdaqp
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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pdaqp-0.2.0.tar.gz
.
File metadata
- Download URL: pdaqp-0.2.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c54db27a29851acdc6eb06ec58e7c1d0b1782bf37e79bd7e2a52400fc2f37b65 |
|
MD5 | 70ebecf2ed60a29327f52d990d34d353 |
|
BLAKE2b-256 | 08206164a1c44c3b124f73f42bd923c121e8ecdd60f772f647b8b8e173572e3b |
File details
Details for the file pdaqp-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: pdaqp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 537fecb8e367610d1739487fcd04d7114eb88dd7dae49f26bb2c1a344fe4e020 |
|
MD5 | 1f9669e956363bf2b9518f43d55c9989 |
|
BLAKE2b-256 | 08a7a5e6c39ab7fb1458b4085cf694e909d2f5ada76d1ab04354b96d05c58fa4 |