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.

Costate Estimation Using the Legendre–Gauss–Radau Method

This section develops costate estimation for an optimal-control problem transcribed with the Legendre–Gauss–Radau (LGR) pseudospectral method. The main objective is to derive a direct relationship between:

  1. the Karush–Kuhn–Tucker (KKT) multipliers of the discretized nonlinear program; and

  2. approximations of the continuous-time costate.

The LGR method is especially convenient for costate estimation because one endpoint is itself a collocation point. For the left-Radau grid considered here, the initial point is included among the LGR points, whereas the final point is a noncollocated interpolation point.

The final mapping is

λ1:N=W1Λ1:N,\boxed{ \boldsymbol{\lambda}_{1:N} = \boldsymbol{W}^{-1}\boldsymbol{\Lambda}_{1:N}, }

and

λN+1=dN+1TΛ1:N,\boxed{ \boldsymbol{\lambda}_{N+1} = \boldsymbol{d}_{N+1}^{\mathsf{T}}\boldsymbol{\Lambda}_{1:N}, }

where Λ1:N\boldsymbol{\Lambda}_{1:N} are the multipliers of the LGR collocation equations, W\boldsymbol{W} is the diagonal matrix of Radau quadrature weights, and dN+1\boldsymbol{d}_{N+1} is the final column of the LGR differentiation matrix.

Continuous Mayer Optimal-Control Problem

Consider the simplified Mayer problem

minx(),u()Φ(x(1)),\min_{\boldsymbol{x}(\cdot),\boldsymbol{u}(\cdot)} \Phi\bigl(\boldsymbol{x}(1)\bigr),

subject to

x˙(τ)=f(x(τ),u(τ)),τ[1,1],\dot{\boldsymbol{x}}(\tau) = \boldsymbol{f}\bigl(\boldsymbol{x}(\tau),\boldsymbol{u}(\tau)\bigr), \qquad \tau\in[-1,1],

and

x(1)=x0.\boldsymbol{x}(-1)=\boldsymbol{x}_0.

Because the objective contains no running cost, the Hamiltonian is

H(x,u,λ)=λTf(x,u).H(\boldsymbol{x},\boldsymbol{u},\boldsymbol{\lambda}) = \boldsymbol{\lambda}^{\mathsf{T}}\boldsymbol{f}(\boldsymbol{x},\boldsymbol{u}).

Continuous First-Order Necessary Conditions

The continuous first-order conditions are:

Terminal Transversality

λ(1)=xΦ(x(1)).\boxed{ \boldsymbol{\lambda}(1) = \nabla_{\boldsymbol{x}} \Phi\bigl(\boldsymbol{x}(1)\bigr). }

Initial Boundary Multiplier

If μ\boldsymbol{\mu} is the multiplier associated with the fixed initial condition, then

λ(1)=μ.\boxed{ \boldsymbol{\lambda}(-1)=\boldsymbol{\mu}. }

Costate Equation

λ˙(τ)=x[λ(τ)Tf(x(τ),u(τ))].\boxed{ \dot{\boldsymbol{\lambda}}(\tau) = - \nabla_{\boldsymbol{x}} \left[ \boldsymbol{\lambda}(\tau)^{\mathsf{T}} \boldsymbol{f}\bigl(\boldsymbol{x}(\tau),\boldsymbol{u}(\tau)\bigr) \right]. }

Stationarity with Respect to the Control

u[λ(τ)Tf(x(τ),u(τ))]=0.\boxed{ \nabla_{\boldsymbol{u}} \left[ \boldsymbol{\lambda}(\tau)^{\mathsf{T}} \boldsymbol{f}\bigl(\boldsymbol{x}(\tau),\boldsymbol{u}(\tau)\bigr) \right] = \boldsymbol{0}. }

The discrete LGR KKT conditions will be transformed into approximations of these equations.

LGR Grid

Let

τ1,,τN\tau_1,\ldots,\tau_N

denote the NN LGR points. For a left-Radau scheme,

τ1=1,\tau_1=-1,

and

1=τ1<τ2<<τN<1.-1=\tau_1<\tau_2<\cdots<\tau_N<1.

The noncollocated terminal interpolation point is

τN+1=1.\tau_{N+1}=1.

Thus:

State Approximation

Approximate the state by a polynomial of degree at most NN:

X(τ)=i=1N+1XiLi(τ),\boxed{ \boldsymbol{X}(\tau) = \sum_{i=1}^{N+1} \boldsymbol{X}_iL_i(\tau), }

