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 Method

This section begins the derivation of costate estimates from the dual variables of a Legendre–Gauss (LG) pseudospectral nonlinear programming problem. The central task is to connect the continuous-time first-order optimality conditions with the Karush–Kuhn–Tucker conditions of the discretized nonlinear program.

The chapter develops:

Simplified Mayer Optimal-Control Problem

Consider

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.

No Lagrange running cost is included, so 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-Time Optimality Conditions

The first-order necessary conditions are:

Terminal Transversality

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

Costate Equation

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

Stationarity with Respect to Control

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

The objective is to recover approximations of λ(τ)\boldsymbol{\lambda}(\tau) from the KKT multipliers of the LG transcription.

LG Grid and State Approximation

Let

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

be the LG points, with

1<τ1<<τN<1.-1<\tau_1<\cdots<\tau_N<1.

Define

τ0=1,τN+1=1.\tau_0=-1, \qquad \tau_{N+1}=1.

Approximate the state as

X(τ)=i=0NXiLi(τ),\boldsymbol{X}(\tau) = \sum_{i=0}^{N}\boldsymbol{X}_iL_i(\tau),

where

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

Differentiation gives

X˙(τ)=i=0NXiLi(τ).\dot{\boldsymbol{X}}(\tau) = \sum_{i=0}^{N}\boldsymbol{X}_iL_i'(\tau).

LG Differentiation Matrix

Define

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

Thus,

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

The collocation equations are

DX0:N=F1:N,\boxed{ \boldsymbol{D}\boldsymbol{X}_{0:N} = \boldsymbol{F}_{1:N}, }

where

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

The terminal state is estimated by LG quadrature:

XN+1=X0+wTF1:N.\boxed{ \boldsymbol{X}_{N+1} = \boldsymbol{X}_0+\boldsymbol{w}^{\mathsf{T}}\boldsymbol{F}_{1:N}. }

The LG Nonlinear Program

The discretized NLP is

minX,UΦ(XN+1)subject toF1:NDX0:N=0,wTF1:N+X0XN+1=0,X0x0=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}_{0:N} = \boldsymbol{0}, \\ & \boldsymbol{w}^{\mathsf{T}}\boldsymbol{F}_{1:N} +\boldsymbol{X}_0-\boldsymbol{X}_{N+1} = \boldsymbol{0}, \\ & \boldsymbol{X}_0-\boldsymbol{x}_0 = \boldsymbol{0}. \end{aligned} }

Because X0\boldsymbol{X}_0 is fixed, it may be removed from the optimization vector after substitution.

KKT Multipliers

Let

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

denote the multipliers associated with the collocation equations.

Let

ΛN+1\boldsymbol{\Lambda}_{N+1}

denote the multiplier associated with the terminal quadrature equation.

These are NLP multipliers, not yet costate estimates.

NLP Lagrangian

Define

L=Φ(XN+1)+Λ1:N,F1:NDX0:N+ΛN+1,wTF1:N+X0XN+1.\begin{aligned} \mathcal{L} ={}& \Phi(\boldsymbol{X}_{N+1}) + \left\langle \boldsymbol{\Lambda}_{1:N}, \boldsymbol{F}_{1:N}-\boldsymbol{D}\boldsymbol{X}_{0:N} \right\rangle \nonumber\\ &+ \left\langle \boldsymbol{\Lambda}_{N+1}, \boldsymbol{w}^{\mathsf{T}}\boldsymbol{F}_{1:N} +\boldsymbol{X}_0-\boldsymbol{X}_{N+1} \right\rangle. \end{aligned}

The angle brackets denote the appropriate Euclidean or Frobenius inner product.

Stationarity Conditions of the NLP

Differentiation with respect to the discrete state variables at the LG points yields

D1:NTΛ1:N=XΛ1:N+W1ΛN+1,F1:N.\boxed{ \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. }

Here,

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

Differentiation with respect to the terminal state gives

ΛN+1=XΦ(XN+1).\boxed{ \boldsymbol{\Lambda}_{N+1} = \nabla_{\boldsymbol{X}} \Phi(\boldsymbol{X}_{N+1}). }

Differentiation with respect to the controls gives

0=UW1Λ1:N+1ΛN+1,F1:N.\boxed{ \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. }

These equations already resemble the continuous costate, transversality, and stationarity conditions.

Why a Second Polynomial Space Is Needed

The state approximation uses

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

that is, the initial point plus the LG points.

The costate approximation must instead use

τ1,,τN,τN+1,\tau_1,\ldots,\tau_N,\tau_{N+1},

that is, the LG points plus the final point.

This shift is essential because the terminal costate is specified by the transversality condition.

Costate Approximation

Approximate the costate by

Λ(τ)=i=1N+1λiLi(τ),\boxed{ \boldsymbol{\Lambda}(\tau) = \sum_{i=1}^{N+1} \boldsymbol{\lambda}_i L_i^\dagger(\tau), }

where

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

This is a polynomial of degree NN.

Its derivative is

Λ˙(τ)=i=1N+1λi(Li)(τ).\dot{\boldsymbol{\Lambda}}(\tau) = \sum_{i=1}^{N+1} \boldsymbol{\lambda}_i \left(L_i^\dagger\right)'(\tau).

Adjoint Differentiation Matrix

Define

Dji=(Li)(τj),j=1,,N,i=1,,N+1.D^\dagger_{ji} = \left(L_i^\dagger\right)'(\tau_j), \qquad j=1,\ldots,N, \qquad i=1,\ldots,N+1.

Then

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

Partition it as

D=[D1:NdN+1].\boldsymbol{D}^\dagger = \begin{bmatrix} \boldsymbol{D}^\dagger_{1:N} & \boldsymbol{d}^\dagger_{N+1} \end{bmatrix}.

Relationship Between the State and Costate Differentiation Matrices

The crucial weighted transpose relation is

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

Equivalently,

D1:N=W1D1:NTW.\boxed{ \boldsymbol{D}^\dagger_{1:N} = - \boldsymbol{W}^{-1} \boldsymbol{D}_{1:N}^{\mathsf{T}} \boldsymbol{W}. }

This identity provides the bridge between the KKT system and the discrete costate equation.

Derivative of a Constant

Because a differentiation matrix must annihilate a constant polynomial,

D1N+1=0.\boldsymbol{D}^\dagger\boldsymbol{1}_{N+1} = \boldsymbol{0}.

Therefore,

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

and

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

This relation is needed to incorporate the terminal costate into the discrete adjoint equation.

Preview of the Costate Mapping

Define the interior costate estimate by

λ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}. }

Define the terminal costate by

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

Substitution into the KKT equations produces a discrete analogue of

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

The detailed transformation is developed in Session 22B.

Summary

  1. The continuous costate equation follows from the Hamiltonian.

  2. The LG transcription produces collocation and terminal quadrature constraints.

  3. Each constraint has an associated KKT multiplier.

  4. The NLP Lagrangian yields discrete stationarity conditions.

  5. The state and costate use different Lagrange polynomial bases.

  6. The costate basis uses the LG points plus the final point.

  7. The weighted transpose relation between D\boldsymbol{D} and D\boldsymbol{D}^\dagger is the key algebraic identity.

  8. These results prepare the costate mapping theorem.

Connection. The LG KKT equations provide the raw multiplier relations; the next step completes their transformation into endpoint and interior costate estimates.