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 Mapping and Recovery of Continuous Costates

This section completes the LG costate-estimation derivation. It transforms the KKT multipliers of the pseudospectral nonlinear program into estimates of the continuous costate at the LG points and both endpoints.

The principal results are:

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

and

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

Starting KKT System

The LG KKT conditions are

D1:NTΛ1:N=XΛ1:N+W1ΛN+1,F1:N,\boldsymbol{D}_{1:N}^{\mathsf{T}} \boldsymbol{\Lambda}_{1:N} = \nabla_{\boldsymbol{X}} \left\langle \boldsymbol{\Lambda}_{1:N} + \boldsymbol{W}\boldsymbol{1}\boldsymbol{\Lambda}_{N+1}, \boldsymbol{F}_{1:N} \right\rangle,
ΛN+1=XΦ(XN+1),\boldsymbol{\Lambda}_{N+1} = \nabla_{\boldsymbol{X}}\Phi(\boldsymbol{X}_{N+1}),

and

0=UW1Λ1:N+1ΛN+1,F1:N.\boldsymbol{0} = \nabla_{\boldsymbol{U}} \left\langle \boldsymbol{W}^{-1}\boldsymbol{\Lambda}_{1:N} + \boldsymbol{1}\boldsymbol{\Lambda}_{N+1}, \boldsymbol{F}_{1:N} \right\rangle.

Weighted Transpose Identity

Use

D1:NT=WD1:NW1.\boldsymbol{D}_{1:N}^{\mathsf{T}} = - \boldsymbol{W} \boldsymbol{D}^\dagger_{1:N} \boldsymbol{W}^{-1}.

Substitution into the first KKT condition gives

WD1:NW1Λ1:N=XΛ1:N+W1ΛN+1,F1:N.- \boldsymbol{W} \boldsymbol{D}^\dagger_{1:N} \boldsymbol{W}^{-1} \boldsymbol{\Lambda}_{1:N} = \nabla_{\boldsymbol{X}} \left\langle \boldsymbol{\Lambda}_{1:N} + \boldsymbol{W}\boldsymbol{1}\boldsymbol{\Lambda}_{N+1}, \boldsymbol{F}_{1:N} \right\rangle.

Premultiplying by W1\boldsymbol{W}^{-1} yields

D1:NW1Λ1:N=XW1Λ1:N+1ΛN+1,F1:N.- \boldsymbol{D}^\dagger_{1:N} \boldsymbol{W}^{-1} \boldsymbol{\Lambda}_{1:N} = \nabla_{\boldsymbol{X}} \left\langle \boldsymbol{W}^{-1}\boldsymbol{\Lambda}_{1:N} + \boldsymbol{1}\boldsymbol{\Lambda}_{N+1}, \boldsymbol{F}_{1:N} \right\rangle.

Interior Costate Mapping

Define

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

Therefore,

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

Substituting,

D1:N(λ1:N1ΛN+1)=Xλ1:N,F1:N.- \boldsymbol{D}^\dagger_{1:N} \left( \boldsymbol{\lambda}_{1:N} - \boldsymbol{1}\boldsymbol{\Lambda}_{N+1} \right) = \nabla_{\boldsymbol{X}} \left\langle \boldsymbol{\lambda}_{1:N}, \boldsymbol{F}_{1:N} \right\rangle.

Expanding,

D1:Nλ1:N+D1:N1ΛN+1=Xλ1:N,F1:N.- \boldsymbol{D}^\dagger_{1:N}\boldsymbol{\lambda}_{1:N} + \boldsymbol{D}^\dagger_{1:N}\boldsymbol{1}\boldsymbol{\Lambda}_{N+1} = \nabla_{\boldsymbol{X}} \left\langle \boldsymbol{\lambda}_{1:N}, \boldsymbol{F}_{1:N} \right\rangle.

Terminal Costate Mapping

Define

λN+1=ΛN+1.\boxed{ \boldsymbol{\lambda}_{N+1} = \boldsymbol{\Lambda}_{N+1}. }

This agrees immediately with the continuous terminal condition:

λN+1=XΦ(XN+1).\boldsymbol{\lambda}_{N+1} = \nabla_{\boldsymbol{X}}\Phi(\boldsymbol{X}_{N+1}).

Using

dN+1=D1:N1,\boldsymbol{d}^\dagger_{N+1} = - \boldsymbol{D}^\dagger_{1:N}\boldsymbol{1},

the adjoint equation becomes

