Hyoungseo Son
Optimal Control
Contents · Optimal Control

Part 0 · LQR

Part 1 · Dynamic Programming

  • Dynamic Programming and the Bellman Equation

Part 2 · Trajectory Optimization

Part 4 · Continuous Optimal Control

Part 1 · Dynamic Programming

Dynamic Programming and the Bellman Equation

Optimal control and reinforcement learning look like separate fields, but they optimize the same object: a value function that satisfies the Bellman equation. The gap between them is not the equation, it is the information. Control knows the model (the dynamics ff and the cost cc) and solves the equation offline by dynamic programming. RL does not know the model and estimates the same solution from sampled transitions. This chapter builds that shared object from the control side and points at where RL picks it up.

The principle of optimality

Fix a deterministic system with state ss, action aa, dynamics s=f(s,a)s' = f(s,a), and nonnegative stage cost c(s,a)c(s,a). A policy π\pi maps states to actions, and its discounted cost-to-go from s0s_0 is

Vπ(s0)  =  t=0γtc(st,π(st)),st+1=f(st,π(st)),V^{\pi}(s_0) \;=\; \sum_{t=0}^{\infty} \gamma^{t}\, c\big(s_t,\, \pi(s_t)\big), \qquad s_{t+1} = f\big(s_t,\, \pi(s_t)\big),

with discount γ(0,1]\gamma \in (0,1]. The optimal value is V(s)=minπVπ(s)V^{\star}(s) = \min_{\pi} V^{\pi}(s). Bellman's principle of optimality says an optimal trajectory has optimal tails: whatever the first action does, the remaining decisions must themselves be optimal from the state it lands in.1 That single observation collapses a search over whole action sequences into a search over one action plus the already-solved value of the successor.

The Bellman equation

Written out, the principle is a fixed-point condition that VV^{\star} must obey at every state:

V(s)  =  mina[c(s,a)  +  γV(f(s,a))].V^{\star}(s) \;=\; \min_{a}\Big[\, c(s,a) \;+\; \gamma\, V^{\star}\big(f(s,a)\big) \,\Big].

The minimizer is the optimal policy, read off greedily once VV^{\star} is known:

π(s)  =  argmina[c(s,a)+γV(f(s,a))].\pi^{\star}(s) \;=\; \arg\min_{a}\Big[\, c(s,a) + \gamma\, V^{\star}\big(f(s,a)\big) \,\Big].

Reinforcement learning writes the identical statement with rewards instead of costs and a maximization instead of a minimization,2

V(s)  =  maxa[r(s,a)+γEsP(s,a)V(s)].V^{\star}(s) \;=\; \max_{a}\Big[\, r(s,a) + \gamma\, \mathbb{E}_{s' \sim P(\cdot \mid s,a)}\, V^{\star}(s') \,\Big].

Setting r=cr = -c turns one into the other, since max(c)=min(c)\max(-c) = -\min(c); the expectation just handles stochastic dynamics, which collapse to s=f(s,a)s' = f(s,a) in the deterministic control case. It is one equation, one fixed point.

Value iteration

Read the Bellman equation as an operator T\mathcal{T} acting on value functions, (TV)(s)=mina[c(s,a)+γV(f(s,a))](\mathcal{T}V)(s) = \min_{a}[\,c(s,a) + \gamma\, V(f(s,a))\,], and iterate it: Vk+1=TVkV_{k+1} = \mathcal{T} V_{k}. For γ<1\gamma < 1 this operator is a contraction in the sup norm,

TVTW    γVW,\lVert \mathcal{T}V - \mathcal{T}W \rVert_{\infty} \;\le\; \gamma\, \lVert V - W \rVert_{\infty},

so by the Banach fixed-point theorem VV^{\star} is unique and any start converges to it geometrically, VkVγkV0V\lVert V_k - V^{\star}\rVert_{\infty} \le \gamma^{k}\, \lVert V_0 - V^{\star}\rVert_{\infty}. Concretely each sweep carries the correct cost-to-go one graph-step farther from the goal, so the values lock in ring by ring.

