1. What MPC Really Does
Model predictive control (MPC) repeatedly solves a finite-horizon optimal control problem online. At the current state, it predicts future system trajectories, chooses a sequence of control inputs that balances performance and constraints, executes only the first input, measures the new state, and solves again. Re-optimization is what turns an open-loop prediction into a closed-loop feedback controller.
Key points
- Prediction uses a system model; optimization chooses the future input sequence; feedback comes from solving again after new measurements.
- MPC is especially attractive when constraints are essential rather than optional.
- The horizon is finite for computation, but repeated receding-horizon execution creates an indefinitely running controller.
One-dimensional intuition
For a car approaching a stop line, MPC can predict position and speed for the next N steps, penalize distance and control effort, constrain speed and acceleration, and choose a braking sequence. Only the first braking command is sent before the problem is solved again.
2. System Model and Discretization
MPC needs a prediction model. A common starting point is the continuous-time linear model ẋ=Ax+Bu, which is discretized at sampling period T_s into x_{k+1}=A_d x_k+B_d u_k. Nonlinear systems use x_{k+1}=f(x_k,u_k). State x should contain the minimum information needed to predict future evolution, while u contains variables the controller can directly choose.
Key points
- Sampling too slowly loses dynamics; sampling too fast increases optimization frequency and may amplify noise.
- Model mismatch is inevitable; robust MPC, adaptive MPC, disturbance models, or frequent state feedback are used to mitigate it.
- For tracking, it is often useful to augment the model with disturbance or integral states to remove steady-state offset.
3. Multi-Step Prediction and Condensed Form
For the linear discrete model, future states can be expanded recursively. After stacking N predicted states and N inputs, the complete prediction can be written as X=𝒜x_k+ℬU. This condensed representation is important because it converts dynamic constraints into one matrix relation and lets the MPC problem be written directly as a quadratic program in the decision vector U.
Key points
- The prediction matrix 𝒜 contains powers of A; ℬ contains A^iB terms describing how every future input affects every future state.
- Condensing reduces explicit state variables but can make matrices dense; sparse formulations keep states and dynamics explicitly and can be better for long horizons.
4. Objective Function: What the Controller Is Asked to Prefer
A standard tracking MPC penalizes predicted state or output error and control effort over the horizon, plus a terminal cost. Q determines which state errors matter, R penalizes aggressive actuation, and sometimes Δu is penalized to obtain smoother commands. The numerical scale of these weights changes closed-loop behavior, so tuning should be tied to physical units and control priorities rather than arbitrary large numbers.
Key points
- Large Q relative to R makes tracking aggressive; large R makes control conservative.
- Normalize states with very different physical scales before interpreting weights.
- Soft constraints introduce slack variables with penalties; this can prevent solver failure when occasional constraint relaxation is physically acceptable.
5. Constraints: The Main Practical Advantage of MPC
MPC can impose state, input, rate, collision, energy, resource, and coupled constraints directly inside the optimization problem. Hard constraints must always be satisfied by the optimizer; soft constraints add slack and penalties. The important distinction is between constraints that describe physics and safety, which should usually remain hard, and comfort/performance preferences, which may be softened.
Key points
- A finite-horizon problem can be infeasible even if the physical system is controllable; constraints and horizon length matter.
- Constraint tightening is used in robust MPC to reserve margin for uncertainty.
- Binary logic, mode switching, scheduling, and assignment produce mixed-integer MPC, which is much more computationally expensive than QP-based linear MPC.
6. From Linear MPC to a Quadratic Program
When dynamics are linear, costs are quadratic, and constraints are linear, the MPC problem is a convex quadratic program. After substituting X=𝒜x_k+ℬU into the objective and constraints, the online problem can be written in the standard form min 1/2 U^T H U + f(x_k)^T U subject to GU≤h+Ex_k. For positive-semidefinite H, modern QP solvers can solve this reliably and quickly.
Key points
- H is determined mainly by Q, R, P and prediction matrices; f changes with the current state/reference.
- Warm-starting with the shifted previous solution can substantially reduce online solve time.
- For embedded deployment, solver worst-case time matters more than average time.
7. The Receding-Horizon Algorithm Step by Step
The implementation loop is simple but must be executed in the correct order. At each sampling time: estimate the state, update references and predictions, build the optimization problem, solve it, check solver status, apply only the first control move, then repeat. The predicted trajectory is a plan, not a commitment; future planned inputs will normally be recomputed before they are used.
Key points
- State estimation is part of the loop if not all states are directly measured.
- Always define a fallback action for solver timeout or infeasibility in a real system.
- Logging predicted constraint margins, objective terms, and solve status is essential for debugging.
8. Recursive Feasibility: Why Feasible Now Should Stay Feasible
Feasibility at one time does not automatically imply feasibility at the next time. Recursive feasibility means that if the MPC problem is feasible now and the prescribed control is applied, the next MPC problem will also be feasible. A standard proof uses a shifting argument: shift the previously feasible control sequence by one step and append a terminal admissible control. Terminal sets and invariant controllers are designed so that this appended tail remains feasible.
Key points
- Recursive feasibility is a property of the controller construction, not merely of the numerical solver.
- Disturbances break nominal shift arguments unless robustness or constraint margins are included.
- Soft constraints improve numerical survivability but do not by themselves prove hard safety constraints remain satisfied.
9. Stability, Terminal Cost, and Terminal Set
A short finite horizon may choose actions that look good within N steps but are bad afterward. Terminal ingredients approximate what happens beyond the horizon. A terminal cost V_f(x) estimates remaining infinite-horizon cost; a terminal set X_f requires the final predicted state to enter a region where a known local controller can keep the system feasible and decrease V_f. Under standard conditions, the optimal MPC cost becomes a Lyapunov function for the closed loop.
Key points
- For linear quadratic MPC, an LQR solution often supplies a natural terminal controller K and terminal matrix P.
- The terminal set should be positively invariant under the terminal controller and respect state/input constraints.
- Not every practical MPC uses an explicit terminal set, but omitting it changes what can be rigorously guaranteed.
10. Robust MPC and Tube MPC
When the real system is x_{k+1}=Ax_k+Bu_k+w_k with bounded disturbance w_k∈W, a nominal MPC plan alone may violate constraints. Tube MPC decomposes the real state into a nominal state z_k and an error e_k=x_k−z_k. The optimizer plans z and a nominal input v inside tightened constraints, while a local feedback K e_k keeps the real state inside a robust invariant error tube around the nominal trajectory.
Key points
- E is a robust positively invariant set for the error dynamics.
- Constraint tightening reserves exactly the margin needed for worst-case tracking error.
- Tube MPC is usually less conservative than planning directly against all disturbance realizations, while remaining computationally practical for linear systems.
11. Nonlinear MPC and Distributed MPC
Nonlinear MPC (NMPC) keeps nonlinear dynamics or constraints and therefore solves a nonlinear program rather than a QP. It can be much more accurate but is harder to solve globally and in real time. Distributed MPC (DMPC) addresses multi-agent or networked systems by decomposing the global problem into local optimizations that exchange trajectories, coupling variables, or dual messages. The main design question becomes how to coordinate coupling while keeping communication and computation manageable.
Key points
- Sequential quadratic programming and interior-point methods are common NMPC solvers; warm starts are very important.
- DMPC can be cooperative, noncooperative/game-theoretic, hierarchical, or consensus/ADMM-based.
- Communication delay and packet loss become part of the controller design, not merely networking details.
12. Tuning and Debugging Checklist
When an MPC behaves badly, debugging should proceed from model and feasibility before changing weights. First verify the discretized model and state estimate, then test unconstrained prediction, then add constraints, and only afterward tune Q/R/P and the horizon. Separate numerical problems from control-design problems by logging condition numbers, solver status, active constraints, and prediction error.
Key points
- If the optimizer is infeasible, inspect which constraint is conflicting before increasing penalties.
- If control is oscillatory, check sampling, model mismatch, overly aggressive Q/R ratio, and missing input-rate penalties.
- If solve time is too high, reduce horizon, exploit sparsity, warm-start, simplify nonlinearities, or move slow combinatorial decisions to a higher layer.
What you should remember
After this note, you should be able to derive a basic linear MPC QP, explain why receding-horizon feedback works, distinguish feasibility from stability, and understand what robust/tube and distributed MPC add.