where

Li(τ)=j=1jiN+1ττjτiτj.L_i(\tau) = \prod_{\substack{j=1\\j\neq i}}^{N+1} \frac{\tau-\tau_j}{\tau_i-\tau_j}.

The state values are

Xix(τi),i=1,,N+1.\boldsymbol{X}_i \approx \boldsymbol{x}(\tau_i), \qquad i=1,\ldots,N+1.

The derivative of the approximation is

X˙(τ)=i=1N+1XiLi(τ).\dot{\boldsymbol{X}}(\tau) = \sum_{i=1}^{N+1} \boldsymbol{X}_iL_i'(\tau).

LGR Differentiation Matrix

Define the LGR differentiation matrix by

Dji=Li(τj),j=1,,N,i=1,,N+1.D_{ji} = L_i'(\tau_j), \qquad j=1,\ldots,N, \qquad i=1,\ldots,N+1.

Therefore,

DRN×(N+1).\boxed{ \boldsymbol{D}\in\mathbb{R}^{N\times(N+1)}. }

Collocating at the NN LGR points gives

i=1N+1DjiXi=f(Xj,Uj),j=1,,N.\sum_{i=1}^{N+1} D_{ji}\boldsymbol{X}_i = \boldsymbol{f}(\boldsymbol{X}_j,\boldsymbol{U}_j), \qquad j=1,\ldots,N.

In matrix form,

DX1:N+1=F1:N,\boxed{ \boldsymbol{D}\boldsymbol{X}_{1:N+1} = \boldsymbol{F}_{1:N}, }

where

Fj=f(Xj,Uj).\boldsymbol{F}_j = \boldsymbol{f}(\boldsymbol{X}_j,\boldsymbol{U}_j).

LGR Nonlinear Program

The LGR transcription is

minX,UΦ(XN+1)subject toF1:NDX1:N+1=0,x0X1=0.\boxed{ \begin{aligned} \min_{\boldsymbol{X},\boldsymbol{U}} \quad & \Phi(\boldsymbol{X}_{N+1}) \\ \text{subject to} \quad & \boldsymbol{F}_{1:N} - \boldsymbol{D}\boldsymbol{X}_{1:N+1} = \boldsymbol{0}, \\ & \boldsymbol{x}_0-\boldsymbol{X}_1 = \boldsymbol{0}. \end{aligned} }

Unlike the LG method, no separate quadrature equation is needed to recover the terminal state, because XN+1\boldsymbol{X}_{N+1} is already an NLP variable.

LGR NLP Lagrangian

Let

Λ1:N=[Λ1ΛN]\boldsymbol{\Lambda}_{1:N} = \begin{bmatrix} \boldsymbol{\Lambda}_1\\ \vdots\\ \boldsymbol{\Lambda}_N \end{bmatrix}

be the multipliers associated with the NN collocation equations.

Let

μ\boldsymbol{\mu}

be the multiplier associated with the initial condition.

The NLP Lagrangian is

L=Φ(XN+1)+Λ1:N,F1:NDX1:N+1+μ,x0X1.\begin{aligned} \mathcal{L} ={}& \Phi(\boldsymbol{X}_{N+1}) + \left\langle \boldsymbol{\Lambda}_{1:N}, \boldsymbol{F}_{1:N} - \boldsymbol{D}\boldsymbol{X}_{1:N+1} \right\rangle \nonumber\\ &+ \left\langle \boldsymbol{\mu}, \boldsymbol{x}_0-\boldsymbol{X}_1 \right\rangle. \end{aligned}

KKT Conditions for the LGR NLP

The NLP variables are

X1,,XN+1,U1,,UN.\boldsymbol{X}_1,\ldots,\boldsymbol{X}_{N+1}, \qquad \boldsymbol{U}_1,\ldots,\boldsymbol{U}_N.

State Stationarity for Interior LGR Points

For

j=2,,N,j=2,\ldots,N,

stationarity with respect to Xj\boldsymbol{X}_j gives

i=1NDijΛi=(Xf(Xj,Uj))TΛj.\boxed{ \sum_{i=1}^{N} D_{ij}\boldsymbol{\Lambda}_i = \left( \nabla_{\boldsymbol{X}} \boldsymbol{f}(\boldsymbol{X}_j,\boldsymbol{U}_j) \right)^{\mathsf{T}} \boldsymbol{\Lambda}_j. }

In scalar shorthand,

