Seyed Masoud Hosseini · Overview · Study log · Weekly summaries · Ideas · Search · Transcript · RSS feed
Deep Reinforcement Learning · Lecture 43 of 99 · 13:23
Lecture 10, Part 4: Extending LQR to Stochastic and Nonlinear Systems
Study guide
What this lecture covers
Having derived LQR for deterministic linear dynamics in Part 3, this part extends it in two directions: to stochastic (Gaussian) dynamics, and to nonlinear dynamics via a linearize-and-iterate approach. It connects the resulting algorithm, iterative LQR, to Newton's method and explains a line-search fix needed for it to work reliably in practice.
You'll come away understanding why Gaussian noise doesn't change the LQR control law, how iterative LQR (iLQR) locally linearizes nonlinear dynamics and cost around a current trajectory, and why a backtracking line search on the forward pass is needed for good convergence.
Key ideas
- Gaussian dynamics don't change the control law: if the stochastic dynamics are Gaussian with the same mean as the deterministic linear case, the optimal
u_t = K_t x_t + k_tcontrol law is unchanged, though the visited states become stochastic. - LQR yields a closed-loop policy: in the stochastic case,
K_t x_t + k_tacts as a time-varying linear controller rather than a single fixed action sequence. - Taylor expansion for local linearization: nonlinear dynamics and cost can be approximated locally, around a current trajectory
x_hat, u_hat, by a linear dynamics term (first derivative) and a quadratic cost term (up to second derivative). - Iterative LQR (iLQR): repeatedly linearizes dynamics and cost around the current best trajectory, runs the LQR backward pass on the deviations
delta_x, delta_u, then runs a forward pass with the true nonlinear dynamics to get an updated trajectory. - Connection to Newton's method: iLQR is an approximation of Newton's method applied to the trajectory optimization problem; using the true second derivative of the dynamics instead gives differential dynamic programming (DDP).
- Line search via alpha: scaling the constant term
kin the forward pass by a factoralphabetween 0 and 1 lets iLQR backtrack toward the previous trajectory when a full step would make things worse, similar to trust-region ideas from policy gradient methods.
Walkthrough
Stochastic dynamics (0:00)
For linear dynamics with added Gaussian noise, the same LQR control law remains optimal because the symmetry of the Gaussian causes deviations to cancel out in the quadratic cost. The practical difference is that the states you visit are now themselves random, so LQR effectively becomes a closed-loop, time-varying linear policy rather than a single fixed plan.
Nonlinear dynamics and iterative LQR (3:08)
For nonlinear systems, the lecture introduces iterative LQR (also called differential dynamic programming or iLQG in the linear-Gaussian case). The idea is to use a Taylor expansion to approximate the nonlinear dynamics and cost locally around a current candidate trajectory, producing a linear-quadratic problem in the deviations delta_x and delta_u. Running standard LQR on this local problem, then applying the result with the true nonlinear dynamics in a forward pass, and updating the reference trajectory, repeats until convergence.
Newton's method connection (7:27)
The lecture draws a direct parallel between iLQR and Newton's method for minimizing a nonlinear function: both repeatedly form a local quadratic approximation and jump to its optimum. iLQR differs from full Newton's method by ignoring second derivatives of the dynamics; including them recovers DDP, at the cost of needing a 3D tensor for the second-order dynamics term.
Line search for stability (10:12)
Because a full Newton-style step can overshoot and land at a worse point, the lecture describes scaling the forward pass's constant term by alpha. Setting alpha to zero reproduces the previous trajectory exactly, and increasing it moves further toward the new solution, so searching over alpha (for example, reducing it until cost improves, or using a bracketing line search) makes iLQR far more reliable in practice.
Before you watch
- Watch Lecture 10, Part 3 first for the deterministic LQR derivation and the
K_t,k_tnotation this part builds on. - A basic grasp of Newton's method and Taylor expansions helps with the nonlinear extension.
Check your understanding
- Why does adding Gaussian noise to the dynamics leave the LQR control law unchanged, and what does change as a result?
- What quantities does iLQR linearize or approximate at each iteration, and around what point?
- Why does the forward pass in iLQR use the true nonlinear dynamics rather than the linearized approximation?
- How is iLQR related to Newton's method, and what does it omit compared to full Newton's method?
- What problem does the line-search parameter
alphasolve, and what happens whenalpha = 0?
Vocabulary
- Gaussian noise (phrase)
- Random variation that follows a bell-curve (normal) distribution.
Adding Gaussian noise doesn't change the LQR control law. - control law (phrase)
- The rule that determines which action to take given the current state.
The control law stays u = Kx + k under Gaussian noise. - symmetry (noun)
- A balanced structure where things mirror each other around a center.
The Gaussian's symmetry causes deviations to cancel out. - nonlinear (adjective)
- Not following a straight-line relationship.
Real systems often have nonlinear dynamics. - iterative LQR (iLQR) (noun)
- A method that repeatedly linearizes nonlinear dynamics and solves LQR around the current trajectory.
iLQR handles nonlinear systems by repeated linearization. - linearize (verb)
- To approximate a nonlinear function with a straight-line version near one point.
We linearize the dynamics around the current trajectory. - reference trajectory (phrase)
- The current best-known path used as a starting point for further optimization.
iLQR updates the reference trajectory each iteration. - Newton's method (noun)
- An optimization method that repeatedly uses a local quadratic approximation to jump toward the optimum.
iLQR is closely related to Newton's method. - second derivative (phrase)
- The rate of change of the rate of change of a function.
DDP includes the second derivative of the dynamics. - differential dynamic programming (DDP) (noun)
- A more exact version of iLQR that also uses second derivatives of the dynamics.
DDP needs a 3D tensor for second-order dynamics terms. - line search (phrase)
- A method that tests different step sizes to find one that improves the result.
A line search over alpha stabilizes iLQR. - overshoot (verb)
- To go further than intended, past the best point.
A full Newton step can overshoot and land at a worse point. - backtrack (verb)
- To go back partway toward a previous, safer position.
iLQR can backtrack toward the previous trajectory. - scale (by a factor) (verb)
- To multiply a value by some number to make it larger or smaller.
We scale the constant term by alpha. - bracketing (adjective)
- Narrowing a search by testing values on either side of a target.
A bracketing line search narrows down the best alpha. - reliably (adverb)
- In a way that consistently works well.
The line search makes iLQR far more reliable in practice. - extend (a method) (verb)
- To make a method work for more cases than it originally did.
This part extends LQR to stochastic and nonlinear systems. - closed-loop policy (phrase)
- A control rule that reacts to the state actually observed.
LQR yields a closed-loop policy in the stochastic case. - deviation (noun)
- The difference between an actual value and a reference value.
iLQR works on the deviations delta_x and delta_u. - carefully (adverb)
- In a thoughtful, detailed way.
The lecture explains carefully why a line search is needed.
Chapters
← Lecture 10, Part 3: Trajectory Optimization with the LQR · Lecture 10, Part 5: A Case Study in Optimal Control →
