Instructor: Hasan A. Poonawala
Mechanical and Aerospace Engineering
University of Kentucky, Lexington, KY, USA
Topics:
Receding horizon idea
From iLQR/LQR to MPC
Constraints
Asymptotic stability
iLQR / LQR: solve once offline for a fixed initial state .
What if the real state drifts from the plan? Disturbances, model mismatch, new information.
The feedback gain handles small deviations — but what about large ones, or problems with constraints (other than dynamics)?
Model Predictive Control (MPC): re-solve the finite-horizon optimal control problem at every timestep, from the current measured state.
At time t:
1. Measure current state x_t
2. Solve OCP over horizon [t, t+T]: min J(x_t, u_{t:t+T-1})
3. Apply only the first control: u_t = u_0*
4. Advance: t ← t + 1, repeat
At each timestep, the planning window shifts forward by one step.
t=0: [●━━━━━━━━━━━━━━━━━━━━●] solve, apply u_0*
t=1: [●━━━━━━━━━━━━━━━━━━━━●] solve, apply u_1*
t=2: [●━━━━━━━━━━━━━━━━━━━━●] solve, apply u_2*
↑ current state ↑ horizon end
Key properties:
Discarding and recomputing seems wasteful. The payoff: the plan always reflects the current state, handles constraints, and adapts to disturbances.
If dynamics are linear and cost is quadratic — no constraints:
Offline LQR: compute gains once. At runtime: (time-varying) or (infinite horizon). Cost: per timestep.
Linear MPC: solve the same problem online at each from .
Without constraints: LQR and MPC give the identical control — MPC adds no benefit, just cost.
MPC is used when
At each timestep :
previous solution: ū₀, ū₁, ū₂, ..., ū_{T-1} (from time t)
warm-start at t+1: ū₁, ū₂, ..., ū_{T-1}, ū_{T-1} (shifted + hold last)
↑ already near-optimal for new problem
Real-Time Iteration (RTI): one backward pass + one forward pass per timestep, regardless of convergence. Works well when the problem changes slowly between steps.
Solve time budget governs the number of iLQR iterations, not convergence. Horizon length is a design parameter: longer gives better plans but costs more to solve.
Unconstrained iLQR / LQR ignores physical limits. Real systems have:
| Constraint type | Example |
|---|---|
| Input limits | Motor torque saturation, voltage bounds: |
| State limits | Joint angle limits, speed limits: |
| Safety / obstacle | Keep state outside a forbidden region |
| Terminal | Reach a target set at |
Ignoring an active constraint (e.g., clipping the control post-hoc) invalidates the optimality of the LQR/iLQR solution. The optimal unconstrained can violate limits by large margins.
Input constraints (convex, e.g., box ):
State constraints (harder — couples across timesteps):
Handling constraints is the primary engineering challenge in MPC. Constraint satisfaction is exact at convergence; the number of iLQR iterations needed may increase.
A finite horizon creates a problem: the optimizer doesn’t care what happens after step .
Pathological example: to minimize cost over , the optimizer might drive the state to a large value at — exploiting the fact that the cost is zero beyond the horizon.
horizon: [x₀ ――――――――――――→ x_T] | (nothing after here)
optimizer: reaches goal cheaply ... | then blows up
Consequence: MPC with a naive terminal cost may be unstable even when each individual solve is “optimal.”
Stability of MPC is not automatic. It requires careful design of the terminal cost and/or terminal constraint.
Choose , where is the infinite-horizon LQR solution:
Intuition: is the optimal cost-to-go for the unconstrained infinite-horizon problem from .
The finite-horizon cost plus this terminal cost approximates the full infinite-horizon cost:
Effect: the optimizer is penalized for leaving far from the origin — it accounts for the “cost tail” beyond the horizon, rather than ignoring it.
For linear systems without constraints, this makes MPC exactly equivalent to infinite-horizon LQR, regardless of horizon length . The terminal cost absorbs the truncation error completely.
Require , where is a positively invariant set under a local controller :
Common choice: (an ellipsoid where the LQR gain keeps the state inside).
Strictest case: , i.e., (equality constraint). Guarantees stability but drastically reduces the feasible set — requires large .
Terminal cost and terminal constraint are often used together: the terminal set ensures that is a valid Lyapunov function within the set, and the constraint ensures the state reaches the set.
| Parameter | Effect | Typical guidance |
|---|---|---|
| Horizon | Longer → better plans, better stability margins | Start with –; increase until performance plateaus |
| Terminal cost | from LQR is the principled choice | Always include it; is asking for trouble |
| Terminal constraint | Guarantees stability with shorter | Use when is short and stability matters |
| Sample time | Shorter → more accurate, more solves needed | Match to fastest relevant dynamics |
| Iterations per step | More → closer to optimal; limited by solve time | RTI (1 iteration) often works well warm-started |
The previous solution is nearly optimal for the next problem (state has moved only one step).
Shift and hold:
The last control is repeated (held) as a placeholder for the new horizon end.
Why it works: the optimal solution is a continuous function of (in smooth problems). A small change in → small change in the optimal plan → warm-start is close to the new optimum → very few iLQR iterations needed.
Real-Time Iteration (RTI): one iLQR backward pass + one forward pass per MPC step, no convergence check. Widely used in fast MPC applications (automotive, drone control). Stability analysis is more involved but tractable.
| Method | Dynamics | Constraints | When solved | Stability |
|---|---|---|---|---|
| LQR | Linear | None | Once, offline | Guaranteed (infinite horizon) |
| iLQR | Nonlinear | None | Once, offline | Trajectory-local |
| Linear MPC | Linear | Yes | Online, every step | Guaranteed with terminal cost |
| Nonlinear MPC | Nonlinear | Yes | Online, every step | Guaranteed with terminal cost/constraint |
The receding horizon principle:
Stability requires design effort:
MPC value function is a Lyapunov function asymptotic stability
Optimal Control • ME 676 Home