Skip to main content

solver-qpoases

A qpOASES wrapper for Python that ships prebuilt binaries. It exposes qpOASES' online active-set solver through a thin, numpy-friendly, MATLAB-quadprog-like interface.

pip install marinholab-solvers-qpoases

Overview

Given a symmetric matrix H, a vector f, and (optionally) inequality and equality constraint matrices, the solver solves the quadratic program

min_x   0.5 * x' H x + f' x
s.t.    A x <= b
        Aeq x = beq

Once a problem has been solved once, subsequent solves on the same Solver instance are warm-started by default (Configuration.use_hotstart = True), which is the main performance benefit of qpOASES for repeated, related QPs.

Quickstart

import numpy as np
from marinholab.solvers import qpoases

solver = qpoases.Solver()

H = np.eye(2)                          # positive definite Hessian
f = np.array([-1.0, -1.0])             # linear term
A = np.array([[1.0, 0.0]])             # x[0] <= 0.2
b = np.array([0.2])

x = solver.solve_quadratic_program(H, f, A, b,
                                   Aeq=np.zeros((1, 2)),
                                   beq=np.zeros((1,)))
# x ≈ [0.2, 1.0]

Omitting constraints

Any of the four constraint arguments (A, b, Aeq, beq) can be None, meaning "no such constraint". The matrix and its right-hand side must be omitted (or provided) together:

# Unconstrained
x = solver.solve_quadratic_program(H, f, None, None, None, None)

# Equality constraints only
x = solver.solve_quadratic_program(H, f, None, None, Aeq, beq)

Active set

solver.get_active_set() reports, for each row of the combined constraint matrix (rows of A followed by rows of Aeq), whether it is:

  • -1 active at its lower bound,
  • 0 inactive,
  • +1 active at its upper bound (equality constraints are always +1, since their bounds coincide).
solver.solve_quadratic_program(H, f, A, b, Aeq, beq)
solver.get_active_set()  # e.g. [ 1.0, 0.0, 0.0]

Configuration

All of qpOASES' Options fields are exposed, plus a few wrapper-specific settings. Create a Configuration, tweak the fields you need, and pass it to the solver:

config = qpoases.Configuration()
config.hessian_type = qpoases.HessianType.HST_SEMIDEF   # H is rank-deficient
config.enableRegularisation = qpoases.BooleanType.BT_FALSE
config.termination_tolerance = 1.0e-9                    # tighter convergence
solver = qpoases.Solver(config)

The enum types are re-exported for convenience: qpoases.BooleanType, qpoases.HessianType, qpoases.PrintLevel, and qpoases.SubjectToStatus.

Wrapper-specific options

Option Default Type Description
maximum_working_set_recalculations 150 int Max working-set recalculations during the initial homotopy (nWSR passed to init/hotstart). Increase if solves hit the maximum.
use_hotstart True bool Warm-start subsequent solves with hotstart() instead of re-initialising with init().
hessian_type HST_POSDEF HessianType Definiteness assumed for H; given to the underlying SQProblem.

Hessian definiteness (HessianType)

Value Meaning
HST_ZERO Hessian is the zero matrix (LP formulation)
HST_IDENTITY Hessian is the identity matrix
HST_POSDEF Hessian is (strictly) positive definite
HST_POSDEF_NULLSPACE Positive definite on the null space of active bounds/constraints
HST_SEMIDEF Positive semi-definite
HST_INDEF Indefinite
HST_UNKNOWN Unknown

qpOASES options

