Abstract
Model Predictive Control (MPC) tuning is traditionally a manual and heuristic process because the mapping from controller parameters to closed-loop trajectories is often non-differentiable. We introduce BP-MPC, a framework that employs "conservative Jacobians" and backpropagation through the entire control loop to automatically optimize MPC parameters for peak performance. By treating the closed-loop system as a differentiable computational graph, BP-MPC provides a mathematically rigorous method to tune weights and constraints, even for non-smooth control laws.
Introduction
Model Predictive Control (MPC) is essential for modern industrial automation, yet finding the optimal weights for cost functions and setting terminal constraints remains a significant challenge. Engineers often rely on manual trial-and-error to balance error penalties against control effort. The technical hurdle lies in the non-smooth nature of MPC: as parameters change, the underlying solver may encounter different constraints, causing discontinuous jumps in the gradient. BP-MPC overcomes this by utilizing generalized derivatives to ensure stable and efficient optimization.
Methodology
The BP-MPC framework integrates several advanced techniques to enable gradient-based optimization of the control loop:
Conservative Jacobians and Sensitivity Analysis
To handle the non-differentiability at constraint boundaries, BP-MPC uses conservative Jacobians. This framework allows for the differentiation of functions that are differentiable "almost everywhere," providing the necessary gradients for optimization. The sensitivity of the state trajectory with respect to controller parameters is computed by propagating gradients backward through the entire closed-loop simulation.
Optimization Loop
The method treats the system dynamics and repeated MPC calls as a single computational graph. It applies a nonsmooth version of the Implicit Function Theorem to the Karush-Kuhn-Tucker (KKT) conditions of the MPC's internal quadratic program. This allows the "outer" optimizer to update parameters based on their long-term impact on the system's state.
Linearization and Feasibility
To maintain computational efficiency, BP-MPC uses a linearized model within the MPC (keeping it a convex Quadratic Program), while the outer optimization loop accounts for the true nonlinear dynamics. A "soft constraint" mechanism using slack variables prevents solver failures during the tuning process if infeasible states are encountered.
Experimental Evaluation
The algorithm was evaluated using the Inverted Pendulum on a Cart benchmark, covering both input-constrained and state-constrained scenarios. The implementation utilized the CasADi framework and the DAQP solver.
Key Results
- Performance: BP-MPC achieved closed-loop costs within 0.01% of the global optimum found by heavy-duty nonlinear solvers like IPOPT.
- Efficiency: The resulting tuned Linear MPC was approximately 10 times faster per time-step than a comparable Nonlinear MPC.
- Robustness: The tuned controllers showed superior robustness to stochastic noise compared to standard open-loop optimal trajectories and traditional tuning methods like the Discrete Algebraic Riccati Equation (DARE).
Discussion and Future Work
A key insight of this work is the "receding horizon" effect: decisions made by the MPC at one time step influence future states, which in turn affect subsequent optimization problems. BP-MPC successfully captures these couplings.
While highly effective, the authors note that controllers tuned for specific initial conditions may require further "robustification" to generalize across broader state spaces. Future research will also explore extending the framework to systems with stochastic dynamics and incorporating second-order optimization methods to further accelerate the offline tuning process.
Summary updated