Skip to main content

SSQP

CI License: BSD 3-Clause C++17 Python 3.10+

SSQP is a structure-exploiting Sequential Quadratic Programming (SQP) solver for nonlinear optimal control problems. It is designed for trajectory generation and real-time Model Predictive Control (MPC), with native support for manifold-valued states such as floating-base orientations.

SSQP solves problems of the form

\begin{aligned}
\min_{x,u}\quad &\sum_{k=0}^{H-1} \ell_k(x_k,u_k) + \ell_H(x_H) \\
\text{subject to}\quad &x_{k+1}=f_k(x_k,u_k), &&0\leq k < H,\\
&c_k(x_k,u_k)\geq 0, &&0\leq k < H,\\
&c_H(x_H)\geq 0.
\end{aligned}

At every SQP iteration, SSQP linearizes the dynamics and constraints and quadratizes the costs to form a stagewise, banded Quadratic Program (QP). A line search uses the QP solution to update the nonlinear trajectory.

The full documentation is available on the documentation site, including the installation guide, Python quickstart, concepts, examples, and generated Python and C++ API references.

Features

  • Structure-exploiting SQP for finite-horizon optimal control.
  • Euclidean and manifold-valued state components.
  • Custom or predefined dynamics, costs, constraints, and terrain models.
  • Kinematics, ForwardDynamics, InverseDynamics, and ReducedInverseDynamics formulations.
  • ADMM QP solver by default, with optional HPIPM/BLASFEO support.
  • Receding-horizon MPC with warm starts and bounded per-step iteration counts.
  • C++17 library and Python bindings through nanobind.
  • Deterministic regression, finite-difference, and sanitizer-enabled tests.

Repository layout

Path Contents
include/, src/ C++ library headers and implementation
python/ ssqpy Python bindings
examples/trajgen/ Offline trajectory-generation examples
examples/mujoco_mpc/ MPC examples using MuJoCo
examples/real_mpc/ MPC examples for real systems
benchmarks/ Solver and formulation benchmarks
examples/visualizer/ Trajectory visualization utilities
examples/models/ Custom model implementations and utilities
examples/assets/ URDF and MJCF model assets
tests/ Unit, regression, gradient, and sanitizer test infrastructure
external/ Repository-vendored dependencies such as JSON and Tracy
cmake/ Dependency and packaging build logic

Installation

Prebuilt wheels are available for Linux x86_64 and Python 3.10 or newer:

pip install ssqp

The package provides the ssqpy module. The wheels require a CPU with AVX2 and FMA (Intel Haswell, AMD Excavator or newer). On older CPUs, importing ssqpy fails with an illegal instruction error, so build from source instead, as described below.

Dependencies

The default source build requires:

  • A C++17 compiler
  • CMake 3.22 or newer
  • Eigen3
  • Boost headers and static Filesystem and Serialization archives, when available. If the headers or either static archive is unavailable, CMake fetches the matching Boost sources and builds PIC static archives automatically.
  • Git and network access for the first build
  • Python 3.10 or newer and NumPy when Python bindings are enabled

Pinocchio and its URDF parser dependencies are fetched and built by CMake. Nanobind is fetched when the Python bindings are enabled. HPIPM and BLASFEO are fetched only when WITH_HPIPM=ON.

Clone the repository with its submodules:

git clone --recurse-submodules https://github.com/upatras-lar/ssqp.git
cd ssqp

Building

Configure and build from the repository root:

cmake -S . -B build
cmake --build build -j"$(nproc)"

The first build compiles the pinned external dependencies and can take some time. Reusing the same build directory keeps those dependencies incremental; subsequent builds rebuild only targets affected by changed source files.

The default configuration builds the Python bindings and tests. The compiled library is placed under build/lib, the Python module under build/bindings, and the test runner under build/tests.

