Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Indirect Numerical Methods, Multiple Shooting, and Pontryagin’s Minimum Principle

Most optimal control problems cannot be solved analytically. Nonlinear dynamics, complicated endpoint conditions, control bounds, and long time horizons generally require numerical solution.

This section introduces two broad classes of numerical optimal control methods:

  1. Indirect methods, which first derive necessary conditions and then solve the resulting boundary-value problem.

  2. Direct methods, which discretize and optimize the original control problem directly.

The chapter focuses on indirect methods, especially:

Why Numerical Methods Are Necessary

Consider the general optimal control problem

minu()J=Φ ⁣(x(t0),t0,x(tf),tf)+t0tfL(x,u,t)dt,\min_{\boldsymbol{u}(\cdot)} J = \Phi\!\left(\boldsymbol{x}(t_0),t_0,\boldsymbol{x}(t_f),t_f\right) + \int_{t_0}^{t_f} L(\boldsymbol{x},\boldsymbol{u},t)\,\mathrm{d} t,

subject to

x˙=f(x,u,t),ϕ ⁣(x(t0),t0,x(tf),tf)=0.\begin{aligned} \dot{\boldsymbol{x}} &= \boldsymbol{f}(\boldsymbol{x},\boldsymbol{u},t),\\ \boldsymbol{\phi}\!\left(\boldsymbol{x}(t_0),t_0,\boldsymbol{x}(t_f),t_f\right)&=\boldsymbol{0}. \end{aligned}

Closed-form solutions are exceptional because:

Thus, computational methods are central to practical optimal control.

Indirect and Direct Optimization Methods

A finite-dimensional analogy

Suppose one wants to minimize a smooth scalar function

f(x).f(x).

A necessary condition for an unconstrained local optimum is

dfdx=0.\frac{\,\mathrm{d} f}{\,\mathrm{d} x}=0.

Solving this condition is not itself an optimization problem. It is a root-finding problem:

g(x)=dfdx=0.g(x) = \frac{\,\mathrm{d} f}{\,\mathrm{d} x} = 0.

The second derivative then classifies the critical point:

f(x)>0local minimum,f(x)<0local maximum,f(x)=0inconclusive without higher-order analysis.\begin{aligned} f''(x^*)&>0 &&\Rightarrow \text{local minimum},\\ f''(x^*)&<0 &&\Rightarrow \text{local maximum},\\ f''(x^*)&=0 &&\Rightarrow \text{inconclusive without higher-order analysis}. \end{aligned}

This is an indirect method: one derives necessary conditions and solves them.

By contrast, a direct method operates on f(x)f(x) itself and searches for a value that reduces the objective without first solving the stationarity equation exactly.

The Hamiltonian Boundary-Value Problem

For an unconstrained-control optimal control problem, the necessary conditions include

x˙=Hλ,λ˙=Hx,0=Hu,\begin{aligned} \dot{\boldsymbol{x}} &= \frac{\partial H}{\partial \boldsymbol{\lambda}}, \\ \dot{\boldsymbol{\lambda}} &= -\frac{\partial H}{\partial \boldsymbol{x}}, \\ \boldsymbol{0} &= \frac{\partial H}{\partial \boldsymbol{u}}, \end{aligned}

together with the endpoint constraints and transversality conditions.

Define the combined state–costate vector

p(t)=[x(t)λ(t)].\boldsymbol{p}(t) = \begin{bmatrix} \boldsymbol{x}(t)\\ \boldsymbol{\lambda}(t) \end{bmatrix}.

After eliminating the control through stationarity when possible, the canonical equations can be written as

p˙=g(p,t).\dot{\boldsymbol{p}} = \boldsymbol{g}(\boldsymbol{p},t).

All endpoint and transversality conditions can be collected into a residual vector

s ⁣(p(t0),t0,p(tf),tf)=0.\boldsymbol{s}\!\left( \boldsymbol{p}(t_0),t_0, \boldsymbol{p}(t_f),t_f \right) = \boldsymbol{0}.

Equations (9)(10) form a two-point boundary-value problem.

The numerical task is to find unknown endpoint data such that integration of the differential equations produces zero boundary residual.

