Algorithm Search⌘K

Theoremcore

Hamilton-Jacobi-Bellman equation

Also called HJB equation.

The optimal cost-to-go of a continuous-time problem solves a partial differential equation, and its minimizer gives an optimal feedback.

The Hamilton-Jacobi-Bellman (HJB) equation is the partial differential equation

−Vt(t,x)=min⁡u∈U(L(x,u)+Vx(t,x) f(x,u)),V(T,x)=K(x),-V_t(t, x) = \min_{u \in U} \left( L(x, u) + V_x(t, x)\, f(x, u) \right), \qquad V(T, x) = K(x),

for the value function V(t,x)V(t, x) of an optimal control problem, the smallest cost that can still be reached from state xx at time tt. It is the continuous-time form of the Bellman equation and follows from the principle of optimality. This page proves two statements: a C1C^1 solution of the equation is the value function and gives an optimal feedback (the verification theorem), and a value function that is C1C^1 solves the equation. In general the value function is not differentiable, and then it is the unique viscosity solution; that statement is cited, not proved.

Statement

Setting. A horizon T>0T > 0, a compact input set U⊂RmU \subset \mathbb{R}^m, and continuous functions f:Rn×U→Rnf : \mathbb{R}^n \times U \to \mathbb{R}^n, L:Rn×U→RL : \mathbb{R}^n \times U \to \mathbb{R} and K:Rn→RK : \mathbb{R}^n \to \mathbb{R}. ff is bounded and satisfies a Lipschitz condition in xx uniformly in uu, so each piecewise continuous input u:[t,T]→Uu : [t, T] \to U gives a unique trajectory from any (t,x)(t, x) (Picard-Lindelöf theorem). The cost and the value function are

J(t,x;u)=∫tTL(x(s),u(s)) ds+K(x(T)),V(t,x)=inf⁡uJ(t,x;u).J(t, x; u) = \int_t^T L(x(s), u(s))\, ds + K(x(T)), \qquad V(t, x) = \inf_u J(t, x; u).

Theorem.

  1. Verification. Let W∈C1([0,T]×Rn)W \in C^1([0, T] \times \mathbb{R}^n) satisfy −Wt(t,x)=min⁡u∈U(L(x,u)+Wx(t,x)f(x,u))-W_t(t, x) = \min_{u \in U} \left( L(x, u) + W_x(t, x) f(x, u) \right) for all (t,x)(t, x), and W(T,x)=K(x)W(T, x) = K(x). Then W(t,x)≤J(t,x;u)W(t, x) \le J(t, x; u) for every admissible uu, so W≤VW \le V. If, from (t,x)(t, x), an admissible input u∗u^* attains the minimum at (s,x∗(s))(s, x^*(s)) for every ss except finitely many, then u∗u^* is optimal and W(t,x)=V(t,x)W(t, x) = V(t, x).
  2. Necessity. If VV is C1C^1 on an open set Ω⊆(0,T)×Rn\Omega \subseteq (0, T) \times \mathbb{R}^n, then VV satisfies the HJB equation at every point of Ω\Omega.
  3. Viscosity solutions (cited). If in addition LL and KK are bounded and uniformly continuous and LL is Lipschitz in xx, then VV is bounded and uniformly continuous, and it is the unique such viscosity solution of
−Vt+max⁡u∈U(−L(x,u)−Vxf(x,u))=0,V(T,⋅)=K-V_t + \max_{u \in U} \left( -L(x, u) - V_x f(x, u) \right) = 0, \qquad V(T, \cdot) = K

(Crandall and Lions 1983; Fleming and Soner 2006). The equation is the HJB equation multiplied by −1-1 inside the maximum. The order matters: a viscosity solution of F=0F = 0 need not be one of −F=0-F = 0.

In plain words

Suppose you knew, for every place and every moment, the least cost you could still achieve from there. Then the best move now is easy to find: pick the move that minimizes the cost of this short step plus the least cost from where the step takes you. Writing this for steps of length tending to zero gives one equation for the table of least costs. If you can solve the equation, you can check that a plan is optimal and you get the best action as a function of the current state, a feedback. The catch is that the table often has kinks, and then the equation only holds in a weaker sense.

Proof

Part 1. Let uu be admissible from (t,x)(t, x) and x(s)x(s) its trajectory. The function s↦W(s,x(s))s \mapsto W(s, x(s)) is continuous and piecewise C1C^1, with

ddsW(s,x(s))=Wt+Wxf(x(s),u(s))≥−L(x(s),u(s)),\frac{d}{ds} W(s, x(s)) = W_t + W_x f(x(s), u(s)) \ge -L(x(s), u(s)),

because the equation says −Wt≤L(x,v)+Wxf(x,v)-W_t \le L(x, v) + W_x f(x, v) for every v∈Uv \in U. Integrate from tt to TT and use W(T,⋅)=KW(T, \cdot) = K:

K(x(T))−W(t,x)≥−∫tTL ds,soW(t,x)≤J(t,x;u).K(x(T)) - W(t, x) \ge -\int_t^T L\, ds, \qquad \text{so} \qquad W(t, x) \le J(t, x; u).

For u∗u^* the inequality is an equality at all but finitely many ss, so W(t,x)=J(t,x;u∗)W(t, x) = J(t, x; u^*). Since J(t,x;u∗)≥V(t,x)≥W(t,x)J(t, x; u^*) \ge V(t, x) \ge W(t, x), all three are equal, and u∗u^* is optimal.

Part 2, the inequality ≤\le. Fix (t,x)∈Ω(t, x) \in \Omega, a value v∈Uv \in U and a small h>0h > 0. Use vv on [t,t+h][t, t + h] and then any input from (t+h,x(t+h))(t + h, x(t + h)). Taking the infimum over the second part (the principle of optimality),

V(t,x)≤∫tt+hL(x(s),v) ds+V(t+h,x(t+h)).V(t, x) \le \int_t^{t+h} L(x(s), v)\, ds + V(t + h, x(t + h)).

Subtract V(t,x)V(t, x), divide by hh and let h→0h \to 0. Since VV is C1C^1 near (t,x)(t, x), the limit is 0≤L(x,v)+Vt(t,x)+Vx(t,x)f(x,v)0 \le L(x, v) + V_t(t, x) + V_x(t, x) f(x, v). This holds for every vv, so −Vt≤min⁡v(L+Vxf)-V_t \le \min_v (L + V_x f).

Part 2, the inequality ≥\ge. For each small h>0h > 0 take an input uhu_h with J(t,x;uh)≤V(t,x)+h2J(t, x; u_h) \le V(t, x) + h^2. Its tail from t+ht + h costs at least V(t+h,xh(t+h))V(t + h, x_h(t + h)), so

∫tt+hL(xh,uh) ds+V(t+h,xh(t+h))−V(t,x)≤h2.\int_t^{t+h} L(x_h, u_h)\, ds + V(t + h, x_h(t + h)) - V(t, x) \le h^2.

Write the difference of VV as ∫tt+h(Vt+Vxf)(s,xh(s),uh(s)) ds\int_t^{t+h} (V_t + V_x f)(s, x_h(s), u_h(s))\, ds and divide by hh:

1h∫tt+h(L+Vt+Vxf)(s,xh(s),uh(s)) ds≤h.\frac1h \int_t^{t+h} \left( L + V_t + V_x f \right)(s, x_h(s), u_h(s))\, ds \le h.

Because ff is bounded, ∣xh(s)−x∣≤Ch|x_h(s) - x| \le C h on the interval. VtV_t and VxV_x are continuous, and LL and ff are uniformly continuous on compact sets, so the integrand differs from L(x,uh(s))+Vt(t,x)+Vx(t,x)f(x,uh(s))L(x, u_h(s)) + V_t(t, x) + V_x(t, x) f(x, u_h(s)) by at most ω(h)\omega(h) with ω(h)→0\omega(h) \to 0. That expression is at least min⁡v(L(x,v)+Vt+Vxf(x,v))\min_v (L(x, v) + V_t + V_x f(x, v)). Hence min⁡v(… )≤h+ω(h)\min_v(\dots) \le h + \omega(h), and letting h→0h \to 0 gives −Vt≥min⁡v(L+Vxf)-V_t \ge \min_v (L + V_x f). ■\blacksquare

Consequences

A worked example. For x˙=u\dot x = u, U=RU = \mathbb{R} (the problem is still fine without compactness here), L=u2L = u^2 and K=x2K = x^2, try V=p(t)x2V = p(t) x^2. Then min⁡u(u2+2pxu)=−p2x2\min_u (u^2 + 2 p x u) = -p^2 x^2 at u=−pxu = -p x, and the equation becomes −p˙ x2=−p2x2-\dot p\, x^2 = -p^2 x^2, so p˙=p2\dot p = p^2 with p(T)=1p(T) = 1. The solution is p(t)=1/(1+T−t)p(t) = 1/(1 + T - t), and

V(t,x)=x21+T−t,u∗(t,x)=−x1+T−t.V(t, x) = \frac{x^2}{1 + T - t}, \qquad u^*(t, x) = -\frac{x}{1 + T - t}.