These map 1:1 onto qpOASES' Options fields. Defaults match qpOASES' own defaults for a double-precision build (see Options::setToDefault()), with two deliberate exceptions noted inline: enableNZCTests and enableFlippingBounds default to BT_FALSE here (qpOASES' default is BT_TRUE) because those are the recommended "fast"/MPC settings for repeated, online solves. See the qpOASES manual for a full description of each option.

Booleans (BooleanType: BT_FALSE / BT_TRUE)

Option Default Description
enable_ramping BT_TRUE Enables the ramping strategy.
enable_far_bounds BT_TRUE Enables the far bounds strategy.
enableFlippingBounds BT_FALSE Allows flipping active bounds between lower and upper values. (differs from qpOASES default)
enableRegularisation BT_FALSE Regularises H when (semi-)definiteness is detected.
enable_full_li_tests BT_FALSE Uses the condition-hardened linear-independence (LI) test.
enableNZCTests BT_FALSE Enables the nonzero-curvature test. (differs from qpOASES default)
enable_equalities BT_FALSE Treats equality constraints as always active.
enable_inertia_correction BT_TRUE Repairs the working set when negative curvature is found during a hotstart.
enable_drop_infeasibles BT_FALSE Whether infeasible constraints may be dropped.

Integers (int_t)

Option Default Description
enable_drift_correction 1 Frequency of drift corrections (0 = off).
enable_cholesky_refactorisation 0 Frequency of full Cholesky refactorisation of the projected Hessian (0 = rank updates only).
num_regularisation_steps 0 Max successive regularisation steps.
num_refinement_steps 1 Max iterative-refinement steps.
drop_bound_priority 1 Priority used when dropping bounds.
drop_eq_con_priority 1 Priority used when dropping equality constraints.
drop_ineq_con_priority 1 Priority used when dropping inequality constraints.

Reals (real_t, double)

Option Default Description
termination_tolerance 5.0e6 * EPS (~1.1e-9) Relative tolerance that stops the homotopy. Smaller = more accurate, more work.
bound_tolerance 1.0e6 * EPS Bound tolerance; a constraint whose bounds differ by less is treated as an equality.
bound_relaxation 1.0e4 Offset for relaxing bounds at the start of the initial homotopy (also the initial far-bound value).
eps_num -1.0e3 * EPS Numerator tolerance for the ratio test.
eps_den 1.0e3 * EPS Denominator tolerance for the ratio test.
max_primal_jump 1.0e8 Max allowed primal jump in nonzero-curvature tests.
max_dual_jump 1.0e8 Max allowed dual jump in LI tests.
initial_ramping 0.5 Start value of the ramping strategy.
final_ramping 1.0 Final value of the ramping strategy.
initial_far_bounds 1.0e6 Initial size of the far bounds.
grow_far_bounds 1.0e3 Growth factor applied to the far bounds.
eps_flipping 1.0e3 * EPS Tolerance of the squared Cholesky diagonal factor that triggers flipping a bound.
eps_regularisation 1.0e3 * EPS Scaling factor of the identity matrix used for Hessian regularisation.
eps_iter_ref 1.0e2 * EPS Early-termination tolerance for iterative refinement.
eps_li_tests 1.0e5 * EPS Tolerance for the linear-independence tests.
eps_nzc_tests 3.0e3 * EPS Tolerance for the nonzero-curvature tests.
rcond_s_min 1.0e-14 Min reciprocal condition number of the Schur complement before a refactorisation is triggered.

Status / print enums

Option Default Type Description
print_level PL_LOW PrintLevel Verbosity of qpOASES output (PL_NONE, PL_LOW, PL_MEDIUM, PL_HIGH, PL_TABULAR, PL_DEBUG_ITER). Defaults to PL_LOW so the solver stays quiet (qpOASES' own default is PL_MEDIUM).
initial_status_bounds ST_LOWER SubjectToStatus Status assumed for all bounds at the first iteration.

Print levels (PrintLevel)

PL_DEBUG_ITER, PL_TABULAR, PL_NONE, PL_LOW, PL_MEDIUM, PL_HIGH.

Bound/constraint statuses (SubjectToStatus)

ST_LOWER, ST_INACTIVE, ST_UPPER, ST_INFEASIBLE_LOWER, ST_INFEASIBLE_UPPER, ST_UNDEFINED.

Examples

  • marinholab/solvers/qpoases/example.py — positive-definite and semi-definite solves, the None-constraint path, and the active set. Run it with qpoases_example (installed as a console script).
  • marinholab/solvers/qpoases/example_kinematics.py — an optional example showing the solver used in a hierarchical (task-priority) controller for a kinematically redundant robot, built on dqrobotics. It requires the optional dependencies dqrobotics and dqrobotics-pyplot (pip install --pre dqrobotics dqrobotics-pyplot).

Building from source

The package builds a C++ extension (via CMake + pybind11) and vendors qpOASES and pybind11 as git submodules.

git clone --recurse-submodules <repo>
pip install .

Prerequisites: a C++23 compiler, CMake, an Eigen3 installation, and Python. On Ubuntu: sudo apt-get install cmake libeigen3-dev.

Type checking

The package ships a type stub (marinholab/solvers/qpoases/_core.pyi) and a py.typed marker, so downstream projects can be checked with Pyright (or Pylance) without extra configuration. Run the project's own check with:

pyright

License

The qpOASES library is LGPLv2.1; the wrapper is under the terms of the included LICENSE file.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-win_amd64.whl (249.4 kB view details)

Uploaded CPython 3.13Windows x86-64

marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-macosx_26_0_universal2.whl (264.4 kB view details)

Uploaded CPython 3.13macOS 26.0+ universal2 (ARM64, x86-64)

marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-win_amd64.whl (249.3 kB view details)

Uploaded CPython 3.12Windows x86-64

marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-macosx_26_0_universal2.whl (264.3 kB view details)

Uploaded CPython 3.12macOS 26.0+ universal2 (ARM64, x86-64)

marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-win_amd64.whl (246.4 kB view details)

Uploaded CPython 3.11Windows x86-64

marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-macosx_26_0_universal2.whl (263.2 kB view details)

Uploaded CPython 3.11macOS 26.0+ universal2 (ARM64, x86-64)

marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-win_amd64.whl (244.9 kB view details)

Uploaded CPython 3.10Windows x86-64

marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-macosx_26_0_universal2.whl (261.2 kB view details)

Uploaded CPython 3.10macOS 26.0+ universal2 (ARM64, x86-64)

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bfd5295636a354b410ccd9938d3302957b9db147ffec796f1c21ab2de3c55e19
MD5 fb01f57ce04c73e25588a9762c25b2fd
BLAKE2b-256 2ac0223887e6ff33367bd08259f36fbdfcb9cbe3ede156de3e6665168a0dda4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-win_amd64.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f8af75b3e5efee4c148a2716ad36c08eb3b199f9556c58a38339e6d7da0a886c
MD5 1b2dd2dfb4e2b852f764f0adbff0d11f
BLAKE2b-256 863339901a3c936bf7c85bd6493cc01238d49b4ad70ac5d5e81719382b50c2f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-manylinux2014_aarch64.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-macosx_26_0_universal2.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-macosx_26_0_universal2.whl
Algorithm Hash digest
SHA256 f05640261f88d8e0819cf470d75db432bb929740d0051b1d197c1e9e2b873ad6
MD5 beeed16d4311fdd4b11b9e937f21a157
BLAKE2b-256 b51d5f70345640a8256d96ad6bc0c95fd4686230d76a235467aae905751fae65

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp313-cp313-macosx_26_0_universal2.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 873c61e79a377a5d8975a9b9e8dc316565936553097efc985a543de5c54bb220
MD5 23ff0a830aaaaafa7fc4067892c59442
BLAKE2b-256 ac543c6f5595a3cce1ec48a7ac1d8512e5690f1db3bc32c2297b2ec1daca538f

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-win_amd64.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 30bebfad84c61f8a202676f85506dc290d24d9df3e9873139e52fac563d1c3c1
MD5 0a3041ab730df75adcf9b8b31f4d6fcd
BLAKE2b-256 7fb586436de123c3d98eaf584c682cf3a799716456cfd6774792d4650882428b

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-manylinux2014_aarch64.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-macosx_26_0_universal2.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-macosx_26_0_universal2.whl
Algorithm Hash digest
SHA256 5ad3ec0b833fb50d6e9ba23217bce01094c48ae16607d741e280d58d5ccb957c
MD5 8e8a07b957a4759935b0570bb2953b23
BLAKE2b-256 2804956ba3f1588fa8cf745fa98c9f753e07372bd0647798862f61b80ea157dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp312-cp312-macosx_26_0_universal2.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b3dbb9564cf5f2136153b9deed63596ba3d21a39281d9f02ee4977061a7a5340
MD5 4c59b51cb9b547c5af3b96b54cee3445
BLAKE2b-256 e97b5c4dc3ed6bcf4b54fea3dd0f3c3eb8904877991038684d93c871ddaaa535

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-win_amd64.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e62006a3978722b4727b7a9fd162fe030515c17230564c5d4d2eec9965f501ae
MD5 badcc27a74e053d90881f7f3b2280227
BLAKE2b-256 f8832e74feafbcb669246cf113c558e5082f6926587feb0ac4c7069c2e21ae16

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-manylinux2014_x86_64.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-macosx_26_0_universal2.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-macosx_26_0_universal2.whl
Algorithm Hash digest
SHA256 418cdec2b0ec63c75623d409c57a3821c813176d38a9878e86f2baa977ae903e
MD5 d929074bdcfb5abff2d87034f72a10de
BLAKE2b-256 0f43d2d8cc59e4b9aff727aaea0ce35645dca4f8862a3fee12b563af080f87df

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp311-cp311-macosx_26_0_universal2.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ed333d7c27b0209b8102e5aaecde43fb84b0cb1d1c9c1a676feb6c4a5a6d05f9
MD5 af27cdf49e5dcf798174bbfddd90a86a
BLAKE2b-256 297ffc3bca7a72d3ffa47416f1b383eaaa253c2ec2d35c76ce1d5f9a31f4af65

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-win_amd64.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5b4c8eca2ad16b522d6347ebc01cad94f023eaedfed4afcf1b01c2234d1b8ba6
MD5 7606297e25e97628341b358872dae011
BLAKE2b-256 bcc3c4d629e5db4fbc72d184858d8fbcaac6e8bbcc9e0a341ebc72a5a6333c86

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-manylinux2014_x86_64.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-macosx_26_0_universal2.whl.

File metadata

File hashes

Hashes for marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-macosx_26_0_universal2.whl
Algorithm Hash digest
SHA256 f3315a617e1cd18f9bce10fca2cf9e9db5a5e86a82f3324cd82b149012f47b9f
MD5 3438614f31b7b87660f3a29ead5dfdd2
BLAKE2b-256 ae128ab975041f886854bc0eea4111aedaf5bdeac90b94ba9ccc03b238c8ed56

See more details on using hashes here.

Provenance

The following attestation bundles were made for marinholab_solvers_qpoases-26.4.0.38-cp310-cp310-macosx_26_0_universal2.whl:

Publisher: python-publish.yml on MarinhoLab/solver-qpoases

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

26.4.0.39

15 files

This release

26.4.0.38 This release

12 files

26.4.0.37

6 files

26.4.0.36

6 files

26.4.0.35

6 files

26.4.0.34

6 files

26.4.0.31

4 files

26.4.0.30

4 files

26.4.0.29

4 files

26.4.0.28

4 files

26.4.0.27

4 files

26.4.0.26

4 files

26.4.0.25

4 files

26.4.0.24

4 files

26.4.0.23

4 files

26.4.0.22

4 files

26.4.0.21

4 files

26.4.0.19

4 files

26.4.0.18

4 files

26.4.0.16

4 files

26.4.0.15

4 files

26.4.0.14

4 files

26.4.0.13

2 files

26.4.0.12

1 file

26.4.0.11

1 file

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