Direct Methods (for Trajectory Optimization)
Author: Tianjiang Shuo
Website: https://cislunarspace.cn
Definition
Direct methods are a broad class of numerical methods for trajectory optimization: the state and control of an infinite-dimensional optimal control problem are simultaneously parametrized on a discrete mesh, the dynamics are replaced by a set of algebraic constraints, and together with boundary conditions, path constraints and the performance index they form a finite-dimensional nonlinear program (NLP). A general NLP solver — SQP or interior-point — then adjusts the parameters (Betts 1998; Conway 2010).
In contrast, indirect methods first derive the Pontryagin maximum principle analytically, yielding a two-point boundary-value problem (TPBVP) in costate variables, which is then solved numerically. Direct methods skip the costate equations. Both routes converge to KKT conditions, so as the mesh is refined, the Lagrange multipliers of the direct-method NLP converge (under a known linear map) to the continuous costate (Hager 1976; Benson 2005).
Standard transcription
A continuous Bolza-form optimal control problem,
subject to , boundary conditions , and path constraints , is discretized as
\mathbf{X}=\{\mathbf{x}_0,\mathbf{u}_0,\dots,\mathbf{x}_M,\mathbf{u}_M\},\quad \n \mathbf{c}(\mathbf{X})=\begin{bmatrix}\boldsymbol{\zeta}_0\\\boldsymbol{\zeta}_1\\\vdots\\\boldsymbol{\zeta}_{M-1}\\\boldsymbol{\psi}\end{bmatrix}\approx \mathbf{0},
where are defect constraints that approximately enforce the dynamics. The NLP solved is
The differences between direct-method branches lie in how the are constructed.
Branches
- Direct shooting. Only a small set of control parameters (e.g. polynomial coefficients of pitch angle) are NLP variables; the dynamics are integrated forward with an ODE solver and the terminal state appears as a nonlinear constraint. Few variables, but errors accumulate exponentially along the trajectory and the Jacobian is highly nonlinear in early parameters. Early launch-vehicle codes such as POST and GTS fall here (Betts 1998).
- Multiple shooting. The interval is split into segments integrated independently, with state-continuity constraints at segment boundaries. Mitigates error growth at the cost of more variables.
- Direct collocation. Low-degree piecewise polynomials (trapezoidal, Hermite-Simpson, fifth-order Gauss-Lobatto) interpolate the state on each sub-interval; dynamics enforced at collocation points yields sparse, block-tridiagonal defect constraints. See Direct Collocation.
- Pseudospectral (spectral collocation). A single high-order global Lagrange polynomial approximates the state; collocation nodes are Legendre-Gauss / Gauss-Radau / Gauss-Lobatto. Spectral (exponential) convergence for smooth solutions. See Pseudospectral Method.
- Sequential convex programming (SCP). Linearize the nonconvex dynamics at a reference trajectory, add a trust region, and solve a sequence of second-order cone programs (SOCP). Polynomial-time interior-point solves each subproblem with a deterministic stopping criterion — enables real-time / on-board use. See Sequential Convex Programming.
- Discrete mechanics and optimal control (DMOC). Discretize the variational principle (Lagrange-d'Alembert) rather than the ODE; constraints are the discrete Euler-Lagrange equations. Symplectic and momentum-preserving. See DMOC.
NLP solvers
- SNOPT — sparse SQP for large, sparse problems with thousands to millions of variables (Gill et al. 2002).
- Ipopt — open-source primal-dual interior-point method, robust on large nonconvex NLPs (Wächter & Biegler 2006).
- CasADi — symbolic framework with automatic differentiation; commonly used as a front-end to the above.
Pseudospectral workflows often use specialized front-ends — GPOPS-II (Patterson & Rao 2014), DIDO (Ross), SOCS (Betts), OTIS (Hargraves & Paris) — that generate the NLP internally.
KKT–costate correspondence
The theoretical appeal of direct methods is the covector mapping: as the collocation mesh refines, the NLP's KKT multipliers converge (under a known linear transformation) to the continuous costate of the original OCP (Hager 1976; Benson 2005; Elnagar 1995). Consequences:
- One can read out a costate time history from a direct solution and check whether the Hamiltonian is conserved — a built-in accuracy test.
- Direct-method costates seed indirect methods, enabling direct-indirect hybrid solves.
The mapping is cleanest for pseudospectral collocation at orthogonal nodes — the covector mapping theorem (Benson, Huntington, Rao 2006) — which is one reason for pseudospectral methods' popularity in practice.
Practical advantages over indirect methods
- No analytic costate derivation. For high-fidelity cislunar dynamics (CR3BP, ephemeris + third-body + solar-radiation pressure + oblateness), deriving the adjoint equations by hand is prohibitive. Direct methods delegate this to the NLP solver's finite-difference or automatic-differentiation machinery.
- Wide convergence basin. Indirect methods are notoriously sensitive to initial costate guesses; direct methods are far more forgiving of initial state/control guesses.
- Path constraints are easy. Bounds, glideslope cones, obstacle avoidance enter the NLP directly, without pre-specifying the constrained/unconstrained arc structure (Betts 1998).
The price: NLP size grows as (typical collocation –, pseudospectral – per phase), only local minima are obtained — no global optimality guarantee. Low-thrust, multi-revolution, long-duration problems still need a good initial guess (shape-based, manifold stitching, reinforcement learning) to converge to a meaningful optimum.
Related concepts
- Indirect Methods
- Pontryagin's Maximum Principle
- Two-Point Boundary-Value Problem (TPBVP)
- Direct Collocation
- Pseudospectral Method
- Sequential Convex Programming (SCP)
- DMOC
- Costate Variable
- Homotopy Method
References
- Betts, J. T. (1998). Survey of numerical methods for trajectory optimization. J. Guidance, Control, and Dynamics, 21(2), 193–207.
- Conway, B. A. (Ed.). (2010). Spacecraft Trajectory Optimization. Cambridge University Press.
- Betts, J. T. (2010). Practical Methods for Optimal Control and Estimation Using Nonlinear Programming (2nd ed.). SIAM.
- Hager, W. W. (1976). The Ritz-Trefftz method for state and control constrained optimal control problems. SIAM J. Numer. Anal.
- Benson, D. A. (2005). A Gauss pseudospectral transcription for optimal control. PhD thesis, MIT.
- Gill, P. E., Murray, W., & Saunders, M. A. (2002). SNOPT: an SQP algorithm for large-scale constrained optimization. SIAM J. Optimization, 12(4), 979–1006.
- Wächter, A., & Biegler, L. T. (2006). On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming. Mathematical Programming, 106(1), 25–57.
- Patterson, M. A., & Rao, A. V. (2014). GPOPS-II. ACM Trans. Math. Softw., 41(1), 1:1–1:37.
