Algorithm Search⌘K

Definitioncore

Hamiltonian of an optimal control problem

Also called control Hamiltonian, Pontryagin Hamiltonian.

The function H = lambda_0 L(x, u) + lambda^T f(x, u) of state, input and costate. The optimal input minimizes it at each time, and its gradients give the state and costate equations.

The Hamiltonian of an optimal control problem joins the running cost and the dynamics into one scalar function of the state xx, the input uu and a multiplier vector λ\lambda, the costate. In the maximum principle, the optimal input minimizes the Hamiltonian over the allowed inputs at each time, and the derivatives of the Hamiltonian give the equations of the state and the costate. This area uses the minimum form, with the sign convention of the definition below.

Definition

Take the optimal control problem with dynamics x˙=f(x,u)\dot x = f(x, u), x∈Rnx \in \mathbb{R}^n, u∈U⊆Rmu \in U \subseteq \mathbb{R}^m, and running cost L(x,u)L(x, u), where ff and LL are C1C^1 in xx (and in uu, where the derivative in uu is used). The Hamiltonian is the function

H(x,u,λ,λ0)=λ0L(x,u)+λTf(x,u),x∈Rn, u∈U, λ∈Rn, λ0∈{0,1}.H(x, u, \lambda, \lambda_0) = \lambda_0 L(x, u) + \lambda^T f(x, u), \qquad x \in \mathbb{R}^n,\ u \in U,\ \lambda \in \mathbb{R}^n,\ \lambda_0 \in \{0, 1\}.

The number λ0\lambda_0 is the cost multiplier. In the normal case λ0=1\lambda_0 = 1 and one writes H(x,u,λ)=L(x,u)+λTf(x,u)H(x, u, \lambda) = L(x, u) + \lambda^T f(x, u). The abnormal case λ0=0\lambda_0 = 0 is explained on the page of the maximum principle. For time-varying data, H(t,x,u,λ,λ0)=λ0L(t,x,u)+λTf(t,x,u)H(t, x, u, \lambda, \lambda_0) = \lambda_0 L(t, x, u) + \lambda^T f(t, x, u).

Along a pair of functions x(t)x(t) and λ(t)\lambda(t), the canonical equations are

x˙=∂H∂λ=f(x,u),λ˙=−∂H∂x=−λ0Lx(x,u)T−fx(x,u)Tλ.\dot x = \frac{\partial H}{\partial \lambda} = f(x, u), \qquad \dot \lambda = -\frac{\partial H}{\partial x} = -\lambda_0 L_x(x, u)^T - f_x(x, u)^T \lambda.

The first is the dynamics. The second is the costate equation.

The minimized Hamiltonian is h(x,λ,λ0)=inf⁡u∈UH(x,u,λ,λ0)h(x, \lambda, \lambda_0) = \inf_{u \in U} H(x, u, \lambda, \lambda_0). The minimum condition of the maximum principle says that an optimal input satisfies H(x∗(t),u∗(t),λ(t),λ0)=h(x∗(t),λ(t),λ0)H(x^*(t), u^*(t), \lambda(t), \lambda_0) = h(x^*(t), \lambda(t), \lambda_0) at almost every tt.

The switching function of a control-affine problem, where f=f0(x)+G(x)uf = f_0(x) + G(x) u and L=L0(x)+c(x)TuL = L_0(x) + c(x)^T u, is the coefficient of uu in HH: σ(x,λ,λ0)=λ0c(x)+G(x)Tλ∈Rm\sigma(x, \lambda, \lambda_0) = \lambda_0 c(x) + G(x)^T \lambda \in \mathbb{R}^m.

Examples and non-examples

A scalar problem. For x˙=u\dot x = u, L=u2L = u^2 and U=RU = \mathbb{R}, the normal Hamiltonian is H=u2+λuH = u^2 + \lambda u. It is smallest at u=−λ/2u = -\lambda/2, so h(λ)=−λ2/4h(\lambda) = -\lambda^2/4. The costate equation is λ˙=−Hx=0\dot\lambda = -H_x = 0. With x(0)=1x(0) = 1, the horizon 1 and the terminal cost x(1)2x(1)^2, the costate page shows λ=1\lambda = 1 and u∗=−1/2u^* = -1/2, which agrees with the direct computation on the optimal control problem page.

The linear quadratic regulator. For x˙=Ax+Bu\dot x = A x + B u and L=xTQx+uTRuL = x^T Q x + u^T R u with R>0R > 0,

H=xTQx+uTRu+λT(Ax+Bu).H = x^T Q x + u^T R u + \lambda^T (A x + B u).

HH is strictly convex in uu, and Hu=2Ru+BTλ=0H_u = 2 R u + B^T \lambda = 0 gives u=−12R−1BTλu = -\tfrac12 R^{-1} B^T \lambda. The canonical equations become x˙=Ax−12BR−1BTλ\dot x = A x - \tfrac12 B R^{-1} B^T \lambda and λ˙=−2Qx−ATλ\dot\lambda = -2 Q x - A^T \lambda. With μ=λ/2\mu = \lambda / 2, the pair (x,μ)(x, \mu) solves the linear system with the Hamiltonian matrix

