Differentiable Model Predictive Control on the GPU
  • Jupyter Notebook 81.9%
  • Python 17.8%
  • Shell 0.2%
  • Dockerfile 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-15 18:41:57 -05:00
benchmarking Merge commit 'db0c44e243' into agent/depsb-diffmpc-combined-20261116 2026-11-16 00:33:04 +01:00
diffmpc fix(integrators) & feat(pq): fix get_state_trajectory 7-arg TypeError & redundant Euler step + add zero-float p/q Schur-Complement PCG 2026-10-24 20:23:57 +09:00
figs Updated README. 2025-10-07 11:25:53 -07:00
notebooks First commit. 2025-10-07 10:56:52 -07:00
tests fix(integrators) & feat(pq): fix get_state_trajectory 7-arg TypeError & redundant Euler step + add zero-float p/q Schur-Complement PCG 2026-10-24 20:23:57 +09:00
.gitignore First commit. 2025-10-07 10:56:52 -07:00
.gitmodules First commit. 2025-10-07 10:56:52 -07:00
.pre-commit-config.yaml First commit. 2025-10-07 10:56:52 -07:00
LICENSE.txt First commit. 2025-10-07 10:56:52 -07:00
README.md Updated README. 2025-10-07 18:33:45 -07:00
requirements.txt First commit. 2025-10-07 10:56:52 -07:00
setup.py First commit. 2025-10-07 10:56:52 -07:00

diffmpc

Differentiable Model Predictive Control (MPC) on the GPU

This repository contains the code to reproduce results in Section 4 of Differentiable Model Predictive Control on the GPU by Emre Adabag, Marcus Greiff, John Subosits, and Thomas Lew.

diffmpc can be used to tune MPC algorithms via reinforcement learning and domain randomization to enable robust performance. For example, diffmpc can be used to enable robust drifting through water puddles. supra_puddle

diffmpc uses sequential quadratic programming (SQP) and a custom preconditioned conjugate gradient (PCG) routine to exploit the problem's structure and enable efficient parallelization on the GPU. diffmpc

Installation

This code was tested with Python 3.10.12 on Ubuntu 22.04.5.

We recommend installing the package in a virtual environment. First, run

python -m venv ./venv
source venv/bin/activate

Upgrade pip and install all dependencies by running:

python -m pip install --upgrade pip
python -m pip install -r requirements.txt

Clone and update submodules:

git submodule update --init --recursive

The package can be installed by running

python -m pip install -e .

To enable CUDA support, you may need to install an extra. For cuda 12, this would be:

pip uninstall -y jax jaxlib
pip install --upgrade "jax[cuda12]"

Examples

For examples on how to use diffmpc, refer to:

Benchmarking

Scripts and instructions for rerunning benchmarks are in benchmarking (see details here).

Testing

The following unit tests should pass:

python -m pytest tests