i=1NDijΛi=ΛjXf(Xj,Uj).\sum_{i=1}^{N} D_{ij}\Lambda_i = \Lambda_j \nabla_{\boldsymbol{X}}f(\boldsymbol{X}_j,\boldsymbol{U}_j).

State Stationarity at the Initial LGR Point

Because X1\boldsymbol{X}_1 also appears in the initial-condition constraint,

i=1NDi1Λi=(Xf(X1,U1))TΛ1μ.\boxed{ \sum_{i=1}^{N} D_{i1}\boldsymbol{\Lambda}_i = \left( \nabla_{\boldsymbol{X}} \boldsymbol{f}(\boldsymbol{X}_1,\boldsymbol{U}_1) \right)^{\mathsf{T}} \boldsymbol{\Lambda}_1 - \boldsymbol{\mu}. }

Equivalently,

i=1NDi1Λi+μ=(Xf(X1,U1))TΛ1.\sum_{i=1}^{N} D_{i1}\boldsymbol{\Lambda}_i + \boldsymbol{\mu} = \left( \nabla_{\boldsymbol{X}} \boldsymbol{f}(\boldsymbol{X}_1,\boldsymbol{U}_1) \right)^{\mathsf{T}} \boldsymbol{\Lambda}_1.

Control Stationarity

For

j=1,,N,j=1,\ldots,N,

stationarity with respect to Uj\boldsymbol{U}_j gives

(Uf(Xj,Uj))TΛj=0.\boxed{ \left( \nabla_{\boldsymbol{U}} \boldsymbol{f}(\boldsymbol{X}_j,\boldsymbol{U}_j) \right)^{\mathsf{T}} \boldsymbol{\Lambda}_j = \boldsymbol{0}. }

Terminal-State Stationarity

Differentiation with respect to XN+1\boldsymbol{X}_{N+1} gives

XΦ(XN+1)=dN+1TΛ1:N,\boxed{ \nabla_{\boldsymbol{X}} \Phi(\boldsymbol{X}_{N+1}) = \boldsymbol{d}_{N+1}^{\mathsf{T}} \boldsymbol{\Lambda}_{1:N}, }

where

dN+1\boldsymbol{d}_{N+1}

is the final column of D\boldsymbol{D}.

This equation provides the terminal costate estimate.

Definition of the LGR Adjoint Differentiation Matrix

Let

W=diag(w1,,wN),\boldsymbol{W} = \operatorname{diag}(w_1,\ldots,w_N),

where wiw_i are the LGR quadrature weights.

Define

DRN×N.\boldsymbol{D}^\dagger\in\mathbb{R}^{N\times N}.

A commonly used representation is

D11=D111w1,\boxed{ D_{11}^\dagger = -D_{11}-\frac{1}{w_1}, }

and, for the remaining entries,

Dij=wjwiDji.\boxed{ D_{ij}^\dagger = - \frac{w_j}{w_i}D_{ji}. }

This matrix plays the role of a differentiation matrix for the discrete costate approximation at the LGR points.

Interior Costate Transformation

Define the costate estimate at the LGR points by

λ1:N=W1Λ1:N.\boxed{ \boldsymbol{\lambda}_{1:N} = \boldsymbol{W}^{-1}\boldsymbol{\Lambda}_{1:N}. }

Componentwise,

λi=Λiwi,i=1,,N.\boxed{ \boldsymbol{\lambda}_i = \frac{\boldsymbol{\Lambda}_i}{w_i}, \qquad i=1,\ldots,N. }

This mapping is simpler than the LG mapping because there is no additional terminal quadrature multiplier.

Transformation of the Discrete Adjoint Equation

Substitute

Λi=wiλi\boldsymbol{\Lambda}_i=w_i\boldsymbol{\lambda}_i

into the KKT state equations.

For the interior points, the transformed equation becomes

j=1NDijλj=X[λiTf(Xi,Ui)],i=2,,N.\boxed{ \sum_{j=1}^{N} D_{ij}^\dagger\boldsymbol{\lambda}_j = - \nabla_{\boldsymbol{X}} \left[ \boldsymbol{\lambda}_i^{\mathsf{T}} \boldsymbol{f}(\boldsymbol{X}_i,\boldsymbol{U}_i) \right], \qquad i=2,\ldots,N. }

This is the discrete LGR approximation of

λ˙=x(λTf).\dot{\boldsymbol{\lambda}} = - \nabla_{\boldsymbol{x}} \left( \boldsymbol{\lambda}^{\mathsf{T}}\boldsymbol{f} \right).