The Boost components used by Pinocchio are always linked statically. The ssqpy extension still uses the normal platform C and C++ runtime libraries, but it does not depend on shared Boost, Pinocchio, URDF, HPIPM, or BLASFEO libraries. Verify this for a completed build with:

cmake --build build --target verify-static-dependencies

CMake options

Pass options during configuration with -DNAME=VALUE:

Option Default Description
WITH_HPIPM ON Build and enable the HPIPM/BLASFEO QP backend
BUILD_PYTHON ON Build the ssqpy Python module
BUILD_TESTS ON Build the unit and regression tests
BUILD_EXAMPLES OFF Build the C++ trajectory-generation examples
ENABLE_PROFILING OFF Enable Tracy profiling support
DISABLE_LOGGING OFF Compile out SSQP logging
ENABLE_SANITIZERS OFF Enable AddressSanitizer and UndefinedBehaviorSanitizer
SSQP_BOOST_VERSION 1.86.0 Boost release fetched when no system Boost headers are available
SSQP_MARCH_NATIVE ON Compile SSQP and Pinocchio with -march=native
SSQP_ARCH_FLAG empty Architecture flag used instead when SSQP_MARCH_NATIVE is OFF, e.g. -march=x86-64-v3
SSQP_BLASFEO_AUTO_TARGET ON Let BLASFEO pick its kernels for the build machine
SSQP_BLASFEO_TARGET GENERIC BLASFEO target used when SSQP_BLASFEO_AUTO_TARGET is OFF, e.g. X64_INTEL_HASWELL

For example, to build with the C++ examples:

cmake -S . -B build -DBUILD_EXAMPLES=ON
cmake --build build -j"$(nproc)"

By default the build uses -march=native and lets BLASFEO pick its kernels for the build machine, so generated binaries and prebuilt dependency packages are tied to the architecture on which they were built. To build binaries that run on other machines, turn off SSQP_MARCH_NATIVE and SSQP_BLASFEO_AUTO_TARGET, and set SSQP_ARCH_FLAG and SSQP_BLASFEO_TARGET to the oldest CPU family you want to support. The PyPI wheels use the settings in cmake/WheelConfig.cmake.

Prebuilt dependencies

Pinocchio and, when HPIPM is enabled, HPIPM/BLASFEO can be supplied as prebuilt packages instead of being compiled from source:

cmake -S . -B build \
  -DSSQP_PREBUILT_PINOCCHIO_DIR=/path/to/prebuilt/pinocchio \
  -DSSQP_PREBUILT_HPIPM_DIR=/path/to/prebuilt/hpipm
cmake --build build -j"$(nproc)"

On a machine that has already built the dependencies from source, create the packages with:

cmake --build build --target package-pinocchio
cmake --build build --target package-hpipm

The resulting packages are written to build/prebuilt/pinocchio and build/prebuilt/hpipm. They must match the target compiler, architecture, and CPU features.

Python bindings

Install the built module into the Python environment selected by CMake:

cmake --install build
python -c "import ssqpy; print('ssqpy imported successfully')"

For a build-local setup, use PYTHONPATH instead:

export PYTHONPATH="$PWD/build/bindings:$PYTHONPATH"
python -c "import ssqpy; print('ssqpy imported successfully')"

The examples provide a helper that sets this path:

cd examples
source setup_env.sh
python trajgen/python/di.py

The di.py example defines a double-integrator dynamics model and quadratic tracking cost, constructs an ssqpy.model.Model, and solves it with ssqpy.solvers.ssqp. Custom dynamics subclass ssqpy.model.dynamics.StageDynamics; custom costs subclass ssqpy.model.costs.StageCost.

Solvers and MPC

The default QP backend is SSQP's ADMM implementation. HPIPM can be selected as such, provided the build includes it:

params = ssqpy.solvers.ssqpParams()
params.qp_solver_type = ssqpy.solvers.QPSolverType.HPIPM
solver = ssqpy.solvers.ssqp(model, params)

