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.

Collocation and Defect Constraints

A defect measures disagreement between discrete state variables and the state change predicted by the dynamics. Zero defect means local dynamic consistency under the chosen approximation.

Euler, trapezoidal, and Hermite-Simpson collocation arrangements across a mesh interval.

Higher-order schemes use more information within each interval.

Euler forward

ζkEF=xk+1xkhkfk=0.\boldsymbol{\zeta}_k^{\mathrm{EF}}= \mathbf{x}_{k+1}-\mathbf{x}_k-h_k\mathbf{f}_k=\mathbf{0}.

Euler forward is globally first order and typically needs a fine mesh.

Trapezoidal rule

ζkTR=xk+1xkhk2(fk+fk+1)=0.\boldsymbol{\zeta}_k^{\mathrm{TR}}= \mathbf{x}_{k+1}-\mathbf{x}_k-\frac{h_k}{2}(\mathbf{f}_k+\mathbf{f}_{k+1})=\mathbf{0}.

It is globally second order and implicit. Implicitness is natural in transcription because the NLP solver determines states and defects together.

Hermite–Simpson

Define

xk+1/2=xk+xk+12+hk8(fkfk+1),uk+1/2=uk+uk+12.\mathbf{x}_{k+1/2}=\frac{\mathbf{x}_k+\mathbf{x}_{k+1}}{2} +\frac{h_k}{8}(\mathbf{f}_k-\mathbf{f}_{k+1}), \qquad \mathbf{u}_{k+1/2}=\frac{\mathbf{u}_k+\mathbf{u}_{k+1}}{2}.

Then

ζkHS=xk+1xkhk6(fk+4fk+1/2+fk+1)=0.\boldsymbol{\zeta}_k^{\mathrm{HS}}= \mathbf{x}_{k+1}-\mathbf{x}_k- \frac{h_k}{6}(\mathbf{f}_k+4\mathbf{f}_{k+1/2}+\mathbf{f}_{k+1})=\mathbf{0}.

Hermite–Simpson offers high accuracy, local sparsity, and moderate implementation complexity.

Zero-order-hold and higher-order single-step defects

For linear time-invariant dynamics x˙=Ax+Bu\dot{\mathbf{x}}=A\mathbf{x}+B\mathbf{u} with piecewise-constant control on an interval, the defect can be made exact rather than approximate using the matrix exponential:

ζkZOH=xk+1eAhkxk(0hkeA(hkτ)dτ)Buk=0.\boldsymbol{\zeta}_k^{\mathrm{ZOH}}= \mathbf{x}_{k+1}-e^{Ah_k}\mathbf{x}_k- \left(\int_0^{h_k}e^{A(h_k-\tau)}\,d\tau\right)B\mathbf{u}_k=\mathbf{0}.

This zero-order-hold defect introduces no truncation error for the assumed control interpolation, at the cost of a matrix exponential per interval and the loss of exactness once the dynamics become nonlinear or plant-parameter-dependent. Runge–Kutta families such as the classical fourth-order method extend the single-step idea to nonlinear dynamics by combining several interior stage evaluations per interval, trading additional function evaluations for higher order than Euler forward or the trapezoidal rule.

Pseudospectral collocation and the differentiation matrix

Pseudospectral methods approximate the state on an interval with a single global Lagrange interpolating polynomial through NN collocation points and enforce the dynamics at those points using a differentiation matrix DD, where differentiating the interpolant and evaluating at the collocation points gives x˙(τk)jDkjxj\dot{\mathbf{x}}(\tau_k)\approx\sum_jD_{kj}\mathbf{x}_j. Three families of collocation points are in common use, each built from roots of Legendre polynomials: Legendre–Gauss (LG) points (both endpoints excluded), Legendre–Gauss–Radau (LGR) points (one endpoint included), and Legendre–Gauss–Lobatto (LGL) points (both endpoints included).

The three schemes are not merely cosmetic variations. The LG and LGR differentiation matrices are rectangular and full rank, so the collocated dynamics DX=FD\mathbf{X}=\mathbf{F} can be rewritten equivalently in an integral form using a corresponding integration matrix — the differential and integral transcriptions agree exactly. The LGL differentiation matrix, in contrast, is square but singular.

This rank deficiency is not just a numerical curiosity: it propagates into the discrete costate (adjoint) system obtained from the Karush–Kuhn–Tucker conditions of the collocated NLP. Because the transformed adjoint systems for LG and LGR collocation inherit the full-rank differentiation matrix, they are themselves full rank and determine a unique discrete costate. The LGL transformed adjoint system inherits the singular differentiation matrix, so its costate equations possess a nontrivial null space; the recovered LGL costate approximation can oscillate around the true continuous costate even while the state and control trajectories converge normally. This defect is specific to LGL collocation — it does not occur with LG or LGR — and has been demonstrated by direct comparison against a known analytic costate on a benchmark problem.

They can converge very rapidly for smooth trajectories but need multiple intervals or adaptation near discontinuities, and production transcription software typically varies both the number of intervals and the polynomial degree per interval to reach a target accuracy (see the next section).

FeatureLocal collocationGlobal/pseudospectral
ApproximationLow order per intervalHigh order over large intervals
SparsityStrong local bandsDenser within each polynomial interval
Smooth solutionsAlgebraic mesh convergencePotentially spectral convergence
Nonsmooth solutionsLocal refinementMultiple intervals or adaptation
ImplementationRelatively directSpecialized matrices and quadrature