Tutorials › Stochastic Calculus › Hamiltonian Optimization and Feedback Control Laws

Stochastic Control and the Hamilton-Jacobi-Bellman Equation · Tutorial 558 of 600

Hamiltonian Optimization and Feedback Control Laws

Derive feedback controls by minimizing the HJB Hamiltonian, then check the rule in scalar and matrix-valued quadratic examples.

Advanced 10 min read

What You'll Learn

  • Identify which terms of the HJB Hamiltonian depend on the control
  • Derive the unique minimizer for a positive-definite quadratic control cost
  • Reduce the minimized Hamiltonian by completing the square
  • Compute feedback controls in scalar drift-control models
  • Recognize when pointwise minimization does not establish global optimality

From the HJB Equation to a Feedback Rule

Once the Hamilton-Jacobi-Bellman equation is available, choosing a control means minimizing its Hamiltonian at each time and state. For a quadratic cost and an affine dependence of the drift on the control, this minimization is explicit: the optimal candidate is a function of the gradient of the value function. The calculation is pointwise. It identifies a candidate feedback law, but does not by itself show that the law defines an admissible process or is globally optimal.

Work on a filtered probability space \((\Omega,\mathcal{F},(\mathcal{F}_t)_{t\ge0},\mathbb{P})\) carrying a standard Brownian motion \(B_t\). On a finite horizon \([0,T]\), consider the controlled diffusion \(dX_t=(b_0(t,X_t)+G(t,X_t)u_t)\,dt+\sigma(t,X_t)\,dB_t\). Here \(X_t\) takes values in \(\mathbb{R}^n\), the control \(u_t\) takes values in \(\mathbb{R}^m\), \(b_0\) is the uncontrolled drift, \(G\) maps controls into drift directions, and \(\sigma\) is the diffusion coefficient. The drift and diffusion coefficients are distinct: only the drift is assumed to depend on the control in this setup.

Controls are adapted, progressively measurable processes satisfying the admissibility and integrability requirements of the control problem; in particular, whenever a stochastic integral is used, its integrand must be progressively measurable and in \(\mathcal{L}^2\), meaning \(\mathbb{E}\int_0^T H_s^2\,ds<\infty\). Assume the state equation is well posed for the controls under consideration. Let the running cost be \(\ell_0(t,x)+\tfrac12u^\top R(t,x)u+c(t,x)^\top u\), where \(R(t,x)\) is symmetric positive definite. Let \(g(X_T)\) be the terminal cost.

For a sufficiently smooth value function \(V(t,x)\), the HJB equation associated with minimizing expected total cost has terminal condition \(V(T,x)=g(x)\) and, for \(t<T\), the form

$$ 0=V_t(t,x)+\min_{u\in\mathbb{R}^m}\left\{ \ell_0(t,x)+\frac12u^\top R(t,x)u+c(t,x)^\top u +(b_0(t,x)+G(t,x)u)^\top\nabla V(t,x) +\frac12\operatorname{tr}\!\left(\sigma\sigma^\top(t,x)D^2V(t,x)\right) \right\}. $$

This is the short-time dynamic-programming HJB equation in the notation needed here. The Hamiltonian is the expression inside braces. For the minimization, the terms independent of \(u\) can be held fixed. The control-dependent terms are a quadratic function of \(u\).

Definition: Given \(t,x\), the pointwise minimizing feedback is a minimizer \(u^*(t,x)\) of the Hamiltonian over the allowed control set. When the allowed set is all of \(\mathbb{R}^m\), \(R(t,x)\) is positive definite, and the coefficients are defined, this minimizer is unique and equals \(u^*(t,x)=-R(t,x)^{-1}\big(G(t,x)^\top\nabla V(t,x)+c(t,x)\big)\).

Why the Quadratic Minimizer Has This Form

The derivative of the Hamiltonian with respect to \(u\) is \(R u+c+G^\top\nabla V\). Setting it to zero gives the displayed candidate. Positive definiteness matters: it makes the quadratic strictly convex, so a stationary point is the unique global minimum, not just a candidate critical point.