At the first LGR point,

j=1ND1jλj=X[λ1Tf(X1,U1)]+1w1(μλ1).\boxed{ \sum_{j=1}^{N} D_{1j}^\dagger\boldsymbol{\lambda}_j = - \nabla_{\boldsymbol{X}} \left[ \boldsymbol{\lambda}_1^{\mathsf{T}} \boldsymbol{f}(\boldsymbol{X}_1,\boldsymbol{U}_1) \right] + \frac{1}{w_1} \left( \boldsymbol{\mu}-\boldsymbol{\lambda}_1 \right). }

The additional term reflects the initial-condition multiplier.

Asymptotic Endpoint Consistency

The continuous boundary condition is

λ(1)=μ.\boldsymbol{\lambda}(-1)=\boldsymbol{\mu}.

Because

τ1=1,\tau_1=-1,

the first LGR costate estimate should approximate the initial costate:

λ1μ.\boldsymbol{\lambda}_1\approx\boldsymbol{\mu}.

As the polynomial degree increases,

μλ10.\boxed{ \boldsymbol{\mu}-\boldsymbol{\lambda}_1\rightarrow\boldsymbol{0}. }

Consequently, the correction term

1w1(μλ1)\frac{1}{w_1} \left( \boldsymbol{\mu}-\boldsymbol{\lambda}_1 \right)

vanishes asymptotically.

Terminal Costate Recovery

The terminal-state KKT condition is

XΦ(XN+1)=dN+1TΛ1:N.\nabla_{\boldsymbol{X}} \Phi(\boldsymbol{X}_{N+1}) = \boldsymbol{d}_{N+1}^{\mathsf{T}} \boldsymbol{\Lambda}_{1:N}.

From the continuous transversality condition,

λ(1)=xΦ(x(1)).\boldsymbol{\lambda}(1) = \nabla_{\boldsymbol{x}} \Phi(\boldsymbol{x}(1)).

Therefore, define

λN+1=dN+1TΛ1:N.\boxed{ \boldsymbol{\lambda}_{N+1} = \boldsymbol{d}_{N+1}^{\mathsf{T}} \boldsymbol{\Lambda}_{1:N}. }

This gives the costate estimate at the noncollocated final point.

Alternative Interpretation Through Quadrature

Since

λ˙=x(λTf),\dot{\boldsymbol{\lambda}} = - \nabla_{\boldsymbol{x}} \left( \boldsymbol{\lambda}^{\mathsf{T}}\boldsymbol{f} \right),

integration gives

λ(1)=λ(1)+11λ˙(τ)dτ.\boldsymbol{\lambda}(1) = \boldsymbol{\lambda}(-1) + \int_{-1}^{1} \dot{\boldsymbol{\lambda}}(\tau)\,\mathrm{d}\tau.

Using LGR quadrature,

λN+1λ1+i=1Nwi[X(λiTFi)].\boldsymbol{\lambda}_{N+1} \approx \boldsymbol{\lambda}_1 + \sum_{i=1}^{N} w_i \left[ - \nabla_{\boldsymbol{X}} \left( \boldsymbol{\lambda}_i^{\mathsf{T}}\boldsymbol{F}_i \right) \right].

When

λ1μ,\boldsymbol{\lambda}_1\approx\boldsymbol{\mu},

this quadrature relation is consistent with the terminal formula obtained directly from the KKT conditions.

Discrete Control Stationarity

Using

Λi=wiλi,\boldsymbol{\Lambda}_i=w_i\boldsymbol{\lambda}_i,

the control stationarity conditions become

(Uf(Xi,Ui))Twiλi=0.\left( \nabla_{\boldsymbol{U}} \boldsymbol{f}(\boldsymbol{X}_i,\boldsymbol{U}_i) \right)^{\mathsf{T}} w_i\boldsymbol{\lambda}_i = \boldsymbol{0}.

Since wi>0w_i>0,

U[λiTf(Xi,Ui)]=0,i=1,,N.\boxed{ \nabla_{\boldsymbol{U}} \left[ \boldsymbol{\lambda}_i^{\mathsf{T}} \boldsymbol{f}(\boldsymbol{X}_i,\boldsymbol{U}_i) \right] = \boldsymbol{0}, \qquad i=1,\ldots,N. }

This is the discrete equivalent of

uH=0.\nabla_{\boldsymbol{u}}H=\boldsymbol{0}.