Newton’s Method for Root Finding

Suppose

G(z)=0\boldsymbol{G}(\boldsymbol{z})=\boldsymbol{0}

is a system of nonlinear algebraic equations.

Let zk\boldsymbol{z}_k be the current iterate and write

zk+1=zk+Δzk.\boldsymbol{z}_{k+1} = \boldsymbol{z}_k+\Delta\boldsymbol{z}_k.

A first-order Taylor expansion gives

G(zk+Δzk)G(zk)+Gz(zk)Δzk.\boldsymbol{G}(\boldsymbol{z}_k+\Delta\boldsymbol{z}_k) \approx \boldsymbol{G}(\boldsymbol{z}_k) + \frac{\partial \boldsymbol{G}}{\partial \boldsymbol{z}}(\boldsymbol{z}_k) \Delta\boldsymbol{z}_k.

Requiring the linearized residual to vanish yields

Gz(zk)Δzk=G(zk).\frac{\partial \boldsymbol{G}}{\partial \boldsymbol{z}}(\boldsymbol{z}_k) \Delta\boldsymbol{z}_k = -\boldsymbol{G}(\boldsymbol{z}_k).

Therefore,

zk+1=zk[Gz(zk)]1G(zk).\boxed{ \boldsymbol{z}_{k+1} = \boldsymbol{z}_k - \left[ \frac{\partial \boldsymbol{G}}{\partial \boldsymbol{z}}(\boldsymbol{z}_k) \right]^{-1} \boldsymbol{G}(\boldsymbol{z}_k). }

In computation, the Jacobian is not explicitly inverted. Instead, one solves the linear system

JkΔzk=G(zk).\boldsymbol{J}_k\Delta\boldsymbol{z}_k = -\boldsymbol{G}(\boldsymbol{z}_k).

Convergence remarks

Newton’s method converges rapidly when:

It may fail when the initial guess is poor or the Jacobian is ill-conditioned.

Single Shooting as a Root-Finding Problem

Suppose η\boldsymbol{\eta} denotes the unknown initial data, often the initial costate:

λ(t0)=η.\boldsymbol{\lambda}(t_0)=\boldsymbol{\eta}.

For each guess η\boldsymbol{\eta}:

  1. form the complete initial condition;

  2. integrate the canonical equations to tft_f;

  3. evaluate the terminal and transversality conditions; and

  4. construct the shooting residual.

The residual may be written as

R(η)=s ⁣(p(t0;η),t0,p(tf;η),tf).\boldsymbol{R}(\boldsymbol{\eta}) = \boldsymbol{s}\!\left( \boldsymbol{p}(t_0;\boldsymbol{\eta}),t_0, \boldsymbol{p}(t_f;\boldsymbol{\eta}),t_f \right).

The shooting problem is

R(η)=0.\boxed{ \boldsymbol{R}(\boldsymbol{\eta}^*)=\boldsymbol{0}. }

Newton’s method gives

ηk+1=ηk[Rη]1R(ηk).\boldsymbol{\eta}_{k+1} = \boldsymbol{\eta}_k - \left[ \frac{\partial \boldsymbol{R}}{\partial \boldsymbol{\eta}} \right]^{-1} \boldsymbol{R}(\boldsymbol{\eta}_k).

Algorithm

  1. Choose an initial guess η0\boldsymbol{\eta}_0.

  2. Integrate the state–costate equations.

  3. Evaluate the boundary residual R(ηk)\boldsymbol{R}(\boldsymbol{\eta}_k).

  4. Compute or approximate the shooting Jacobian.

  5. Solve for the Newton correction.

  6. Update the shooting variables.

  7. Repeat until

R(ηk)ε.\|\boldsymbol{R}(\boldsymbol{\eta}_k)\| \leq \varepsilon.
Newton shooting updates missing endpoint data until the boundary residual is below tolerance.

Figure 1:Newton shooting updates missing endpoint data until the boundary residual is below tolerance.

Sensitivity and the Shooting Jacobian

The shooting Jacobian measures the sensitivity of the boundary residual to the guessed endpoint variables:

