# locuslab/mpc.pytorch

A fast and differentiable model predictive control (MPC) solver for PyTorch.

Repository: https://github.com/locuslab/mpc.pytorch
Canonical: https://ross.abutalabs.com/products/mpcpytorch
Homepage: https://locuslab.github.io/mpc.pytorch/
Language: Python
License: MIT
License Family: permissive
Last push: 2024-08-27T20:26:01+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 2892, "days_push": 736, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1078, forks 164 (observed 2026-08-28T04:03:29.904954+00:00)

## What it is
mpc.pytorch is a fast and differentiable model predictive control (MPC) solver implemented as a PyTorch library. It solves receding-horizon optimal control problems using the box-DDP heuristic and supports gradients flowing through the solver for learning-based applications.

## Use cases
- solve model predictive control problems inside PyTorch models
- train neural networks end-to-end through an MPC solver
- implement differentiable MPC for model-based reinforcement learning
- control simulated robots with receding-horizon optimization
- reproduce research from the differentiable MPC and OptNet papers

## When to choose
- you need MPC as a differentiable layer in PyTorch
- you are doing model-based RL research with control priors
- you want a GPU-friendly, batched MPC solver in Python

## When to avoid
- you need a production-grade, actively developed MPC solver
- you work outside PyTorch or need non-Python integration
- you need robust support for hard nonlinear constraints beyond box-DDP

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, simulation, math
- domain: machine-learning, robotics, reinforcement-learning
- platform: python
- tags: model-predictive-control, differentiable-optimization, pytorch, optimal-control, box-ddp, algorithms

## Member repositories
- locuslab/mpc.pytorch (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:29.904954+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:53:10.202512+00:00, confidence not recorded.
  - readme: https://github.com/locuslab/mpc.pytorch (fetched 2026-08-28T04:03:29.904954+00:00, sha 82987aa6cfc3)
  - homepage: https://locuslab.github.io/mpc.pytorch/ (fetched 2026-08-29T12:54:28.802903+00:00, sha b921a3412b17)
- Data as of 2026-08-30T08:39:29.467469+00:00.