Complete LGR Costate Mapping Theorem

Computational Algorithm

After solving the LGR NLP:

  1. Extract the multipliers associated with the collocation constraints:

Λ1:N.\boldsymbol{\Lambda}_{1:N}.
  1. Form the diagonal weight matrix:

W=diag(w1,,wN).\boldsymbol{W} = \operatorname{diag}(w_1,\ldots,w_N).
  1. Compute the costates at the LGR points:

λ1:N=W1Λ1:N.\boldsymbol{\lambda}_{1:N} = \boldsymbol{W}^{-1}\boldsymbol{\Lambda}_{1:N}.
  1. Extract the final differentiation-matrix column:

dN+1=D(:,N+1).\boldsymbol{d}_{N+1} = \boldsymbol{D}(:,N+1).
  1. Compute the terminal costate:

λN+1=dN+1TΛ1:N.\boldsymbol{\lambda}_{N+1} = \boldsymbol{d}_{N+1}^{\mathsf{T}}\boldsymbol{\Lambda}_{1:N}.
  1. Compare

λ1andμ\boldsymbol{\lambda}_1 \quad\text{and}\quad \boldsymbol{\mu}

as an endpoint-consistency check.

  1. Check the discrete adjoint residual:

Dλ1:N+Xλ1:N,F1:N.\boldsymbol{D}^\dagger\boldsymbol{\lambda}_{1:N} + \nabla_{\boldsymbol{X}} \left\langle \boldsymbol{\lambda}_{1:N}, \boldsymbol{F}_{1:N} \right\rangle.
  1. Verify convergence under polynomial-order or mesh refinement.

Comparison with the LG Costate Mapping

FeatureLG methodLGR method
Collocation pointsInterior Gauss pointsIncludes one endpoint
Initial pointNoncollocated interpolation pointCollocation point
Final pointNoncollocated and recovered by quadratureNoncollocated state variable
Terminal quadrature constraintRequiredNot required
Interior costate mappingW1Λ+1ΛN+1\boldsymbol{W}^{-1}\boldsymbol{\Lambda}+\boldsymbol{1}\boldsymbol{\Lambda}_{N+1}W1Λ\boldsymbol{W}^{-1}\boldsymbol{\Lambda}
Terminal costateTerminal quadrature multiplierFinal column of D\boldsymbol{D} times collocation multipliers
Algebraic complexityHigherLower

Comparison of LG and LGR costate estimation.

Sign Conventions

The formulas above assume the collocation constraints are written as

FDX=0.\boldsymbol{F}-\boldsymbol{D}\boldsymbol{X}=\boldsymbol{0}.

If they are instead written as

DXF=0,\boldsymbol{D}\boldsymbol{X}-\boldsymbol{F}=\boldsymbol{0},

the reported KKT multipliers may have the opposite sign. Therefore, the implementation must be consistent with the exact NLP constraint convention.

Scaling and Multiplier Accuracy

Accurate primal states do not automatically guarantee accurate dual variables.

Potential sources of poor multiplier accuracy include:

A reliable implementation should check both primal and dual convergence.

Interpretation of the Costate

The costate can be interpreted as a sensitivity of the optimal value to perturbations of the state. In the LGR transcription, the mapped KKT multipliers provide a discrete approximation of this sensitivity along the trajectory.

Costate estimates are useful for:

Summary

  1. The LGR state polynomial uses the NN LGR points and the final interpolation point.

  2. The LGR NLP contains collocation constraints and an initial-condition constraint.

  3. No terminal quadrature constraint is required.

  4. The KKT multipliers of the collocation equations are scaled by the inverse Radau weights.

  5. The interior costate mapping is

λ1:N=W1Λ1:N.\boldsymbol{\lambda}_{1:N} = \boldsymbol{W}^{-1}\boldsymbol{\Lambda}_{1:N}.
  1. The terminal costate is recovered from

λN+1=dN+1TΛ1:N.\boldsymbol{\lambda}_{N+1} = \boldsymbol{d}_{N+1}^{\mathsf{T}}\boldsymbol{\Lambda}_{1:N}.
  1. The initial costate estimate satisfies

λ1μ.\boldsymbol{\lambda}_1\approx\boldsymbol{\mu}.
  1. The transformed KKT equations reproduce the continuous adjoint and control-stationarity conditions in discrete form.

Connection. Completing the LGL case makes it possible to compare all three Legendre schemes and then restore the full Bolza, endpoint, and path-constraint terms.