Jshoot=Rη.\boldsymbol{J}_{\mathrm{shoot}} = \frac{\partial \boldsymbol{R}}{\partial \boldsymbol{\eta}}.

It can be computed using:

For the parameterized initial-value problem

p˙=g(p,t),p(t0)=p0(η),\dot{\boldsymbol{p}} = \boldsymbol{g}(\boldsymbol{p},t), \qquad \boldsymbol{p}(t_0)=\boldsymbol{p}_0(\boldsymbol{\eta}),

define the sensitivity matrix

Y(t)=p(t)η.\boldsymbol{Y}(t) = \frac{\partial \boldsymbol{p}(t)}{\partial \boldsymbol{\eta}}.

Differentiating the dynamics gives

Y˙=gpY,\dot{\boldsymbol{Y}} = \frac{\partial \boldsymbol{g}}{\partial \boldsymbol{p}} \boldsymbol{Y},

with

Y(t0)=p0η.\boldsymbol{Y}(t_0) = \frac{\partial \boldsymbol{p}_0}{\partial \boldsymbol{\eta}}.

This matrix can then be used to construct the shooting Jacobian accurately.

Why Single Shooting Becomes Difficult

Single shooting integrates across the entire horizon. If the canonical dynamics contain growing modes, errors in the guessed endpoint data may grow exponentially.

The method becomes difficult when:

These limitations motivate multiple shooting.

Multiple Shooting

Partition the time interval:

t0<t1<<tN=tf.t_0<t_1<\cdots<t_N=t_f.

Introduce an independent parameter at the beginning of each segment:

pip(ti),i=0,,N1.\boldsymbol{p}_i \approx \boldsymbol{p}(t_i), \qquad i=0,\ldots,N-1.

Starting from pi\boldsymbol{p}_i, integrate

p˙=g(p,t)\dot{\boldsymbol{p}}=\boldsymbol{g}(\boldsymbol{p},t)

over [ti,ti+1][t_i,t_{i+1}].

Let

p~i+1=φi(pi)\widetilde{\boldsymbol{p}}_{i+1} = \varphi_i(\boldsymbol{p}_i)

denote the result of this integration at ti+1t_{i+1}.

The independently introduced parameter at the next node is pi+1\boldsymbol{p}_{i+1}. Continuity requires

p~i+1pi+1=0,i=0,,N2.\boxed{ \widetilde{\boldsymbol{p}}_{i+1} - \boldsymbol{p}_{i+1} = \boldsymbol{0}, \qquad i=0,\ldots,N-2. }

These are called:

Why the next segment does not simply start from the previous result

If each segment simply starts from the endpoint produced by the previous segment, the procedure is identical to single shooting.

In multiple shooting, the initial value of each segment is an independent optimization or root-finding variable. The integrated endpoint and the next segment’s initial variable are allowed to differ during the iteration. Their equality is imposed only through the matching constraints.

This prevents unstable error growth from accumulating over the full horizon in a single integration.

Multiple-Shooting Residual

Collect all segment initial values into

Z=[p0p1pN1].\boldsymbol{Z} = \begin{bmatrix} \boldsymbol{p}_0\\ \boldsymbol{p}_1\\ \vdots\\ \boldsymbol{p}_{N-1} \end{bmatrix}.

The residual consists of:

  1. the original endpoint conditions; and

  2. all continuity conditions.

A general multiple-shooting residual is

R(Z)=[s ⁣(p0,t0,p~N,tf)p~1p1p~2p2p~N1pN1].\boldsymbol{\mathcal{R}}(\boldsymbol{Z}) = \begin{bmatrix} \boldsymbol{s}\!\left(\boldsymbol{p}_0,t_0,\widetilde{\boldsymbol{p}}_N,t_f\right) \\[1mm] \widetilde{\boldsymbol{p}}_1-\boldsymbol{p}_1 \\ \widetilde{\boldsymbol{p}}_2-\boldsymbol{p}_2 \\ \vdots \\ \widetilde{\boldsymbol{p}}_{N-1}-\boldsymbol{p}_{N-1} \end{bmatrix}.

The numerical problem is