D1:Nλ1:N+dN+1λN+1=Xλ1:N,F1:N.\boxed{ \boldsymbol{D}^\dagger_{1:N}\boldsymbol{\lambda}_{1:N} + \boldsymbol{d}^\dagger_{N+1}\boldsymbol{\lambda}_{N+1} = - \nabla_{\boldsymbol{X}} \left\langle \boldsymbol{\lambda}_{1:N}, \boldsymbol{F}_{1:N} \right\rangle. }

Equivalently,

Dλ1:N+1=Xλ1:N,F1:N.\boxed{ \boldsymbol{D}^\dagger\boldsymbol{\lambda}_{1:N+1} = - \nabla_{\boldsymbol{X}} \left\langle \boldsymbol{\lambda}_{1:N}, \boldsymbol{F}_{1:N} \right\rangle. }

This is the discrete costate equation.

Comparison with the Continuous Costate Equation

The continuous equation is

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

The discrete LG equation is

Dλ1:N+1=Xλ1:N,F1:N.\boldsymbol{D}^\dagger\boldsymbol{\lambda}_{1:N+1} = - \nabla_{\boldsymbol{X}} \left\langle \boldsymbol{\lambda}_{1:N}, \boldsymbol{F}_{1:N} \right\rangle.

Thus, Dλ\boldsymbol{D}^\dagger\boldsymbol{\lambda} approximates the derivative of the costate polynomial at the LG points.

Discrete Control Stationarity

The control KKT condition becomes

0=Uλ1:N,F1:N.\boxed{ \boldsymbol{0} = \nabla_{\boldsymbol{U}} \left\langle \boldsymbol{\lambda}_{1:N}, \boldsymbol{F}_{1:N} \right\rangle. }

This is the discrete equivalent of

uH(x,u,λ)=0.\nabla_{\boldsymbol{u}}H(\boldsymbol{x},\boldsymbol{u},\boldsymbol{\lambda})=\boldsymbol{0}.

Recovery of the Initial Costate

The costate dynamics satisfy

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

Therefore,

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

Using LG quadrature,

λ0λN+1wTDλ1:N+1.\boldsymbol{\lambda}_0 \approx \boldsymbol{\lambda}_{N+1} - \boldsymbol{w}^{\mathsf{T}} \boldsymbol{D}^\dagger\boldsymbol{\lambda}_{1:N+1}.

Using the relation between D\boldsymbol{D}^\dagger and the original state differentiation matrix, this reduces to

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

where d0\boldsymbol{d}_0 is the first column of the original LG differentiation matrix.

Complete LG Costate Mapping Theorem

Interpretation of the Mapping

The collocation multipliers alone are not the costates.

Two corrections are required:

  1. scaling by the inverse quadrature weights;

  2. addition of the terminal quadrature multiplier.

The terminal multiplier appears because the LG state approximation does not contain the terminal point, and the final state is imposed through an integral constraint.

Implementation Algorithm

  1. Solve the LG pseudospectral NLP.

  2. Extract the multipliers Λ1:N\boldsymbol{\Lambda}_{1:N} associated with the collocation equations.

  3. Extract ΛN+1\boldsymbol{\Lambda}_{N+1} associated with the terminal quadrature equation.

  4. Form

λN+1=ΛN+1.\boldsymbol{\lambda}_{N+1}=\boldsymbol{\Lambda}_{N+1}.
  1. Compute

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

λ0=λN+1d0TΛ1:N.\boldsymbol{\lambda}_0 = \boldsymbol{\lambda}_{N+1} - \boldsymbol{d}_0^{\mathsf{T}}\boldsymbol{\Lambda}_{1:N}.
  1. Compare the resulting costate with analytical or indirect-solution results when available.

Practical Issues

Constraint Ordering

The NLP solver returns multipliers in the same ordering as the constraints. The software implementation must preserve a clear map from each multiplier block to its corresponding collocation or quadrature constraint.

Sign Conventions

Different solvers use different conventions for equality-constraint multipliers. A sign reversal may be required if the NLP is written as

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

instead of

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

Scaling

Poor state or constraint scaling can degrade multiplier accuracy even when the primal solution is accurate.

Mesh Refinement

Costate estimates should be checked under mesh or polynomial-order refinement. Smooth convergence is an important validation test.

Why Costate Estimation Matters

Costates provide:

Summary

  1. KKT multipliers from the LG NLP can be mapped to continuous costate estimates.

  2. The terminal costate equals the terminal quadrature multiplier.

  3. Interior costates require quadrature-weight scaling and a terminal correction.

  4. The resulting discrete adjoint equation matches the continuous costate equation.

  5. The initial costate follows from quadrature of the discrete adjoint dynamics.

  6. The mapping is computationally inexpensive once the NLP has been solved.

Connection. The same continuous–discrete comparison can be repeated on the Radau grid, where the included initial endpoint changes the mapping structure.