Skip to main content

4  Optimal Control

Author
Affiliation

Enrico Bertolazzi

University of Trento, Department of Industrial Engineering

Everything needed to set up and solve optimal control exercises: Hamiltonian and Pontryagin conditions, bang-bang and singular arcs, free final time, integral and path constraints, and the transformations to a standard form. Colors: \color{CornflowerBlue}\text{running cost}, \color{SeaGreen}\text{endpoint cost}, \color{RoyalBlue}\text{dynamics}, \color{Brown}\text{equality/integral constraints}, \color{DarkOrchid}\text{control set, inequalities}, \color{OrangeRed}\text{boundary conditions, variations}, \color{Crimson}\text{labels}.

4.1 From Isoperimetric Problems to Optimal Control

Problem.

\begin{aligned} \text{minimize:}\quad & {\color{CornflowerBlue}\int_a^b L(x,x',t)\,\mathrm{d}t}\\ \text{subject to:}\quad & {\color{Brown}w\big(x(a),x(b)\big)=0}\\ & {\color{Brown}\int_a^b \mathcal G(x,x',t)\,\mathrm{d}t = l} \end{aligned}

Recipe.

  1. Take y=x' as control and x as state.
  2. Add the state z with z'=\mathcal G(x,y,t), z(a)=0, z(b)=l.
  3. Solve the optimal control problem

\begin{aligned} \text{minimize:}\quad & {\color{CornflowerBlue}\int_a^b L(x,y,t)\,\mathrm{d}t}\\ \text{subject to:}\quad & {\color{RoyalBlue}x'=y,\qquad z'=\mathcal G(x,y,t)}\\ & {\color{Brown}w\big(x(a),x(b)\big)=0}\\ & {\color{Brown}z(a)=0,\qquad z(b)=l} \end{aligned}

Watch out.

  • The (constant) costate of z is the multiplier of the constraint. With H=L+\eta\,\mathcal G+\dots it equals -\lambda of the calculus-of-variations convention M=L-\lambda\mathcal G.

4.2 Optimal Control Problems

Bolza form and first-order conditions

Problem (\bm x\in\mathbb R^n state, \bm u\in\mathbb R^m control, \bm b\in\mathbb R^q; pure Mayer: L=0; pure Lagrange: \Phi=0).