R(Z)=0.\boxed{ \boldsymbol{\mathcal{R}}(\boldsymbol{Z})=\boldsymbol{0}. }

Newton’s method or a related nonlinear root solver can then be applied.

Parallel Shooting Interpretation

Each segment integration depends only on its own initial parameter pi\boldsymbol{p}_i. Therefore, all segment integrations can be performed independently and, in principle, simultaneously.

This is why multiple shooting is also called parallel shooting.

Multiple shooting uses independent segment initial values and enforces continuity through matching residuals.

Figure 2:Multiple shooting uses independent segment initial values and enforces continuity through matching residuals.

Single Shooting Versus Multiple Shooting

FeatureSingle shootingMultiple shooting
Number of variablesSmallLarger
Integration horizonEntire intervalShort segments
Sensitivity to instabilityHighReduced
Memory requirementLowHigher
ParallelizationLimitedNatural
Implementation complexityLowerHigher
Initial-guess robustnessOften poorUsually improved

Multiple shooting trades additional variables and continuity constraints for improved numerical robustness.

Historical Computational Perspective

Indirect shooting was attractive in early computational optimal control because it introduced relatively few unknown variables.

If the state dimension is nn, then the state–costate vector has dimension 2n2n. A basic shooting method may only need to solve for a subset of these endpoint values.

Multiple shooting introduces approximately 2n2n additional variables per segment, increasing memory and algebraic problem size. Historically, this was a serious limitation.

Modern computers reduce this concern, but the tradeoff remains:

more variablesbetter control of integration sensitivity.\text{more variables} \quad\Longleftrightarrow\quad \text{better control of integration sensitivity}.

Practical MATLAB Workflow

A simple indirect-shooting implementation can be organized as follows:

  1. Write a function for the state–costate dynamics.

  2. Write a function that accepts the unknown shooting variables.

  3. Construct the complete initial or terminal data.

  4. Integrate using an ODE solver.

  5. Evaluate the endpoint residual.

  6. Pass the residual function to a nonlinear equation solver such as fsolve.

  7. Verify the endpoint conditions after convergence.

A generic residual function has the conceptual form

function residual = shootingResidual(eta)
    p0 = constructInitialData(eta);
    [t,p] = ode45(@canonicalDynamics,[t0 tf],p0);
    pf = p(end,:)';
    residual = endpointConditions(p0,pf);
end

The converged numerical result should always be checked independently.

Transition to Constrained Controls

The stationarity condition

Hu=0\frac{\partial H}{\partial \boldsymbol{u}}=\boldsymbol{0}

assumes that the optimal control lies in the interior of the allowable control set.

In practical systems, controls are usually bounded:

u(t)U.\boldsymbol{u}(t)\in\mathcal{U}.

Examples include:

When the optimal control reaches a bound, the interior stationarity condition is not generally valid.

Pontryagin’s Minimum Principle

Suppose x(t)\boldsymbol{x}^*(t) and λ(t)\boldsymbol{\lambda}^*(t) are the optimal state and costate.

At each time, hold these optimal functions fixed and compare the Hamiltonian evaluated at an arbitrary admissible control uU\boldsymbol{u}\in\mathcal{U} with the Hamiltonian evaluated at the optimal control u\boldsymbol{u}^*.

Optimality requires

H ⁣(x(t),u(t),λ(t),t)H ⁣(x(t),u(t),λ(t),t)H\!\left( \boldsymbol{x}^*(t),\boldsymbol{u}(t),\boldsymbol{\lambda}^*(t),t \right) \geq H\!\left( \boldsymbol{x}^*(t),\boldsymbol{u}^*(t),\boldsymbol{\lambda}^*(t),t \right)

for every admissible u(t)U\boldsymbol{u}(t)\in\mathcal{U} and almost every tt.

Equivalently,

u(t)argminuUH ⁣(x(t),u,λ(t),t).\boxed{ \boldsymbol{u}^*(t) \in \arg\min_{\boldsymbol{u}\in\mathcal{U}} H\!\left( \boldsymbol{x}^*(t),\boldsymbol{u},\boldsymbol{\lambda}^*(t),t \right). }

Equation (39) is Pontryagin’s Minimum Principle under the minimum-Hamiltonian sign convention used here.

