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},
} λ N + 1 = Λ N + 1 , λ 1 : N = W − 1 Λ 1 : N + 1 Λ N + 1 , \boxed{
\boldsymbol{\lambda}_{1:N}
=
\boldsymbol{W}^{-1}\boldsymbol{\Lambda}_{1:N}
+
\boldsymbol{1}\,\boldsymbol{\Lambda}_{N+1},
} λ 1 : N = W − 1 Λ 1 : N + 1 Λ N + 1 , and
λ 0 = λ N + 1 − d 0 T Λ 1 : N . \boxed{
\boldsymbol{\lambda}_0
=
\boldsymbol{\lambda}_{N+1}
-
\boldsymbol{d}_0^{\mathsf{T}}\boldsymbol{\Lambda}_{1:N}.
} λ 0 = λ N + 1 − d 0 T Λ 1 : N . Starting KKT System ¶ The LG KKT conditions are
D 1 : N T Λ 1 : N = ∇ X ⟨ Λ 1 : N + W 1 Λ N + 1 , F 1 : 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, D 1 : N T Λ 1 : N = ∇ X ⟨ Λ 1 : N + W 1 Λ N + 1 , F 1 : N ⟩ , Λ N + 1 = ∇ X Φ ( X N + 1 ) , \boldsymbol{\Lambda}_{N+1}
=
\nabla_{\boldsymbol{X}}\Phi(\boldsymbol{X}_{N+1}), Λ N + 1 = ∇ X Φ ( X N + 1 ) , and
0 = ∇ U ⟨ W − 1 Λ 1 : N + 1 Λ N + 1 , F 1 : 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. 0 = ∇ U ⟨ W − 1 Λ 1 : N + 1 Λ N + 1 , F 1 : N ⟩ . Weighted Transpose Identity ¶ Use
D 1 : N T = − W D 1 : N † W − 1 . \boldsymbol{D}_{1:N}^{\mathsf{T}}
=
-
\boldsymbol{W}
\boldsymbol{D}^\dagger_{1:N}
\boldsymbol{W}^{-1}. D 1 : N T = − W D 1 : N † W − 1 . Substitution into the first KKT condition gives
− W D 1 : N † W − 1 Λ 1 : N = ∇ X ⟨ Λ 1 : N + W 1 Λ N + 1 , F 1 : 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. − W D 1 : N † W − 1 Λ 1 : N = ∇ X ⟨ Λ 1 : N + W 1 Λ N + 1 , F 1 : N ⟩ . Premultiplying by W − 1 \boldsymbol{W}^{-1} W − 1 yields
− D 1 : N † W − 1 Λ 1 : N = ∇ X ⟨ W − 1 Λ 1 : N + 1 Λ N + 1 , F 1 : 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. − D 1 : N † W − 1 Λ 1 : N = ∇ X ⟨ W − 1 Λ 1 : N + 1 Λ N + 1 , F 1 : N ⟩ . Interior Costate Mapping ¶ Define
λ 1 : N = W − 1 Λ 1 : N + 1 Λ N + 1 . \boxed{
\boldsymbol{\lambda}_{1:N}
=
\boldsymbol{W}^{-1}\boldsymbol{\Lambda}_{1:N}
+
\boldsymbol{1}\boldsymbol{\Lambda}_{N+1}.
} λ 1 : N = W − 1 Λ 1 : N + 1 Λ N + 1 . Therefore,
W − 1 Λ 1 : N = λ 1 : N − 1 Λ N + 1 . \boldsymbol{W}^{-1}\boldsymbol{\Lambda}_{1:N}
=
\boldsymbol{\lambda}_{1:N}
-
\boldsymbol{1}\boldsymbol{\Lambda}_{N+1}. W − 1 Λ 1 : N = λ 1 : N − 1 Λ N + 1 . Substituting,
− D 1 : N † ( λ 1 : N − 1 Λ N + 1 ) = ∇ X ⟨ λ 1 : N , F 1 : 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. − D 1 : N † ( λ 1 : N − 1 Λ N + 1 ) = ∇ X ⟨ λ 1 : N , F 1 : N ⟩ . Expanding,
− D 1 : N † λ 1 : N + D 1 : N † 1 Λ N + 1 = ∇ X ⟨ λ 1 : N , F 1 : 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. − D 1 : N † λ 1 : N + D 1 : N † 1 Λ N + 1 = ∇ X ⟨ λ 1 : N , F 1 : N ⟩ . Terminal Costate Mapping ¶ Define
λ N + 1 = Λ N + 1 . \boxed{
\boldsymbol{\lambda}_{N+1}
=
\boldsymbol{\Lambda}_{N+1}.
} λ N + 1 = Λ N + 1 . This agrees immediately with the continuous terminal condition:
λ N + 1 = ∇ X Φ ( X N + 1 ) . \boldsymbol{\lambda}_{N+1}
=
\nabla_{\boldsymbol{X}}\Phi(\boldsymbol{X}_{N+1}). λ N + 1 = ∇ X Φ ( X N + 1 ) . Using
d N + 1 † = − D 1 : N † 1 , \boldsymbol{d}^\dagger_{N+1}
=
-
\boldsymbol{D}^\dagger_{1:N}\boldsymbol{1}, d N + 1 † = − D 1 : N † 1 , the adjoint equation becomes
D 1 : N † λ 1 : N + d N + 1 † λ N + 1 = − ∇ X ⟨ λ 1 : N , F 1 : 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.
} D 1 : N † λ 1 : N + d N + 1 † λ N + 1 = − ∇ X ⟨ λ 1 : N , F 1 : N ⟩ . Equivalently,
D † λ 1 : N + 1 = − ∇ X ⟨ λ 1 : N , F 1 : 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.
} D † λ 1 : N + 1 = − ∇ X ⟨ λ 1 : N , F 1 : N ⟩ . This is the discrete costate equation.
Comparison with the Continuous Costate Equation ¶ The continuous equation is
λ ˙ ( τ ) = − ∇ x [ λ ( τ ) T f ( x ( τ ) , u ( τ ) ) ] . \dot{\boldsymbol{\lambda}}(\tau)
=
-
\nabla_{\boldsymbol{x}}
\left[
\boldsymbol{\lambda}(\tau)^{\mathsf{T}}
\boldsymbol{f}(\boldsymbol{x}(\tau),\boldsymbol{u}(\tau))
\right]. λ ˙ ( τ ) = − ∇ x [ λ ( τ ) T f ( x ( τ ) , u ( τ )) ] . The discrete LG equation is
D † λ 1 : N + 1 = − ∇ X ⟨ λ 1 : N , F 1 : N ⟩ . \boldsymbol{D}^\dagger\boldsymbol{\lambda}_{1:N+1}
=
-
\nabla_{\boldsymbol{X}}
\left\langle
\boldsymbol{\lambda}_{1:N},
\boldsymbol{F}_{1:N}
\right\rangle. D † λ 1 : N + 1 = − ∇ X ⟨ λ 1 : N , F 1 : N ⟩ . Thus, D † λ \boldsymbol{D}^\dagger\boldsymbol{\lambda} D † λ approximates the derivative of the costate polynomial at the LG points.
Discrete Control Stationarity ¶ The control KKT condition becomes
0 = ∇ U ⟨ λ 1 : N , F 1 : N ⟩ . \boxed{
\boldsymbol{0}
=
\nabla_{\boldsymbol{U}}
\left\langle
\boldsymbol{\lambda}_{1:N},
\boldsymbol{F}_{1:N}
\right\rangle.
} 0 = ∇ U ⟨ λ 1 : N , F 1 : N ⟩ . This is the discrete equivalent of
∇ u H ( x , u , λ ) = 0 . \nabla_{\boldsymbol{u}}H(\boldsymbol{x},\boldsymbol{u},\boldsymbol{\lambda})=\boldsymbol{0}. ∇ u H ( x , u , λ ) = 0 . Recovery of the Initial Costate ¶ The costate dynamics satisfy
λ ( 1 ) − λ ( − 1 ) = ∫ − 1 1 λ ˙ ( τ ) d τ . \boldsymbol{\lambda}(1)-\boldsymbol{\lambda}(-1)
=
\int_{-1}^{1}
\dot{\boldsymbol{\lambda}}(\tau)\,\mathrm{d}\tau. λ ( 1 ) − λ ( − 1 ) = ∫ − 1 1 λ ˙ ( τ ) d τ . Therefore,
λ ( − 1 ) = λ ( 1 ) − ∫ − 1 1 λ ˙ ( τ ) d τ . \boldsymbol{\lambda}(-1)
=
\boldsymbol{\lambda}(1)
-
\int_{-1}^{1}
\dot{\boldsymbol{\lambda}}(\tau)\,\mathrm{d}\tau. λ ( − 1 ) = λ ( 1 ) − ∫ − 1 1 λ ˙ ( τ ) d τ . Using LG quadrature,
λ 0 ≈ λ N + 1 − w T D † λ 1 : N + 1 . \boldsymbol{\lambda}_0
\approx
\boldsymbol{\lambda}_{N+1}
-
\boldsymbol{w}^{\mathsf{T}}
\boldsymbol{D}^\dagger\boldsymbol{\lambda}_{1:N+1}. λ 0 ≈ λ N + 1 − w T D † λ 1 : N + 1 . Using the relation between D † \boldsymbol{D}^\dagger D † and the original state differentiation matrix, this reduces to
λ 0 = λ N + 1 − d 0 T Λ 1 : N , \boxed{
\boldsymbol{\lambda}_0
=
\boldsymbol{\lambda}_{N+1}
-
\boldsymbol{d}_0^{\mathsf{T}}
\boldsymbol{\Lambda}_{1:N},
} λ 0 = λ N + 1 − d 0 T Λ 1 : N , where d 0 \boldsymbol{d}_0 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:
scaling by the inverse quadrature weights;
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 ¶ Solve the LG pseudospectral NLP.
Extract the multipliers Λ 1 : N \boldsymbol{\Lambda}_{1:N} Λ 1 : N associated with the collocation equations.
Extract Λ N + 1 \boldsymbol{\Lambda}_{N+1} Λ N + 1 associated with the terminal quadrature equation.
Form
λ N + 1 = Λ N + 1 . \boldsymbol{\lambda}_{N+1}=\boldsymbol{\Lambda}_{N+1}. λ N + 1 = Λ N + 1 . Compute
λ 1 : N = W − 1 Λ 1 : N + 1 λ N + 1 . \boldsymbol{\lambda}_{1:N}
=
\boldsymbol{W}^{-1}\boldsymbol{\Lambda}_{1:N}
+
\boldsymbol{1}\boldsymbol{\lambda}_{N+1}. λ 1 : N = W − 1 Λ 1 : N + 1 λ N + 1 . Compute
λ 0 = λ N + 1 − d 0 T Λ 1 : N . \boldsymbol{\lambda}_0
=
\boldsymbol{\lambda}_{N+1}
-
\boldsymbol{d}_0^{\mathsf{T}}\boldsymbol{\Lambda}_{1:N}. λ 0 = λ N + 1 − d 0 T Λ 1 : N . 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
D X − F = 0 \boldsymbol{D}\boldsymbol{X}-\boldsymbol{F}=\boldsymbol{0} D X − F = 0 instead of
F − D X = 0 . \boldsymbol{F}-\boldsymbol{D}\boldsymbol{X}=\boldsymbol{0}. F − D X = 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:
sensitivity information;
interpretation of active design tradeoffs;
necessary-condition verification;
information for switching-function analysis;
insight into state importance;
a bridge between direct and indirect methods.
Summary ¶ KKT multipliers from the LG NLP can be mapped to continuous costate estimates.
The terminal costate equals the terminal quadrature multiplier.
Interior costates require quadrature-weight scaling and a terminal correction.
The resulting discrete adjoint equation matches the continuous costate equation.
The initial costate follows from quadrature of the discrete adjoint dynamics.
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.