\begin{aligned} \operatorname*{minimize}_{\bm{x},\bm{u}}\quad & {\color{SeaGreen}\Phi\big(\bm{x}(a),\bm{x}(b)\big)} + {\color{CornflowerBlue}\int_a^b L\big(\bm{x},\bm{u},t\big)\,\mathrm{d}t}\\ \text{subject to}\quad & {\color{RoyalBlue}\bm{x}'=\bm{f}\big(\bm{x},\bm{u},t\big)}\\ & {\color{OrangeRed}\bm{b}\big(\bm{x}(a),\bm{x}(b)\big)=\bm{0}}\\ & {\color{DarkOrchid}\bm{u}(t)\in\mathcal U\quad\text{a.e. on }[a,b]} \end{aligned}

Hamiltonian and endpoint Lagrangian (normal minimization convention, used throughout).

\begin{aligned} H(\bm{x},\bm{\lambda},\bm{u},t) &={\color{CornflowerBlue}L(\bm{x},\bm{u},t)} +{\color{RoyalBlue}\bm{\lambda}^{\mathsf T}\bm{f}(\bm{x},\bm{u},t)},\\ B(\bm{x}_a,\bm{x}_b,\bm{\omega}) &={\color{SeaGreen}\Phi(\bm{x}_a,\bm{x}_b)} +{\color{OrangeRed}\bm{\omega}^{\mathsf T}\bm{b}(\bm{x}_a,\bm{x}_b)}. \end{aligned}

Recipe (variation of the augmented functional). H_{\bm x}, H_{\bm u}, B_{\bm x_a}, \dots are column gradients.

\begin{aligned} \mathcal{J}_a &=B\big(\bm{x}(a),\bm{x}(b),\bm{\omega}\big) +\int_a^b\Big[H(\bm{x},\bm{\lambda},\bm{u},t)-\bm{\lambda}^{\mathsf T}\bm{x}'\Big]\mathrm{d}t \\[0.5em] \delta\mathcal{J}_a &=B_{\bm x_a}^{\mathsf T}{\color{OrangeRed}\delta\bm x(a)} +B_{\bm x_b}^{\mathsf T}{\color{OrangeRed}\delta\bm x(b)} +\bm b^{\mathsf T}{\color{OrangeRed}\delta\bm\omega}\\ &\quad+\int_a^b H_{\bm x}^{\mathsf T}{\color{OrangeRed}\delta\bm x} +H_{\bm u}^{\mathsf T}{\color{OrangeRed}\delta\bm u} +\big(\bm f-\bm x'\big)^{\mathsf T}{\color{OrangeRed}\delta\bm\lambda} -\bm\lambda^{\mathsf T}{\color{OrangeRed}\delta\bm x'}\,\mathrm{d}t \\[0.5em] &\text{\color{Crimson}integration by parts} \\[0.5em] &=\int_a^b \big(H_{\bm x}+\bm\lambda'\big)^{\mathsf T}{\color{OrangeRed}\delta\bm x} +H_{\bm u}^{\mathsf T}{\color{OrangeRed}\delta\bm u} +\big(\bm f-\bm x'\big)^{\mathsf T}{\color{OrangeRed}\delta\bm\lambda}\,\mathrm{d}t\\ &\quad+\big(B_{\bm x_a}+\bm\lambda(a)\big)^{\mathsf T}{\color{OrangeRed}\delta\bm x(a)} +\big(B_{\bm x_b}-\bm\lambda(b)\big)^{\mathsf T}{\color{OrangeRed}\delta\bm x(b)} +\bm b^{\mathsf T}{\color{OrangeRed}\delta\bm\omega} \end{aligned}

Setting to zero the coefficient of each variation gives the conditions.

Conditions (normal extremal; H_{\bm u}=\bm 0 only for an interior, unconstrained, smooth control).

\left\{ \begin{aligned} & {\color{RoyalBlue}\bm{x}' = H_{\bm{\lambda}}=\bm{f}(\bm{x},\bm{u},t)} && \text{\color{Crimson}State equation}\\[0.3em] & {\color{RoyalBlue}\bm{\lambda}' = -H_{\bm{x}}} && \text{\color{Crimson}Costate equation}\\[0.3em] & {\color{OrangeRed}\bm{b}\big(\bm{x}(a),\bm{x}(b)\big)=\bm{0}} && \text{\color{Crimson}Boundary conditions}\\[0.3em] & {\color{OrangeRed}B_{\bm{x}_a}+\bm{\lambda}(a)=\bm{0}} && \text{\color{Crimson}Costate BC at }a\\[0.3em] & {\color{OrangeRed}B_{\bm{x}_b}-\bm{\lambda}(b)=\bm{0}} && \text{\color{Crimson}Costate BC at }b\\[0.3em] & H_{\bm{u}}=\bm{0} && \text{\color{Crimson}Stationarity in }\bm u \end{aligned} \right.

Costate boundary conditions, component i of the state at an endpoint.

Component i of the state at an endpoint Adjoint boundary condition
value prescribed by \bm b the equation only defines the multiplier in \bm\omega: no information on \lambda_i
free, and \Phi does not depend on it \lambda_i(a)=0 (initial) or \lambda_i(b)=0 (final)
free, and \Phi depends on it \lambda_i(a)=-\partial\Phi/\partial x_{a,i}, \lambda_i(b)=\partial\Phi/\partial x_{b,i}
endpoints coupled, e.g. \bm x(a)-\bm x(b)=\bm 0 eliminate \bm\omega between the two equations (here \bm\lambda(a)+\Phi_{\bm x_a}=\bm\lambda(b)-\Phi_{\bm x_b}, i.e. \bm\lambda(a)=\bm\lambda(b) if \Phi does not depend on the endpoints)

Watch out.

  • H_{\bm u}=\bm 0 is only a first-order necessary condition: H_{\bm u\bm u}\ge0 is necessary, H_{\bm u\bm u}>0 gives a strict local minimizer of H in \bm u; convexity of H in \bm u gives the global one.
  • The BVP is a system of first-order ODEs (states, costates, and T, \bm p as constant states if present): the number of conditions must equal the number of ODEs, after eliminating \bm u with H_{\bm u}=\bm 0 or the minimum condition.
  • The components of \bm\omega are eliminated, not computed.
  • Maximize J = minimize -J: change the sign of L and \Phi before forming H and B.

Pontryagin minimum principle

Conditions (normal case, usual regularity hypotheses; convexity of \mathcal U not required).

\left\{ \begin{aligned} & {\color{RoyalBlue}\bm{x}' = H_{\bm{\lambda}},\qquad \bm{\lambda}' = -H_{\bm{x}}} && \text{\color{Crimson}Canonical equations}\\[0.3em] & {\color{OrangeRed}\bm b=\bm 0,\quad B_{\bm{x}_a}+\bm{\lambda}(a)=\bm{0},\quad B_{\bm{x}_b}-\bm{\lambda}(b)=\bm{0}} && \text{\color{Crimson}Boundary and costate BC}\\[0.3em] & \bm{u}^\star(t)\in \operatorname*{arg\,min}_{{\color{DarkOrchid}\bm{v}\in\mathcal U}} H\big(\bm{x}^\star(t),\bm{\lambda}(t),\bm{v},t\big) && \text{\color{Crimson}Minimum condition}\\[0.3em] & H\equiv c\ \ (T\text{ fixed}),\qquad H\equiv0\ \ (T\text{ free},\ B_T=0) && \text{\color{Crimson}First integral, autonomous problem} \end{aligned} \right.

The abnormal case uses H=\lambda_0L+\bm\lambda^{\mathsf T}\bm f, \lambda_0\ge0, (\lambda_0,\bm\lambda)\not\equiv0; it is not used here.

Recipe.

  1. If \bm u^\star is interior to \mathcal U and H is differentiable in \bm u: H_{\bm u}=\bm0.

  2. If \bm u^\star is on the boundary of \mathcal U: do not impose H_{\bm u}=\bm0; use the minimum condition.

  3. For convex \mathcal U the first-order condition is the variational inequality

    H_{\bm{u}}(\bm{x}^\star,\bm{\lambda},\bm{u}^\star,t)^{\mathsf T} (\bm{v}-\bm{u}^\star)\ge 0, \qquad \color{DarkOrchid}\forall\,\bm{v}\in\mathcal U .

  4. For a box u_{i}^{\min}\le u_i\le u_{i}^{\max} minimize H in \bm u with KKT, i=1,\dots,m:

    \left\{ \begin{aligned} & H_{u_i}+{\color{DarkOrchid}\nu_i^{+}-\nu_i^{-}}=0 && \text{\color{Crimson}Stationarity}\\[0.3em] & {\color{DarkOrchid}\nu_i^{\pm}\ge0,\quad \nu_i^{+}\big(u_i-u_i^{\max}\big)=0,\quad \nu_i^{-}\big(u_i^{\min}-u_i\big)=0} && \text{\color{Crimson}Complementarity} \end{aligned} \right.

If H is a sum of terms each depending on one u_i, the components decouple and each one is minimized separately.

Bounded scalar control entering linearly. If H=A+\sigma u with \sigma=H_u independent of u and u\in[u_{\min},u_{\max}],

u^\star(t)=\begin{cases} u_{\min},&\sigma(t)>0,\\ [u_{\min},u_{\max}],&\sigma(t)=0,\\ u_{\max},&\sigma(t)<0. \end{cases}

Watch out.

  • For a bounded control, \sigma=0 must not be imposed as an equation: u comes from the sign of \sigma.
  • \sigma(t)=0 on an interval is a singular arc, see Section 4.2.3; the set-valued case cannot be assigned arbitrarily to one bound.
  • For a control component on a bound, H_{u_i} need not vanish.

Linear controls and singular arcs

Problem (f_0, b_0 scalar functions of the state; autonomous).

\begin{aligned} \text{minimize:}\quad & {\color{CornflowerBlue}J(u)=\int_0^T f_0(\bm{x})+b_0(\bm{x})u \,\mathrm{d}t}\\ \text{subject to:}\quad & {\color{RoyalBlue}\bm{x}'=\bm{f}(\bm{x})+\bm{b}(\bm{x})u}\\ & {\color{OrangeRed}\bm{x}(0)=\bm{x}_0}\\ & {\color{DarkOrchid}|u|\le1} \end{aligned}

Hamiltonian. Add the cost as state x_0'=f_0(\bm x)+b_0(\bm x)u, x_0(0)=0 (so \lambda_0'=0). With \lambda_0 constant and i=0,\dots,n,

H = A+\sigma\,u,\qquad A=\sum_{i=0}^n f_i(\bm{x})\lambda_i,\quad \sigma=\sum_{i=0}^n b_i(\bm{x})\lambda_i, \qquad \lambda_i'=-\sum_{j=0}^n\lambda_j\frac{\partial f_j}{\partial x_i}-u\sum_{j=0}^n\lambda_j\frac{\partial b_j}{\partial x_i}.

\sigma=H_u is the switching function.

Necessary conditions.

\left\{ \begin{aligned} & {\color{RoyalBlue}x_i'=f_i(\bm x)+b_i(\bm x)u,}\\ & {\color{RoyalBlue}\lambda_i'=-\sum_{j}\lambda_j\frac{\partial f_j}{\partial x_i}-u\sum_{j}\lambda_j\frac{\partial b_j}{\partial x_i}} && \text{\color{Crimson}Canonical equations}\\[0.3em] & A+u^\star\sigma\le A+u\sigma\quad\text{for all }{\color{DarkOrchid}|u|\le1} && \text{\color{Crimson}Minimum condition}\\[0.3em] & H^\star=A+u^\star\sigma=c\ \ (T\text{ fixed}),\qquad H^\star=0\ \ (T\text{ free}) && \text{\color{Crimson}Constant Hamiltonian} \end{aligned} \right.

Control law. Where \sigma\ne0,

u^\star(t)=-\mathrm{sign}\{\sigma(t)\} =-\mathrm{sign}\Big\{\sum_{i=0}^n b_i(\bm{x}^\star)\lambda^\star_i\Big\}.

Isolated zeros of \sigma: bang-bang control. \sigma\equiv0 on an interval (t_1,t_2]: singular control and singular arc,

\sum_{i=0}^n \lambda^\star_i(t)b_i(\bm{x}^\star(t))=0,\qquad t\in(t_1,t_2].

An extremal singular control need not be optimal: generalized Legendre–Clebsch (below) is only necessary, and optimality needs further information (e.g. uniqueness).

Test for singular controls. Necessary, not sufficient, on (t_1,t_2] (c=0 if T is free):

\left.\begin{aligned} \sum_{i=0}^n b_i\lambda_i&=0 &&\text{\color{Crimson}switching function}\\ \sum_{i=0}^n f_i\lambda_i&=c &&\text{\color{Crimson}Hamiltonian constant}\\ \sum_{i=0}^n\sum_{j=0}^n\lambda_i\left( b_j\frac{\partial f_i}{\partial x_j}-f_j\frac{\partial b_i}{\partial x_j}\right)&=0 &&\text{\color{Crimson}derivative of switching function, coefficient of }u\text{\color{Crimson} cancels} \end{aligned}\right\}

Recipe (singular control).

  1. Differentiate \sigma along the extremal, substituting x_i' and \lambda_i'; the first derivative contains no u.

  2. Continue until u appears explicitly: the k-th derivative has the form

    \sum_{i=0}^n\lambda_i\psi_{ki}(\bm{x})+u\sum_{i=0}^n\lambda_i\phi_{ki}(\bm{x})=0 .

  3. If \sum\lambda_i\phi_{ki}=0 for k<m and \sum\lambda_i\phi_{mi}\ne0,

    u= -\frac{\displaystyle\sum_{i=0}^n\lambda_i\psi_{mi}(\bm{x})}{\displaystyle\sum_{i=0}^n\lambda_i\phi_{mi}(\bm{x})}.

  4. If the conditions of step 3 are violated, singular controls cannot occur; if all hold, a singular extremal control may exist.

Generalized Legendre–Clebsch. If u first appears in the 2r-th derivative of \sigma=H_u, a minimizing singular arc needs

(-1)^r\frac{\partial}{\partial u} \left(\frac{\mathrm d^{2r}}{\mathrm dt^{2r}}H_u\right)\ge0 .

If it fails, the singular extremal is not locally optimal.

Recipe (bang–singular–bang extremal).

  1. Write H, identify \sigma; write costate equations and costate BC (free state: \lambda_i(T)=0, or \lambda_i(T)=\Phi_{x_{b,i}} with a Mayer cost).
  2. Bang arcs: u=\pm bound from the sign of \sigma; integrate with constant u.
  3. Singular arc: \sigma=\sigma'=\dots=0 gives u_{\mathrm{sing}}; integrate. Check u_{\min}\le u_{\mathrm{sing}}(t)\le u_{\max}: where it fails the arc must be bang.
  4. Assume the sequence of arcs; unknowns are the switching times, T and the integration constants.
  5. At a switching time t_A: states and costates continuous, \sigma(t_A)=0. At the end: the final BC and, for autonomous free T with B independent of T, H=0 (in general H(T)+B_T=0).
  6. Check the sign of \sigma on the bang arcs and the generalized Legendre–Clebsch condition.

Watch out.

  • The formulas assume \bm f(\bm x), \bm b(\bm x) autonomous; with explicit t differentiate directly, \mathrm d/\mathrm dt includes \partial/\partial t.
  • A singular arc is a candidate: Pontryagin gives no information on u when \sigma\equiv0.
  • If H_{\bm u\bm u} is nonsingular (e.g. quadratic cost in \bm u), H_{\bm u}=\bm0 determines \bm u: no singular arc.
  • The BVP may have several solutions: discard the inadmissible ones, evaluate J on the others, keep the smallest.

4.3 Transformations of Optimal Control Problems

Reference problem and sign convention

Problem (\bm p\in\mathbb R^r constant optimization parameters, when present).

\begin{aligned} \operatorname*{minimize}_{\bm{x},\bm{u},\bm{p}}\quad & {\color{SeaGreen}\Phi\big(\bm{x}(a),\bm{x}(b),\bm{p}\big)} +{\color{CornflowerBlue}\int_a^b L(\bm{x},\bm{u},\bm{p},t)\,\mathrm dt}\\ \text{subject to}\quad & {\color{RoyalBlue}\bm{x}'=\bm{f}(\bm{x},\bm{u},\bm{p},t)}\\ & {\color{OrangeRed}\bm{b}\big(\bm{x}(a),\bm{x}(b),\bm{p}\big)=\bm{0}}\\ & {\color{DarkOrchid}\bm{u}(t)\in\mathcal U} \end{aligned}

Endpoint Lagrangian. H and the costate BC are as in the Bolza problem, with \bm p as extra argument:

B(\bm{x}_a,\bm{x}_b,\bm{p},\bm{\omega}) ={\color{SeaGreen}\Phi(\bm{x}_a,\bm{x}_b,\bm{p})} +{\color{OrangeRed}\bm{\omega}^{\mathsf T}\bm{b}(\bm{x}_a,\bm{x}_b,\bm{p})}, \qquad B_{\bm{x}_a}+\bm{\lambda}(a)=\bm{0},\quad B_{\bm{x}_b}-\bm{\lambda}(b)=\bm{0}.

Watch out. The signs belong to the convention: mixing H=L+\bm{\lambda}^{\mathsf T}\bm{f} with endpoint signs derived from H=L-\bm{\lambda}^{\mathsf T}\bm{f} gives a wrong BVP.

Summary of the transformations

Feature to remove Device Price
Lagrange term state z'=L, z(a)=0, cost z(b) one more state
Mayer term constant state \bm p(a)=\bm x(a) and running cost \widetilde L n more states (none if \bm x(a) fixed)
Constant parameter state \bm p'=\bm 0 zero dynamics
Integral constraint state \bm z'=\bm g with two endpoint conditions one state per constraint
General interval [a,b] t=a+(b-a)s, s\in[0,1] factor (b-a)
Free final time T t=sT, s\in[0,1] T as parameter or state T'=0

Watch out. A transformation is exact only if all auxiliary ODEs and endpoint conditions are included; each added state worsens conditioning or changes sparsity.

Lagrange to Mayer

Pure Lagrange cost, states \bm w=(\bm x^{\mathsf T},z)^{\mathsf T}; for a Bolza cost the Mayer cost is \Phi\big(\bm x(a),\bm x(b)\big)+z(b).

\begin{aligned} \operatorname*{minimize}\quad & {\color{SeaGreen}z(b)}\\ \text{subject to}\quad &{\color{RoyalBlue}\bm{x}'=\bm{f}(\bm{x},\bm{u},t),\quad z'=L(\bm{x},\bm{u},t)}\\ &{\color{OrangeRed}z(a)=0,\quad \bm{b}\big(\bm{x}(a),\bm{x}(b)\big)=\bm{0}}\\ &{\color{DarkOrchid}\bm{u}(t)\in\mathcal U} \end{aligned}

Mayer to Lagrange

\Phi\big(\bm x(a),\bm x(b)\big) depends on both endpoints, so it is a running cost only if \bm x(a) is fixed or carried along as a constant state \bm p, \bm p(a)=\bm x(a). With \nabla_{\bm x}\Phi(\bm p,\bm x) the gradient with respect to the second argument,

\widetilde L(\bm{p},\bm{x},\bm{u},t) ={\color{CornflowerBlue}\nabla_{\bm{x}}\Phi(\bm{p},\bm{x})^{\mathsf T} \bm{f}(\bm{x},\bm{u},t) + \frac{\Phi(\bm{p},\bm{p})}{b-a}}, \qquad \int_a^b\widetilde L\,\mathrm dt=\Phi\big(\bm{x}(a),\bm{x}(b)\big),

\begin{aligned} \operatorname*{minimize}\quad &{\color{CornflowerBlue}\int_a^b\widetilde L(\bm{p},\bm{x},\bm{u},t)\,\mathrm dt}\\ \text{subject to}\quad &{\color{RoyalBlue}\bm{x}'=\bm{f}(\bm{x},\bm{u},t),\quad \bm{p}'=\bm{0}}\\ &{\color{OrangeRed}\bm{p}(a)-\bm{x}(a)=\bm{0},\quad \bm{b}\big(\bm{x}(a),\bm{x}(b)\big)=\bm{0}} \end{aligned}

If \bm{x}(a) is fixed, the state \bm{p} is unnecessary.

Constant parameters as states

An unknown constant \bm p is the state \bm p'=\bm 0 (its endpoint values not fixed), or a finite-dimensional parameter. Both give the parameter stationarity condition

{\color{OrangeRed}B_{\bm{p}} +\int_a^b H_{\bm{p}}\,\mathrm dt =\bm{0}}

As a state: \bm\lambda_{\bm p}'=-H_{\bm p}, \bm\lambda_{\bm p}(a)=\bm\lambda_{\bm p}(b)=\bm0 if B does not depend on \bm p.

A prescribed physical parameter is not an optimization variable: do not turn it into a state.

Integral constraints

\begin{aligned} &{\color{Brown}\bm{\Psi}\big(\bm{x}(a),\bm{x}(b),\bm{p}\big)+\int_a^b\bm{g}(\bm{x},\bm{u},\bm{p},t)\,\mathrm dt=\bm{0}} \\ &\quad\Updownarrow\quad \\ &{\color{RoyalBlue}\bm{z}'=\bm{g}(\bm{x},\bm{u},\bm{p},t)},\\ &{\color{Brown}\bm{z}(a)=\bm{0}},\\ &{\color{Brown}\bm{z}(b)+\bm{\Psi}\big(\bm{x}(a),\bm{x}(b),\bm{p}\big)=\bm{0}}. \end{aligned}

For \int_a^b\bm{g}\,\mathrm dt=\bm{c} use \bm{z}(a)=\bm{0}, \bm{z}(b)=\bm{c}.

Watch out.

  • The ODE \bm z'=\bm g alone does not enforce the constraint: the condition on \bm z(b) is essential.
  • The costate of \bm z is constant; its value is the multiplier \bm\eta of the Summary.

Fixed-interval time transformation

\begin{aligned} t&=a+(b-a)s,\ s\in[0,1]: \\ &{\color{RoyalBlue}\frac{\mathrm d\bm{x}}{\mathrm ds} =(b-a)\bm{f}\big(\bm{x},\bm{u},a+(b-a)s\big)}, \\ &{\color{CornflowerBlue}\int_0^1(b-a)L\big(\bm{x},\bm{u},a+(b-a)s\big)\,\mathrm ds}. \end{aligned}

Free terminal time

Problem (\bm u(t)\in\mathcal U, T>0).

\begin{aligned} \operatorname*{minimize}_{T,\bm{x},\bm{u}}\quad &{\color{SeaGreen}\Phi\big(\bm{x}(0),\bm{x}(T),T\big)} +{\color{CornflowerBlue}\int_0^T L(\bm{x},\bm{u},t)\,\mathrm dt}\\ \text{subject to}\quad &{\color{RoyalBlue}\bm{x}'=\bm{f}(\bm{x},\bm{u},t)},\\ &{\color{OrangeRed}\bm{b}\big(\bm{x}(0),\bm{x}(T),T\big)=\bm{0}},\quad {\color{DarkOrchid}\bm{u}(t)\in\mathcal U} \end{aligned}

Recipe (time normalization). t=sT, s\in[0,1], \widetilde{\bm{x}}(s)=\bm{x}(sT), \widetilde{\bm{u}}(s)=\bm{u}(sT), '=\mathrm d/\mathrm ds:

\begin{aligned} \operatorname*{minimize}\quad &{\color{SeaGreen}\Phi\big(\widetilde{\bm{x}}(0),\widetilde{\bm{x}}(1),T\big)} +{\color{CornflowerBlue}\int_0^1T L\big(\widetilde{\bm{x}},\widetilde{\bm{u}},sT\big)\,\mathrm ds}\\ \text{subject to}\quad &{\color{RoyalBlue}\widetilde{\bm{x}}' =T\bm{f}\big(\widetilde{\bm{x}},\widetilde{\bm{u}},sT\big)}\\ &{\color{OrangeRed}\bm{b}\big(\widetilde{\bm{x}}(0),\widetilde{\bm{x}}(1),T\big)=\bm{0}},\quad {\color{DarkOrchid}\widetilde{\bm{u}}(s)\in\mathcal U} \end{aligned}

  1. Keep T as an optimization parameter, or add the state T'=0.

  2. Normalized Hamiltonian \widetilde H=T\,H(\widetilde{\bm x},\bm\lambda,\widetilde{\bm u},sT); costates of \widetilde{\bm x} as usual.

  3. Stationarity in T (parameter form) or \lambda_T'=-\widetilde H_T with \lambda_T(0)=\lambda_T(1)=0 (state form, \Phi and \bm b independent of T):

    {\color{OrangeRed}B_T+\int_0^1\widetilde H_T\,\mathrm ds=0}, \qquad \widetilde H_T=H+T\,s\,\frac{\partial H}{\partial t}\Big|_{\text{explicit }t}.

  4. Solve in s; the solution in time is t=sT.

Free-time transversality (original variables, B(\bm x_0,\bm x_T,T,\bm\omega)=\Phi+\bm\omega^{\mathsf T}\bm b):

{\color{OrangeRed}H\big(\bm{x}(T),\bm{\lambda}(T),\bm{u}(T),T\big)+B_T=0}

For an autonomous problem with B independent of T: H(T)=0, and H\equiv0 along the extremal. Minimum time as L=1 (H=1+\bm\lambda^{\mathsf T}\bm f, H(T)=0) or as \Phi=T (L=0, B_T=1, H(T)=-1) is the same condition.

Watch out. T>0 must hold; \widetilde H_T must include the explicit dependence on t=sT.

Free initial and final times

\begin{aligned} t&=t_0+(t_f-t_0)s,\ s\in[0,1]:\\ {\color{RoyalBlue}\widetilde{\bm{x}}'} &{\color{RoyalBlue}=(t_f-t_0)\bm{f} \big(\widetilde{\bm{x}},\widetilde{\bm{u}},t_0+(t_f-t_0)s\big)}. \end{aligned}

Watch out. t_0 and t_f are both optimization parameters, each with its own stationarity/transversality equation. Do not collapse them into a single duration when the dynamics or endpoint data depend explicitly on absolute time.

Path and mixed constraints

Problem. Bolza problem of Section 4.2.1 with the mixed constraint

{\color{DarkOrchid}\bm{c}(\bm{x},\bm{u},t)\le\bm{0}}

A path constraint cannot be replaced by endpoint conditions, unlike an integral constraint: it needs pointwise multipliers \bm\nu(t). Work formally with H_a=H+\bm\nu^{\mathsf T}\bm c.

Conditions (\bm u otherwise unconstrained).

\left\{ \begin{aligned} & {\color{RoyalBlue}\bm\lambda'=-\partial H_a/\partial\bm x} && \text{\color{Crimson}Costate equation}\\[0.3em] & \partial H_a/\partial\bm u=\bm0 && \text{\color{Crimson}Stationarity}\\[0.3em] & {\color{DarkOrchid}\bm{c}(\bm{x},\bm{u},t)\le\bm{0},\quad \bm{\nu}(t)\ge\bm{0},\quad \nu_i c_i=0} && \text{\color{Crimson}Complementarity} \end{aligned} \right.

Recipe.

  1. Inactive arc (c_i<0): \nu_i=0.
  2. Active arc (c_i=0, mixed constraint with \partial c_i/\partial\bm u\ne\bm0): solve c_i=0 for a component of \bm u and get \nu_i from \partial H_a/\partial\bm u=\bm0.
  3. Check \nu_i\ge0 on the active arcs, and the Weierstrass condition: H(\bm x^\star,\bm\lambda,\bm u,t)\ge H(\bm x^\star,\bm\lambda,\bm u^\star,t) for every feasible \bm u.

Watch out. Pure state constraints are more delicate: the multipliers may be measures and the costates may jump at entry and exit points. Do not treat them like control bounds.

4.4 Summary

  1. Problem: minimize {\color{SeaGreen}\Phi\big(\bm{x}(a),\bm{x}(b),\bm{p}\big)} +{\color{CornflowerBlue}\int_a^bL(\bm{x},\bm{u},\bm{p},t)\,\mathrm dt}

  2. Dynamics: {\color{RoyalBlue}\bm{x}'=\bm{f}(\bm{x},\bm{u},\bm{p},t)}

  3. Boundary conditions: {\color{OrangeRed}\bm{b}\big(\bm{x}(a),\bm{x}(b),\bm{p}\big)=\bm{0}}

  4. Integral constraints (auxiliary state \bm z'=\bm g, \bm z(a)=\bm 0, \bm\Psi+\bm z(b)=\bm0; its costate is the constant \bm\eta): {\color{Brown}\bm{\Psi}\big(\bm{x}(a),\bm{x}(b),\bm{p}\big) +\int_a^b\bm{g}(\bm{x},\bm{u},\bm{p},t)\,\mathrm dt=\bm{0}}

  5. Control set: {\color{DarkOrchid}\bm{u}(t)\in\mathcal U}

  6. Hamiltonian and endpoint Lagrangian (normal minimization convention): \begin{aligned} H(\bm{x},\bm{\lambda},\bm{\eta},\bm{u},\bm{p},t) &={\color{CornflowerBlue}L(\bm{x},\bm{u},\bm{p},t)} +{\color{RoyalBlue}\bm{\lambda}^{\mathsf T}\bm{f}(\bm{x},\bm{u},\bm{p},t)} +{\color{Brown}\bm{\eta}^{\mathsf T}\bm{g}(\bm{x},\bm{u},\bm{p},t)},\\ B(\bm{x}_a,\bm{x}_b,\bm{p},\bm{\omega},\bm{\eta}) &={\color{SeaGreen}\Phi(\bm{x}_a,\bm{x}_b,\bm{p})} +{\color{OrangeRed}\bm{\omega}^{\mathsf T}\bm{b}(\bm{x}_a,\bm{x}_b,\bm{p})} +{\color{Brown}\bm{\eta}^{\mathsf T}\bm{\Psi}(\bm{x}_a,\bm{x}_b,\bm{p})}. \end{aligned}

General problem

\begin{aligned} \operatorname*{minimize}_{\bm{x},\bm{u},\bm{p}}\quad & {\color{SeaGreen}\Phi\big(\bm{x}(a),\bm{x}(b),\bm{p}\big)} +{\color{CornflowerBlue}\int_a^b L(\bm{x},\bm{u},\bm{p},t)\,\mathrm dt}\\ \text{subject to}\quad & {\color{RoyalBlue}\bm{x}'=\bm{f}(\bm{x},\bm{u},\bm{p},t)}\\ & {\color{OrangeRed}\bm{b}\big(\bm{x}(a),\bm{x}(b),\bm{p}\big)=\bm{0}}\\ & {\color{Brown}\bm{\Psi}\big(\bm{x}(a),\bm{x}(b),\bm{p}\big)+\int_a^b\bm{g}(\bm{x},\bm{u},\bm{p},t)\,\mathrm dt=\bm{0}}\\ & {\color{DarkOrchid}\bm{u}(t)\in\mathcal U} \end{aligned}

Necessary conditions (normal extremal)

\left\{ \begin{aligned} & {\color{RoyalBlue}\bm{x}' = H_{\bm{\lambda}}=\bm{f}(\bm{x},\bm{u},\bm{p},t)} && \text{\color{Crimson}State equation}\\[0.3em] & {\color{RoyalBlue}\bm{\lambda}' = -H_{\bm{x}}} && \text{\color{Crimson}Costate equation}\\[0.3em] & {\color{OrangeRed}\bm{b}\big(\bm{x}(a),\bm{x}(b),\bm{p}\big)=\bm{0}} && \text{\color{Crimson}Boundary conditions}\\[0.3em] & {\color{Brown}\bm{\Psi}\big(\bm{x}(a),\bm{x}(b),\bm{p}\big) +\int_a^b\bm{g}(\bm{x},\bm{u},\bm{p},t)\,\mathrm dt=\bm{0}} && \text{\color{Crimson}Integral constraints}\\[0.3em] & {\color{OrangeRed}B_{\bm{x}_a}+\bm{\lambda}(a)=\bm{0}} && \text{\color{Crimson}Costate BC at }a\\[0.3em] & {\color{OrangeRed}B_{\bm{x}_b}-\bm{\lambda}(b)=\bm{0}} && \text{\color{Crimson}Costate BC at }b\\[0.3em] & {\color{OrangeRed}B_{\bm{p}}+\int_a^bH_{\bm{p}}\,\mathrm dt=\bm{0}} && \text{\color{Crimson}Parameter stationarity}\\[0.3em] & \bm{u}^\star(t)\in \operatorname*{arg\,min}_{{\color{DarkOrchid}\bm{v}\in\mathcal U}} H\big(\bm{x}^\star(t),\bm{\lambda}(t),\bm{\eta},\bm{v},\bm{p},t\big) && \text{\color{Crimson}Minimum condition}\\[0.3em] & H\equiv c\ \ (T\text{ fixed}),\qquad H\equiv0\ \ (T\text{ free},\ B_T=0) && \text{\color{Crimson}First integral, autonomous problem} \end{aligned} \right.

  • Interior \bm u^\star and H differentiable in \bm u: H_{\bm u}=\bm0. Never impose it for a control on the boundary of \mathcal U.
  • Convex \mathcal U: H_{\bm u}^{\mathsf T}(\bm v-\bm u^\star)\ge0 for all \bm v\in\mathcal U; box constraints: KKT of the pointwise minimization.
  • Mixed constraint \bm c\le\bm0: replace H by H_a=H+{\color{DarkOrchid}\bm\nu^{\mathsf T}\bm c} with {\color{DarkOrchid}\bm\nu\ge\bm0,\ \nu_ic_i=0}.
  • Costate BC: prescribed endpoint value, no condition; free and absent from \Phi, \lambda_i=0; free and in \Phi, \lambda_i(a)=-\Phi_{x_{a,i}}, \lambda_i(b)=\Phi_{x_{b,i}}.
  • Count the conditions: as many as first-order ODEs (states, costates, constant states).
  • The BVP may have several solutions: discard the inadmissible ones, evaluate J on the others, keep the smallest.

Free terminal time

Use exactly one of the three forms.

Variables Condition
original, t\in[0,T] {\color{OrangeRed}H(T)+B_T=0} (H(T)=0 if autonomous and B independent of T)
normalized t=sT, T as parameter {\color{OrangeRed}B_T+\int_0^1\widetilde H_T\,\mathrm ds=0}
normalized t=sT, T as state {\color{OrangeRed}\lambda_T'=-\widetilde H_T,\ \ \lambda_T(0)=\lambda_T(1)=0} (\Phi, \bm b independent of T)

Singular controls

Item Formula
scalar control entering linearly H=A+\sigma u, \ \sigma=H_u
bang-bang u^\star=u_{\min}\ (\sigma>0), \ u^\star=u_{\max}\ (\sigma<0)
singular arc \sigma=\sigma'=\dots=0 until u appears: k-th derivative =\sum_i\lambda_i\psi_{ki}+u\sum_i\lambda_i\phi_{ki}
singular control u=-\dfrac{\sum_i\lambda_i\psi_{mi}}{\sum_i\lambda_i\phi_{mi}}, \ m = first k with \sum_i\lambda_i\phi_{ki}\ne0
generalized Legendre–Clebsch (necessary) (-1)^r\dfrac{\partial}{\partial u}\dfrac{\mathrm d^{2r}}{\mathrm dt^{2r}}H_u\ge0, with m=2r

Here m, r are derivative orders, not the dimensions above.