For receding-horizon control, ssqpy.solvers.MPC repeatedly solves the OCP with a small iteration budget, applies the first control, feeds back the current state, and warm-starts the next solve:

mpc = ssqpy.solvers.MPC(model, sqp_iters=5, qp_iters=50)
mpc.reinitialize(initial_state)

while running:
    state = read_state()
    x, u = mpc.step(state)
    apply_control(u.stage(0))

See the MPC concept guide and examples/mujoco_mpc/ for complete control loops.

Examples

The examples README describes the available examples. They cover offline trajectory generation, simulated MPC, real-system MPC, adaptive pendulum models, benchmarks, and trajectory visualization.

The documentation includes walkthroughs for:

  • Pendubot swing-up
  • Panda circle trajectory generation
  • Go2 jumping with contact scheduling
  • Panda circle tracking with MuJoCo MPC

Testing

Build and run the standard test suite:

cmake -S . -B build
cmake --build build --target run_tests -j"$(nproc)"
ctest --test-dir build --output-on-failure -j"$(nproc)"

CTest discovers each test case separately, so a crash or timeout in one case does not prevent the remaining cases from running. To run a subset directly:

build/tests/run_tests --list
build/tests/run_tests --filter Regression_
build/tests/run_tests --filter gammafGradTest --seed 42

Failed test diagnostics are written to tests/logs/<test-name>.txt. See tests/README.md for the correctness coverage, deterministic seeding, finite-difference checks, sanitizer builds, and leak-detection notes.

Citing

If you use SSQP in your work, please cite it as

@misc{ssqpsoftware,
  author       = {Nick Karydakis and  Konstantinos Chatzilygeroudis},
  title        = {{SSQP}: A Structure-Exploiting Sequential Quadratic Programming Solver},
  howpublished = {Online resource / Software},
  year         = {2026},
  url          = {https://github.com/upatras-lar/ssqp},
  urldate      = {2026-10-08}
}

Development status

SSQP is under active development. While most of the source API, Python bindings, build system and documentation are not expected to change drastically, this might still be the case before the release of version 1.0, as we potentially restructure to improve performance.

Metadata

Release files for ssqp 0.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 ssqp 0.1
File Size Uploaded Provenance Actions
ssqp-0.1.tar.gz 659.6 kB With provenance Details for ssqp-0.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ssqp 0.1
File Interpreter ABI Platform Actions
ssqp-0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for ssqp-0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
ssqp-0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for ssqp-0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
ssqp-0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for ssqp-0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 10.3 MB

Release files / ssqp-0.1.tar.gz

Download URL ssqp-0.1.tar.gz
Size 659.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2292fcd0fc0268f9279a0042ca6b540375c1398b1d7d92b7329cb251881ffa14
BLAKE2b-256 checksum
How to use checksums
45e43d36eed84185ee7013ba716322edcda9fb96eb700006a0455b37b4793a77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / ssqp-0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL ssqp-0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.2 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
52c473a5d17b0ad49af5229532f4993fb98a0722f100cba5a8996a9e2957e5f0
BLAKE2b-256 checksum
How to use checksums
3df6638275c582ec6973b62838e82420e3711b8bd0d42cf1b88ef756b268b7ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / ssqp-0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL ssqp-0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.2 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
aadb2aad095834e393e7fdc4453d186a311daadcc2dcc7c966f6172817dd6464
BLAKE2b-256 checksum
How to use checksums
e53101f98e36e8839558943cbe691048a276ae1ae24a51119c15c55806d5d6f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / ssqp-0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL ssqp-0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.2 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
785f833a61b8ce4d4b229adb26848ce96c173897663913147cb9adcd112ce863
BLAKE2b-256 checksum
How to use checksums
430f841af64cc8477b8304bbf84c08e9a8dec670de7964ad4df5af006de68e9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Security for ssqp 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for ssqp-0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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