LQRax is a GPU-friendly, auto-differentiable solver for continuous-time LQR problems based on Riccati equations, enabled by JAX.
- It accelerates numerical simulation through JAX's
scan
mechanism; - It enables rapid prototyping of single-agent and multi-agent nonlinear control algorithms, with auto-differentiation support on the loss function and dynamics;
- It enables batch-based large-scale optimal control on GPUs using JAX's
vmap
mechanism. - All the operations, including trajectory simulation and control synthesis, are backward-differentiable.
This repo is currently under active development.
Example | Code | Example | Code |
---|---|---|---|
LQR Basics ![]() |
[Notebook] [Google Colab] |
Nonlinear control ![]() |
[Notebook] [Google Colab] |
Multi-agent iLQGames ![]() |
[Notebook] [Google Colab] |
Ergodic control ![]() |
[Notebook] [Google Colab] [More] |
Please also checkout Linear Quadratic Flow Matching that uses this package.
Follow the instructions to install JAX before installing this package.
To install: pip install lqrax
There are two modules: LQR
and iLQR
,
The LQR
module solves the following time-varying LQR problem:
The iLQR
module solves a different time-varying LQR problem:
This formulation is often used as the sub-problem for iterative linear quadratic regulator (iLQR) to calculate the steepest descent direction on the control for a general nonlinear control problem:
where the
The implementations contained herein are copyright (C) 2024 - 2025 by Max Muchen Sun, and are distributed under the terms of the GNU General Public License (GPL) version 3 (or later). Please see the LICENSE for more information.
If you use the package in your research, please cite this repository. You can see the citation information at the right side panel under "About". The BibTeX file is attached below:
@software{sun_lqrax_2025,
author = {["Sun"], Max Muchen},
license = {GPL-3.0},
month = march,
title = {{LQRax: JAX-enabled continuous-time LQR solver}},
url = {https://github.com/MaxMSun/lqrax},
version = {0.0.6},
year = {2025}
}
Contact: msun@u.northwestern.edu