Model Predictive Control: Receding-Horizon Optimization as Implicit Feedback
Model predictive control as online approximate dynamic programming: the constrained finite-horizon optimal-control problem solved as a quadratic program at every state, the first move applied and the problem re-solved (receding horizon). With the LQR cost-to-go as terminal cost the finite horizon recovers LQR exactly; terminal ingredients (a terminal cost and an invariant terminal region) make the MPC value function a Lyapunov function, delivering closed-loop stability and recursive feasibility — Chapter 1's Bellman equation run online over a horizon, with constraints as first-class citizens.
On this page
Model Predictive Control: Receding-Horizon Optimization as Implicit Feedback
Where we are. Chapter 13 solved the unconstrained linear-quadratic problem in closed form: one algebraic Riccati equation gives a single feedback gain good for all time. But real actuators saturate, real states have limits, and the moment a constraint is present the Riccati equation has nothing to say — there is no closed form. Model predictive control (MPC) answers with a different idea: do not precompute one feedback law. Instead, at the current state, solve a finite-horizon optimal-control problem numerically, apply only its first move, and at the next state solve it again. The optimization is the controller — feedback by re-solving. This is the most widely deployed advanced control method in industry García et al. (1989) , and, read through Chapter 1, it is dynamic programming run online: an -step Bellman lookahead with the LQR cost-to-go grafted on as a terminal estimate.
From one gain to a horizon of decisions
Chapter 13 minimized a quadratic cost over an infinite horizon and got a stationary gain. MPC keeps the quadratic cost but makes three moves: it (i) truncates the horizon to a finite , (ii) adds hard constraints , , and (iii) re-solves at every state rather than precomputing. The price of constraints is the loss of a closed form; the payment is a numerical optimization at each step — for linear dynamics and a quadratic cost, a quadratic program (QP), which modern solvers dispatch in microseconds Stellato et al. (2020) .
For the system with stage cost (, ) and terminal cost , the MPC value function at state is
subject to , the dynamics , and the constraints , , (the terminal set, made precise in Definition 15.2). The MPC control law is the first optimal move, , applied to give the closed loop .
With polyhedral (box bounds, here), the problem is a convex QP: a
quadratic objective in the stacked decision variables subject to linear equality (dynamics) and
inequality (constraints) constraints. The companion builds it with JuMP and solves it with OSQP, a
first-order operator-splitting solver Stellato et al. (2020)
.
The terminal cost that recovers LQR
Before stability, a sanity check that ties MPC to Chapter 13. Strip the constraints and set the terminal cost to the LQR cost-to-go. The finite horizon then collapses to the infinite-horizon answer — for any horizon length.
Let be the stabilizing solution of the discrete algebraic Riccati equation (Chapter 13, under stabilizability of and detectability of ) with gain . If the terminal cost uses and no inequality constraint is active at the optimum, then for every horizon the MPC law is the LQR law, .
Without active inequalities the problem of Definition 15.1 is the unconstrained finite-horizon LQR of Chapter 13, whose solution is the backward Riccati recursion , . Initialize it at . Because solves the DARE, it is a fixed point of the Riccati map, so for all — the recursion never moves. The first-step gain is therefore , and the applied move is regardless of .
The terminal cost is doing the work: setting it to the exact optimal cost-to-go makes one step of lookahead see the entire infinite future, so the horizon length stops mattering. This is the first appearance of the chapter’s thesis: a good terminal cost is a value-function estimate, and the better the estimate, the shorter the horizon you need. With constraints the exact cost-to-go is unavailable in closed form, so we keep as a local terminal estimate and lean on the horizon to handle the rest.
Terminal ingredients
The recursive structure that made Proposition 15.1 work — appending the local LQR move at the end — is exactly what stability needs. Mayne et al. (2000) distilled it into two terminal ingredients: a terminal cost and a terminal set, compatible with a local controller (the textbook synthesis is Rawlings et al. (2017) ).
A terminal cost and terminal set are admissible for a local controller if, for all : (i) constraint compatibility — and ; (ii) invariance — ; (iii) cost decrease — .
For the linear-quadratic problem there is a canonical choice: take (the LQR law), (the DARE cost-to-go), and
, the Lyapunov sublevel set on
which respects the constraints. Condition (iii) then holds with equality: the DARE
rearranges to , which is exactly along the local closed loop — the same Lyapunov identity proved in Chapter 13.
Invariance follows from that identity: on the local closed loop gives , so ; and constraint compatibility holds because is chosen small enough that stays within the input box — and, if a state box is present, within it — everywhere on (the companion’s terminal_region computes the largest such , taking both bounds into account).
One caveat the companion makes concrete. The set is quadratic, so imposing the terminal constraint of Definition 15.1 literally would make the program a QCQP — which the QP solver OSQP cannot take. The companion therefore imposes the terminal cost (and, for the feasibility study, a linear terminal box as a concrete admissible surrogate for ) and verifies -invariance of the realized closed loop rather than encoding it as a constraint. This suffices for the MPCLQR and stability demonstrations, which need only the terminal cost; the terminal-set constraint is what the general recursive-feasibility theorem below requires.
Stability: the value function is a Lyapunov function
With admissible terminal ingredients the descent argument of Chapter 14 transfers wholesale, but now the certificate is the optimization value itself. The engine is a single feasible candidate built by shifting the previous solution.
Under admissible terminal ingredients, for every feasible state ,
Let be optimal at , with predicted states , so . At the successor form the shifted candidate : replay the tail of the optimal plan, then append the local controller. It is feasible — the first moves reuse states that already satisfy the constraints, and by invariance gives with . Evaluating the objective on replays stages of and appends the local step, so its cost is
The optimal cost is ; the two sums share stages , so the candidate cost equals . Since is the minimum over feasible plans, it is no larger than this candidate’s cost:
Since and the bracket is non-positive, .
Under admissible terminal ingredients and , the origin is asymptotically stable for the MPC closed loop, with region of attraction the feasible set (the states from which the -step problem is feasible). For merely the same conclusion holds when is detectable, through a LaSalle argument as in Chapter 14.
is a Lyapunov function on . It is positive definite: , and on it is bounded above by . Lemma 15.1 gives for . Positive-definiteness, the local upper bound on , and this strict descent are the hypotheses of the discrete Lyapunov theorem (Chapter 14), so the origin is asymptotically stable. Because is positively invariant (Theorem 15.2) and the value strictly descends on it, every feasible trajectory enters and converges — the region of attraction is all of .
The proof is Chapter 14’s Lyapunov argument with , and the descent quantity is the stage cost — the same accounting as the LQR Lyapunov identity, now carried by the optimization rather than a fixed gain. The companion runs the closed loop on the double integrator and samples exactly this: the realized state goes to zero, is non-increasing step to step, the quadratic strictly decreases, and once the trajectory enters it never leaves.
Recursive feasibility
Stability assumed the problem stays solvable. That is not automatic — a feasible problem now can become infeasible next step if a constraint cannot be honored from the successor state. The shifted candidate of Lemma 15.1 settles it: it is a feasible plan at the successor, so feasibility propagates.
Under admissible terminal ingredients, if the MPC problem is feasible at it is feasible at every subsequent closed-loop state: implies for all . The feasible set grows with the horizon, .
The shifted candidate constructed in Lemma 15.1 satisfies every constraint of the problem at , so — one feasible step certifies the next. Induction gives feasibility for all . For the monotonicity, any feasible -step plan extends to a feasible -step plan by appending at the (invariant) terminal state, so .
The growth of with is the practical knob: a state too far from the origin to be steered into the terminal region within a short horizon becomes reachable as the horizon lengthens. The companion demonstrates both directions — a tight terminal box with a far initial state is infeasible at a short horizon (the solver reports infeasibility and the code raises, never silently returning a bad move) and feasible once the horizon is long enough.
MPC as online approximate dynamic programming
This is the chapter the title promised. Set the two computations side by side.
- Chapter 1 (exact DP). The optimal cost-to-go solves the Bellman equation (the deterministic, undiscounted cost form of Chapter 1’s ), and the optimal policy is its one-step greedy minimizer. With constraints, has no closed form and the state space is continuous — exact DP is intractable.
- Chapter 15 (MPC). Replace the unknown tail by a finite unrolling plus a terminal estimate : , and apply the one-step minimizer .
MPC is therefore one Bellman step taken online, with the genuinely-optimal tail approximated by exact steps and a terminal cost-to-go estimate. The horizon and the terminal estimate trade off: a perfect estimate needs no horizon (Proposition 15.1, where makes exact), and a longer horizon forgives a cruder estimate. This is precisely “approximation in value space” — lookahead minimization over a terminal value approximation — the unifying view of Bertsekas’s reinforcement-learning-and-optimal-control program, which the convergence weeks take up directly (Week 19 reads MPC, rollout, and approximate policy iteration as one algorithm). The terminal cost is where a learned value function will later be grafted in: replace the LQR with a neural critic and MPC becomes a model-based RL controller — the MPC/RL hybrids of Part III. Chapter 13’s is the value function; Chapter 14’s Lyapunov certificate is the terminal cost; Chapter 1’s Bellman step is the online minimization. Three chapters, one equation, now solved with constraints.
What’s next
- Week 16 (nonlinear and robust MPC). Drop linearity: the QP becomes a nonlinear program (direct multiple shooting, SQP/interior-point), and the terminal-ingredient theorem generalizes to the quasi-infinite-horizon scheme. Robust and tube MPC tighten constraints against disturbances to recover the guarantees this chapter proved only for the nominal model — closing the optimality-is-not-robustness gap. The recent-developments survey Mayne (2014) maps the territory.
Exercises
-
(Derive) Show that initializing the backward Riccati recursion at (the DARE solution) leaves every iterate equal to , and conclude the MPC law equals for all .
Solution
The DARE states , i.e. is a fixed point of the Riccati map . The recursion is with , so and by induction for all . The first gain is then the stationary , so independent of .
-
(Prove) Establish the value-descent inequality (Lemma 15.1) by constructing the shifted candidate and bounding its cost. Where is each terminal-ingredient axiom used?
Solution
With optimal and states at , take at . Feasibility of the first moves is inherited from ; (i) and (ii) make the appended step feasible and keep the new terminal state in . The cost of is ; axiom (iii) makes the last three terms . Since is the minimum, it is this candidate cost, giving the inequality.
-
(Compute) For a single-input system with DARE solution and gain , find the largest such that on the sublevel set .
Solution
Maximize over . With the objective is over , whose max is (Cauchy–Schwarz). Setting this gives — exactly the companion’s
terminal_region. -
(Implement) In the companion, verify the MPCLQR identity on both rails: the analytic condensed-QP solve to and OSQP to , across several horizons and initial states.
Solution
See
experiments/julia/week15/runtests.jl: with terminal cost fromdare_gain,kkt_solve_unconstrainedreturns toatol=1e-9andsolve_mpc(OSQP, polished, tight tolerances) toatol=1e-6, for and four initial states — Proposition 15.1 confirmed and the two-rail tolerance discipline made explicit. -
(Extend) Demonstrate recursive feasibility numerically: pick a tight terminal box and a far initial state, show the short-horizon problem is infeasible and a long-horizon one feasible, and relate this to .
Solution
See the companion’s feasibility test: from with and terminal box ,
solve_mpcraises at (OSQP reports infeasible) and succeeds at , with the terminal box met. The far state is outside but inside ; since the feasible set grows with the horizon, lengthening it admits states a short horizon cannot steer into in time. -
(Extend) Read MPC as one step of value iteration with an inexact terminal value. When is the first move exactly optimal for the infinite-horizon problem, and what does the gap between and cost?
Solution
MPC applies the greedy minimizer of , which is the -step Bellman lookahead with tail estimate . If the lookahead is exact at (Proposition 15.1 is the unconstrained instance, ). When — the generic constrained case — the first move is suboptimal for the infinite horizon by an amount that shrinks as grows (more exact steps before the estimate is used) or as better approximates . This is the approximation-in-value-space tradeoff Part III exploits by learning .
Companion code
The Week-15 companion lives at experiments/julia/week15/ — the control lane is Julia-native
from here (JuMP for modeling, OSQP for the QP), building on the tested dare_gain from
experiments/julia/week13/. It pins the same discrete double-integrator literals as the Week-13
LQR suite, so the MPC results are parity-locked to the already-verified LQR/DARE base.
mpc.jl—build_mpc_qp/solve_mpc(the OSQP rail;solve_mpcraises on any non-optimal termination);receding_horizon(closed-loop simulation recording the MPC value );kkt_solve_unconstrained(the condensed dense solve — the analytic rail); andterminal_region(the largest admissible sublevel-set ).runtests.jl— mathematical-correctness tests: the MPCLQR identity on both rails (Proposition 15.1); constraints binding with cost the saturated-LQR rollout; closed-loop stability with non-increasing, decreasing, and invariant (Lemma 15.1, Theorem 15.1); and recursive feasibility — infeasible at a short horizon, feasible at a long one (Theorem 15.2).
# linear-MPC companion: QP build/solve, two-rail parity, stability, feasibility
julia --project=experiments/julia experiments/julia/week15/runtests.jl
# the whole Julia control lane (weeks 11–15) in one aggregator run
make test-julia
The chapter figure is generated from the companion’s exported trajectory:
# export the closed-loop trajectory + terminal region, then render the figure
python experiments/python/week15/make_fig.py