This repository provides MATLAB implementations of the reduced bilevel MPC proposed in our paper, along with several baseline methods for comparison:
- Hierarchical MPC (P0)
- Original bilevel MPC (P1)
- Reduced bilevel MPC (P2)
- Centralized MPC (P3)
- Move-blocking variants (P1(M), P2(M))
The code allows users to reproduce numerical results and compare control performance across these formulations.
This repository accompanies the following paper:
"Bilevel MPC for Linear Systems: A Tractable Reduction and Continuous Connection to Hierarchical MPC" Submitted to IEEE CDC
The main purpose of this code is to reproduce the results presented in the paper, including:
- Toy example
- Quadrotor example
- Solve and compare multiple MPC formulations (P0–P3, P1(M), P2(M))
- Plot state and input trajectories over the prediction horizon
- Evaluate the effect of move-blocking matrices on performance
- Compute and visualize upper bounds proposed in the paper
- Run closed-loop simulations for all methods
- Reproduce both toy and quadrotor experiments via configurable settings
.
├── figs/ # Saved figures
├── bilvlMPC.m # Main script (OCP comparison & closed-loop simulation)
├── MB_bounding.m # Script for move-blocking performance bounds
├── ToySetting.m # Toy example configuration
├── Quadrotor_setting.m # Quadrotor configuration
└── (other auxiliary files)
- MATLAB R2024b
- Optimization Toolbox
- Control System Toolbox
In bilvlMPC.m, specify the problem:
prob = ToySetting; % or Quadrotor_settingIn bilvlMPC.m, set:
mode = *; % choose from belowAvailable modes:
-1 : Single OCP comparison at x = x0
0 : P0 (hierarchical MPC) closed-loop simulation
1 : P1 (bilevel MPC) closed-loop simulation
2 : P2 (reduced bilevel MPC) closed-loop simulation
3 : P3 (centralized MPC) closed-loop simulation
10 : P1(M) (move-blocking bilevel MPC)
20 : P2(M) (move-blocking reduced bilevel MPC)
Or, you can specify the execution mode by giving it as an argument, e.g.:
bilvlMPC(1);Set mode = -1; in bilvlMPC.m and run
run('bilvlMPC.m')Or, just
bilvlMPC(-1);This compares P0–P3, P1(M), and P2(M) for a fixed initial state.
In MB_bounding.m, select toy or quadrotor setting inside the script, and run
run('MB_bounding.m')This generates:
- Optimal values of P1(M), P2(M), and P0
- Upper bounds proposed in the paper
Set mode = 0,1,2,3,10,20; in bilvlMPC.m and run
run('bilvlMPC.m')Or, just specify it in the argument, e.g.:
bilvlMPC(0);This executes closed-loop simulations for the selected method and plots the results.
- Results may slightly vary depending on solver tolerances.
- Figures are saved in the
figs/directory. - The configuration files (
ToySetting.m,Quadrotor_setting.m) define system dynamics, cost, and constraints.
MIT License
- Ryuta Moriyasu, Stanford University / Toyota Motor North America, moriyasu@stanford.edu
- Carmen Amo Alonso, Stanford University, camoalon@stanford.edu
- Marco Pavone, Stanford University / NVIDIA Research, pavone@stanford.edu