Theorem: Let \(R\) be a symmetric positive-definite \(m\times m\) matrix and \(p\in\mathbb{R}^m\). The function \(h(u)=\tfrac12u^\top Ru+p^\top u\), for \(u\in\mathbb{R}^m\), has the unique global minimizer \(u^*=-R^{-1}p\), with minimum value \(-\tfrac12p^\top R^{-1}p\).

Proof. Positive definiteness implies that \(R\) is invertible. Set \(u^*=-R^{-1}p\), so \(Ru^*=-p\). For any \(u\), write \(u=u^*+v\). Expanding and using symmetry of \(R\),

$$ h(u)=\frac12(u^*+v)^\top R(u^*+v)+p^\top(u^*+v) =h(u^*)+\frac12v^\top Rv, $$

because the terms linear in \(v\) are \(v^\top Ru^*+p^\top v=0\). If \(v\ne0\), positive definiteness gives \(v^\top Rv>0\); if \(v=0\), then \(u=u^*\). Thus \(h(u)\ge h(u^*)\), with equality only at \(u^*\). Finally, substituting \(u^*=-R^{-1}p\) gives \(h(u^*)=\tfrac12p^\top R^{-1}p-p^\top R^{-1}p=-\tfrac12p^\top R^{-1}p\). \(\square\)

In the HJB equation, take \(p=G^\top\nabla V+c\). The theorem both proves the feedback formula and gives the minimized Hamiltonian:

$$ 0=V_t+\ell_0+b_0^\top\nabla V +\frac12\operatorname{tr}(\sigma\sigma^\top D^2V) -\frac12\big(G^\top\nabla V+c\big)^\top R^{-1}\big(G^\top\nabla V+c\big). $$

All coefficients in this equation are evaluated at \((t,x)\). This reduction is an algebraic identity under the stated assumptions; it does not require solving the HJB equation.

Worked Example: A Scalar Quadratic Minimization

At a fixed state, suppose the control-dependent part of the Hamiltonian is \(h(u)=\tfrac32u^2+3u\), with \(u\in\mathbb{R}\). Find its minimizer and minimum.

Here \(R=3\) and \(p=3\), since \(h(u)=\tfrac12(3)u^2+3u\). The theorem gives \(u^*=-R^{-1}p=-1\). Completing the square directly gives \(h(u)=\tfrac32(u+1)^2-\tfrac32\). Since a square is nonnegative, the minimum is \(-\tfrac32\), attained only at \(u=-1\).

Check: substituting \(u=-1\) into the original expression gives \(\tfrac32(1)+3(-1)=\tfrac32-3=-\tfrac32\). At \(u=0\), the value is \(0\), which is larger than \(-\tfrac32\).

Worked Example: A Two-Control Quadratic Cost

Let \(R=\begin{pmatrix}2&0\\0&4\end{pmatrix}\) and let the coefficient of the linear control term be \(p=(4,-8)^\top\). Compute the minimizing control and the minimized control-dependent Hamiltonian.

The inverse is \(R^{-1}=\begin{pmatrix}1/2&0\\0&1/4\end{pmatrix}\). Therefore \(u^*=-R^{-1}p=(-2,2)^\top\). The minimized value is \(-\tfrac12p^\top R^{-1}p\). First, \(R^{-1}p=(2,-2)^\top\), so \(p^\top R^{-1}p=4(2)+(-8)(-2)=8+16=24\). The minimum is \(-12\).

Check: at \(u^*\), the quadratic term is \(\tfrac12u^{*\top}Ru^*=\tfrac12(2\cdot4+4\cdot4)=\tfrac12(8+16)=12\). The linear term is \(p^\top u^*=4(-2)+(-8)(2)=-8-16=-24\). Their sum is \(12-24=-12\), as claimed.

A Scalar Drift-Control Feedback

Consider \(dX_t=(X_t+u_t)\,dt+\tfrac12\,dB_t\), with running cost \(\ell(x,u)=\tfrac12x^2+u^2\) and a differentiable candidate value function \(V(t,x)\). The control set is \(\mathbb{R}\), and the control is not present in the diffusion coefficient. At a fixed \((t,x)\), the HJB Hamiltonian is

$$ H(t,x,u)=V_t+ \frac12x^2+u^2+(x+u)V_x+\frac12\left(\frac12\right)^2V_{xx}. $$