Check: Vt=x2/(1+T−t)2V_t = x^2/(1 + T - t)^2 and min⁡u(u2+Vxu)=−Vx2/4=−x2/(1+T−t)2\min_u (u^2 + V_x u) = -V_x^2/4 = -x^2/(1 + T - t)^2, so −Vt-V_t equals the minimum. From x0x_0 the feedback gives the constant input −x0/(1+T)-x_0/(1 + T) and the cost x02/(1+T)x_0^2/(1 + T). For x0=1x_0 = 1, T=1T = 1 this is the cost 1/21/2 found on the optimal control problem page.

  • Feedback. The minimizer u∗(t,x)u^*(t, x) in the equation is an optimal feedback for all initial states at once, not only an open-loop input from one start.
  • LQR. For x˙=Ax+Bu\dot x = A x + B u, L=xTQx+uTRuL = x^T Q x + u^T R u and K=xTQfxK = x^T Q_f x, the guess V=xTP(t)xV = x^T P(t) x gives u∗=−R−1BTPxu^* = -R^{-1} B^T P x and the Riccati differential equation −P˙=ATP+PA−PBR−1BTP+Q-\dot P = A^T P + P A - P B R^{-1} B^T P + Q, P(T)=QfP(T) = Q_f (finite-horizon LQR). By Part 1 this feedback is optimal.
  • The costate. Where VV is C2C^2, λ(t)=Vx(t,x∗(t))T\lambda(t) = V_x(t, x^*(t))^T is a costate of the maximum principle, and the right side of the equation is the minimized Hamiltonian h(x,VxT)h(x, V_x^T). The characteristics of the HJB equation are the extremals of the maximum principle.
  • Infinite horizon. For T=∞T = \infty and data that do not depend on time, V(x)V(x) solves the stationary equation 0=min⁡u(L+Vxf)0 = \min_u (L + V_x f), under conditions that make the cost finite.
  • Discrete time and computation. The discrete form Vk(x)=min⁡u(L(x,u)+Vk+1(F(x,u)))V_k(x) = \min_u (L(x, u) + V_{k+1}(F(x, u))) is the Bellman equation, solved backward or by value iteration. On a grid with NN points per axis, one sweep touches NnN^n points, so the cost grows exponentially with the state dimension nn. The same equations, with a target set instead of a cost, compute reachable sets (Hamilton-Jacobi reachability).

Tightness

The value function is often not differentiable. Take x˙=u\dot x = u, U=[−1,1]U = [-1, 1], on the interval (−1,1)(-1, 1), and let V(x)V(x) be the least time to reach the set {−1,1}\{-1, 1\}. Then V(x)=1−∣x∣V(x) = 1 - |x|, which has a kink at x=0x = 0. The stationary equation with L=1L = 1 is min⁡u(1+V′u)=1−∣V′∣=0\min_u (1 + V' u) = 1 - |V'| = 0. Both 1−∣x∣1 - |x| and ∣x∣−1|x| - 1 satisfy ∣V′∣=1|V'| = 1 at every x≠0x \ne 0 and the boundary values, and so do many zigzag functions, so "solution almost everywhere" does not determine VV. In the form of Part 3, max⁡u(−1−V′u)=∣V′∣−1=0\max_u(-1 - V' u) = |V'| - 1 = 0. At the kink of 1−∣x∣1 - |x|, every smooth function that touches it from above has a slope p∈[−1,1]p \in [-1, 1] there, and ∣p∣−1≤0|p| - 1 \le 0, so the subsolution test holds; no smooth function touches it from below, so the supersolution test is empty. So 1−∣x∣1 - |x| is a viscosity solution. For ∣x∣−1|x| - 1, the function φ=−1\varphi = -1 touches it from below at 0 with slope 0, and ∣0∣−1≥0|0| - 1 \ge 0 fails, so it is not one. The time-optimal double integrator has a value function that is not differentiable on its switching curve, for the same reason.

The value function can be discontinuous or infinite. Without controllability, some states cannot reach the target, and the minimum time is +∞+\infty there. Part 3 needs its hypotheses.

A C1C^1 solution need not exist. Part 1 is a sufficient condition. It applies only when a C1C^1 solution is known, as for the LQR problem.

History

Hamilton and Jacobi wrote the equation of the calculus of variations that carries their names in the 1830s, and Carathéodory used it as a sufficient condition in the 1930s. Bellman developed dynamic programming at RAND in the early 1950s and wrote the equation for control problems; his book appeared in 1957. Kalman used it for the linear quadratic problem around 1960. The question of nonsmooth value functions stayed open until Crandall and Lions (1983) defined viscosity solutions and proved uniqueness. Fleming and Soner (2006) give the theory for deterministic and stochastic control.

References

  1. Richard Bellman, Dynamic Programming, Princeton University Press, 1957 (Dover reprint, 2003)
  2. Daniel Liberzon, Calculus of Variations and Optimal Control Theory, A Concise Introduction, Princeton University Press, 2012, Section 5.1.3 (the HJB equation), Section 5.1.4 (the sufficient condition), Section 5.2 (the HJB equation and the maximum principle, with a value function that is not differentiable) and Section 5.3 (viscosity solutions)
  3. Michael G. Crandall and Pierre-Louis Lions, Viscosity solutions of Hamilton-Jacobi equations, Transactions of the American Mathematical Society 277(1), 1-42, 1983
  4. Wendell H. Fleming and H. Mete Soner, Controlled Markov Processes and Viscosity Solutions, second edition, Springer, 2006, the chapters on deterministic optimal control and on viscosity solutions
  5. Lawrence C. Evans, An Introduction to Mathematical Optimal Control Theory, lecture notes, University of California, Berkeley, Chapter 5 (dynamic programming)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/H499AQ/text.yaml