[x˙μ˙]=[A−BR−1BT−Q−AT][xμ].\begin{bmatrix} \dot x \\ \dot \mu \end{bmatrix} = \begin{bmatrix} A & -B R^{-1} B^T \\ -Q & -A^T \end{bmatrix} \begin{bmatrix} x \\ \mu \end{bmatrix}.

If λ=2Px\lambda = 2 P x, then u=−R−1BTPxu = -R^{-1} B^T P x, the LQR feedback. The factor 2 comes from the cost without a factor 12\tfrac12, the convention of this area.

A bounded input. For x˙=u\dot x = u, L=1L = 1 and U=[−1,1]U = [-1, 1] (a minimum-time problem), H=λ0+λuH = \lambda_0 + \lambda u is linear in uu. Its minimum is at u=−sgn⁡λu = -\operatorname{sgn}\lambda when λ≠0\lambda \ne 0, and the value is h=λ0−∣λ∣h = \lambda_0 - |\lambda|. The Hamiltonian is not differentiable in uu at its minimizer, and Hu=0H_u = 0 has no solution. This is why the minimum condition, and not Hu=0H_u = 0, is the general rule. The bang-bang principle starts from this case.

Non-example: the Hamiltonian of mechanics. In the calculus of variations, with f(x,u)=uf(x, u) = u, the Hamiltonian of classical mechanics is Hmech(x,p)=sup⁡v(pTv−L(x,v))H_{\text{mech}}(x, p) = \sup_v (p^T v - L(x, v)), the Legendre transform of LL. It is not the control Hamiltonian, but the two are related: h(x,λ,1)=inf⁡v(L+λTv)=−Hmech(x,−λ)h(x, \lambda, 1) = \inf_v (L + \lambda^T v) = -H_{\text{mech}}(x, -\lambda). So the costate is the negative of the momentum p=Lx˙p = L_{\dot x} of mechanics, which matches the Euler-Lagrange equation page.

Non-example: the maximum form. Pontryagin et al. (1962) and Liberzon (2012) use the function ⟨p,f⟩+p0L\langle p, f \rangle + p_0 L with a constant p0≤0p_0 \le 0 and maximize it. With p=−λp = -\lambda and p0=−λ0p_0 = -\lambda_0 it equals −H-H, so the maximum of one is the minimum of the other. The two forms give the same optimal inputs, but formulas copied between them change sign. On this site every page, the maximum principle page included, uses HH as defined above; that page shows the maximum form only to translate it.

Non-example: the Hamiltonian matrix. The Hamiltonian matrix is the 2n×2n2n \times 2n matrix of the canonical equations of the LQR problem, shown above. It is a matrix, not a function, and it has a structure of its own (its eigenvalues are symmetric about the imaginary axis).

  • Costate. The multiplier λ(t)\lambda(t) that solves λ˙=−Hx\dot\lambda = -H_x, with end conditions from the transversality conditions.
  • Constancy of the Hamiltonian. For a problem whose data do not depend on time, H(x∗(t),u∗(t),λ(t),λ0)H(x^*(t), u^*(t), \lambda(t), \lambda_0) is constant along an optimal trajectory, and it is 0 if the final time is free. The proof is on the page of the maximum principle.
  • Hamiltonian systems. If the minimizer u=κ(x,λ)u = \kappa(x, \lambda) is unique and smooth, the canonical equations with u=κ(x,λ)u = \kappa(x, \lambda) form the Hamiltonian system of the function h(x,λ)h(x, \lambda). Its flow keeps the symplectic form.
  • Hamiltonian in the HJB equation. The Hamilton-Jacobi-Bellman equation is −Vt=h(x,VxT,1)-V_t = h(x, V_x^T, 1), so the same minimized Hamiltonian appears there with λ\lambda replaced by the gradient of the value function.
  • Singular arc. An interval on which the switching function σ\sigma is identically zero, so the minimum condition does not fix uu (singular arc).

References

  1. Daniel Liberzon, Calculus of Variations and Optimal Control Theory, A Concise Introduction, Princeton University Press, 2012, Section 2.4 (the Hamiltonian formalism of the calculus of variations), Section 3.4 (the variational approach and the Hamiltonian) and Section 4.1 (the statement of the maximum principle)
  2. Donald E. Kirk, Optimal Control Theory, An Introduction, Prentice-Hall, 1970 (Dover reprint, 2004), Section 5.1 (necessary conditions for optimal control, with the Hamiltonian)
  3. L. S. Pontryagin, V. G. Boltyanskii, R. V. Gamkrelidze and E. F. Mishchenko, The Mathematical Theory of Optimal Processes, translated by K. N. Trirogoff, edited by L. W. Neustadt, Interscience, 1962 (Russian edition 1961), Chapter 1 (the function H and the statement of the maximum principle)

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/VG8FXN/text.yaml