A four-state chain by hand

Take four states s0,s1,s2,s3s_0, s_1, s_2, s_3 in a line. The goal s3s_3 is absorbing with cost 00; from any interior state a move left or right costs 11 (at the left edge, "left" stays put). Use γ=0.9\gamma = 0.9 and initialize V0=+V_0 = +\infty everywhere except the goal. The update for an interior state is Vk+1(s)=min{1+γVk(sleft),  1+γVk(sright)}V_{k+1}(s) = \min\{\,1 + \gamma V_k(s_{\text{left}}),\; 1 + \gamma V_k(s_{\text{right}})\,\}.

sweep kkV(s0)V(s_0)V(s1)V(s_1)V(s2)V(s_2)V(s3)V(s_3)
0\infty\infty\infty00
1\infty\infty1100
2\infty1.91.91100
32.712.711.91.91100
\star2.712.711.91.91100

Sweep 1 only s2s_2 (one step from the goal) can improve: 1+0.9(0)=11 + 0.9(0) = 1. Sweep 2 reaches s1s_1: V2(s1)=min{1+0.9V1(s2),  1+0.9V1(s0)}=min{1.9,}=1.9V_2(s_1) = \min\{1 + 0.9\, V_1(s_2),\; 1 + 0.9\, V_1(s_0)\} = \min\{1.9,\, \infty\} = 1.9. Sweep 3 reaches s0s_0: 1+0.9(1.9)=2.711 + 0.9(1.9) = 2.71, and the next sweep changes nothing, so V3=VV_3 = V^{\star}. The fixed point is exactly the discounted shortest-path cost-to-go: a state dd steps from the goal has

V(sd)  =  i=0d1γi  =  1γd1γ,V^{\star}(s_d) \;=\; \sum_{i=0}^{d-1} \gamma^{i} \;=\; \frac{1 - \gamma^{d}}{1 - \gamma},

which gives 1,1.9,2.711,\, 1.9,\, 2.71 for d=1,2,3d = 1, 2, 3. As γ1\gamma \to 1 this tends to dd, the raw number of steps, so with no discount value iteration recovers the plain shortest-path distance.

Watching the cost-to-go flood a grid

The same sweep on a 2D gridworld shows the ring-by-ring convergence directly. The goal has cost 00; every other cell runs V(s)mina[1+γV(s)]V(s) \leftarrow \min_a[\,1 + \gamma\, V(s')\,] over its four neighbours. Slide kk and watch the accent flood outward from the goal, one ring per sweep, then read off the greedy policy that points down the gradient toward the goal (curving around the wall, because that is the cheaper route).

Value iteration on a gridworldinteractive
0
cells resolved
0 / 54
residual ‖ΔV‖∞
-
status
flooding…

Green is the goal (cost 0). Stronger accent means lower cost-to-go; blank cells are still at +∞, unreached by sweep 0. Arrows are the greedy policy: step toward the cheaper neighbour.

Cost-to-go after k sweeps, γ-discounted. Green is the goal; stronger accent is cheaper (closer). Blank cells are still at +∞, not yet reached. Arrows show the greedy policy. Raise k to convergence, or drop γ to see nearer states dominate.

The same root, two fields

That grid is the bridge. Optimal control (this topic) has the model in hand, so it runs value iteration to convergence and gets VV^{\star} and π\pi^{\star} exactly, before ever touching the system. Reinforcement learning (the RL topic) faces the same Bellman fixed point without ff or cc: it sees only sampled transitions (s,a,r,s)(s, a, r, s'), so the expectation inside the operator becomes a sample average and the sweep becomes a stochastic, incremental update (Q-learning is value iteration on state-action values driven by samples). Same equation, same solution. The dividing line is whether you can compute the update or only estimate it.

Footnotes

  1. Bertsekas, Dynamic Programming and Optimal Control.

  2. Sutton & Barto, Reinforcement Learning: An Introduction (2018).