Minimum Principle Versus Stationarity

If the control set is unconstrained and the Hamiltonian is differentiable, the minimum principle often reduces to

Hu=0.\frac{\partial H}{\partial \boldsymbol{u}}=\boldsymbol{0}.

If the control is bounded, the minimizer may occur at the boundary, so

Hu0\frac{\partial H}{\partial \boldsymbol{u}} \neq \boldsymbol{0}

can hold at the optimum.

Therefore:

Hamiltonian minimization is more general than stationarity.\boxed{ \text{Hamiltonian minimization is more general than stationarity.} }

Scalar Bounded-Control Illustration

Suppose

uminu(t)umaxu_{\min}\leq u(t)\leq u_{\max}

and the Hamiltonian depends linearly on the control:

H(x,u,λ,t)=H0(x,λ,t)+σ(x,λ,t)u.H(x,u,\lambda,t) = H_0(x,\lambda,t) + \sigma(x,\lambda,t)u.

The quantity

σ(t)=Hu\sigma(t) = \frac{\partial H}{\partial u}

is the switching function.

Hamiltonian minimization gives

u(t)={umin,σ(t)>0,umax,σ(t)<0,undetermined by first-order minimization,σ(t)=0.u^*(t) = \begin{cases} u_{\min}, & \sigma(t)>0,\\ u_{\max}, & \sigma(t)<0,\\ \text{undetermined by first-order minimization}, & \sigma(t)=0. \end{cases}

This structure motivates bang-bang and singular-control analysis.

Complete Indirect Optimality System

For a bounded-control problem, the indirect necessary conditions are:

x˙=Hλ(x,u,λ,t),λ˙=Hx(x,u,λ,t),u(t)argminuUH(x,u,λ,t),\begin{aligned} \dot{\boldsymbol{x}}^* &= \frac{\partial H}{\partial \boldsymbol{\lambda}} \left( \boldsymbol{x}^*,\boldsymbol{u}^*,\boldsymbol{\lambda}^*,t \right), \\ \dot{\boldsymbol{\lambda}}^* &= - \frac{\partial H}{\partial \boldsymbol{x}} \left( \boldsymbol{x}^*,\boldsymbol{u}^*,\boldsymbol{\lambda}^*,t \right), \\ \boldsymbol{u}^*(t) &\in \arg\min_{\boldsymbol{u}\in\mathcal{U}} H\left(\boldsymbol{x}^*,\boldsymbol{u},\boldsymbol{\lambda}^*,t\right), \end{aligned}

together with:

The resulting system is generally a nonlinear two-point boundary-value problem solved by shooting, multiple shooting, or other numerical methods.

Common Errors

  1. Treating the shooting residual as the original cost function.

  2. Explicitly inverting a Newton Jacobian instead of solving a linear system.

  3. Starting every multiple-shooting segment from the previous integrated endpoint.

  4. Omitting the continuity constraints in multiple shooting.

  5. Assuming H/u=0\partial H/\partial u=0 remains valid at a control bound.

  6. Minimizing the Hamiltonian over all real controls instead of the admissible set.

  7. Confusing a necessary condition with a sufficient condition.

  8. Accepting solver convergence without checking the endpoint residuals.

Summary

The main conclusions are:

  1. Most optimal control problems require numerical solution.

  2. Indirect methods solve the necessary conditions of optimality.

  3. The optimality system becomes a root-finding problem coupled to differential equations.

  4. Single shooting guesses missing endpoint data and iterates until the boundary conditions are satisfied.

  5. Newton’s method provides a systematic shooting update.

  6. Single shooting can be highly sensitive to unstable canonical dynamics.

  7. Multiple shooting introduces independent segment initial values and continuity constraints.

  8. Multiple shooting can be parallelized and is often more robust.

  9. For constrained controls, Hamiltonian stationarity must be replaced by pointwise Hamiltonian minimization.

  10. Pontryagin’s Minimum Principle is the appropriate general condition for selecting the optimal control.

Connection. The Hamiltonian formulation also yields conservation properties and switching rules, providing a direct route to minimum-time bang–bang control.