The last term is the diffusion contribution: the diffusion coefficient is \(\tfrac12\), so its squared value is \(\tfrac14\). The only terms involving \(u\) are \(u^2+uV_x\). This is \(\tfrac12Ru^2+pu\) with \(R=2\) and \(p=V_x\), hence the pointwise feedback candidate is \(u^*(t,x)=-\tfrac12V_x(t,x)\).

Worked Example: Evaluating Scalar Feedback at a State

At a particular time, suppose \(V(t,x)=2x^2\) as a function of \(x\), and evaluate the pointwise minimization at \(x=2\). This specifies the value and derivatives at that time and state; it does not assert that this candidate solves the HJB equation everywhere.

The derivatives are \(V_x=4x\) and \(V_{xx}=4\), so at \(x=2\), \(V_x=8\) and \(V_{xx}=4\). The feedback formula gives \(u^*=-\tfrac12(8)=-4\). The terms independent of \(u\) in the Hamiltonian are \(\tfrac12x^2+xV_x+\tfrac12(\tfrac12)^2V_{xx}\). Substitution gives \(\tfrac12(4)+2(8)+\tfrac12(\tfrac14)(4)=2+16+\tfrac12=\tfrac{37}{2}\). The control-dependent terms at \(u=-4\) are \(u^2+uV_x=16-32=-16\). Thus the Hamiltonian, excluding \(V_t\), is \(\tfrac{37}{2}-16=\tfrac52\).

Check: completing the square gives \(u^2+8u=(u+4)^2-16\), whose minimum is \(-16\) at \(u=-4\). The total computed Hamiltonian excluding \(V_t\) is therefore \(\tfrac{37}{2}-16=\tfrac52\), matching direct substitution.

What the Pointwise Rule Does—and Does Not—Establish

The feedback expression depends on the spatial gradient \(\nabla V\), not directly on the value \(V\) itself. A higher marginal value in a control direction changes the control through \(G^\top\nabla V\); the matrix \(R\) scales the response according to the cost of using each control direction. The positive-definite quadratic cost penalizes large controls and ensures a finite, unique minimizer over all of \(\mathbb{R}^m\).

The pointwise calculation assumes the control set is unrestricted. If the allowed controls are constrained, the unconstrained minimizer need not be allowed; minimizing over that set requires a separate constrained calculation. Likewise, if \(R\) is not positive definite, the theorem does not apply: strict convexity and a unique finite minimizer are no longer guaranteed. These cases require different analysis.

Common mistake: using the wrong factor of two. Suppose the control-dependent expression is \(2u^2+4u\). Treating it as though its quadratic term were \(\tfrac12(2)u^2\) would give the incorrect candidate \(u=-4/2=-2\). But the actual expression has \(2u^2=\tfrac12(4)u^2\), so \(R=4\), not \(2\). Its derivative is \(4u+4\), which vanishes at \(u=-1\). Directly, \(2(-1)^2+4(-1)=2-4=-2\), whereas the incorrect choice gives \(2(-2)^2+4(-2)=8-8=0\). The correction is to identify the coefficient in the convention \(\tfrac12 R u^2\) before applying the formula.

Finally, a pointwise minimizer is a feedback candidate, not automatically an optimal control for the original stochastic problem. To use it as a process, one must still check that the resulting state equation is well posed and that \(u_t^*=u^*(t,X_t)\) satisfies the admissibility and integrability conditions. To conclude global optimality from a classical HJB solution requires a verification argument, which uses additional hypotheses. The distinction is important: minimizing the Hamiltonian is an algebraic step inside that argument, not a replacement for it.

Check Your Understanding

Use the convention that a quadratic control term is written as \(\tfrac12u^\top Ru\).

  1. For \(h(u)=\tfrac12(5)u^2-10u\), find the unique minimizer and minimum.
  2. For \(R=\begin{pmatrix}1&0\\0&3\end{pmatrix}\) and \(p=(2,6)^\top\), compute \(-R^{-1}p\) and \(-\tfrac12p^\top R^{-1}p\).
  3. In the scalar model with drift \(x+u\) and running control cost \(u^2\), express the pointwise feedback in terms of \(V_x\).
  4. Explain why a positive-definite control-cost matrix makes the stationary point the unique global minimizer.
  5. Name two checks still needed before a pointwise feedback candidate can be claimed to be an optimal admissible control.