Every closed form we have prized — the
Indirect methods take the maximum principle at its word. First you derive the exact
optimality conditions by hand — the Hamiltonian, the costate equation, the stationarity condition —
which assemble into a two-point boundary-value problem (TPBVP): the state
Only then do you reach for a computer, to solve that boundary problem numerically. The classic tool is shooting:
Because you optimise on paper before discretising, the slogan is “optimise then
discretise.” The reward is high accuracy from the exact conditions; the catch is that
the costate is invisible and unintuitive, the Hamiltonian must be derived afresh for every problem,
and the integration is exquisitely sensitive to the initial guess — a small error in
Direct methods reverse the order. They never derive a costate at all. Instead they chop the trajectory into a finite set of nodes, replace the continuous problem with a large but ordinary nonlinear program (NLP) in those node variables, and hand the whole thing to an off-the-shelf optimiser — hence “discretise then optimise.” Three styles dominate:
In every case the continuous problem becomes
where the vector
There is a third route we have already met: grid the state space and solve HJB / dynamic programming
directly. It returns the global optimal feedback over the whole space — but it falls to the
curse of dimensionality. A grid of
Direct NLP methods scale far more gently: their cost grows with the number of nodes along one trajectory, not with the volume of the whole state space, and modern sparse NLP solvers exploit the banded structure of the constraints. That is why, for high-dimensional problems — legged robots, spacecraft, full vehicle models — direct collocation and multiple shooting are the workhorses, while grid-based HJB is reserved for low-dimensional problems where a global feedback law is worth the price.
Below is the heart of a direct method. The smooth curve is the true optimal trajectory
A direct-transcription solution is not the true optimal trajectory — it is an approximation built on whatever nodes you chose, and its accuracy lives or dies by the mesh. Too coarse a grid can miss a sharp corner in the optimal control (a bang-bang switch), smear out a fast transient, or settle on a set of node values that looks perfectly optimal at the nodes while the true continuous trajectory does something quite different in between them. This is exactly the resolution trade-off you meet discretising a PDE by finite differences: too few grid points and the numerical scheme simply cannot represent the features the true solution has, no matter how well the optimiser converges on the mesh it was given. The remedy is the same instinct — refine the mesh (or concentrate nodes where the trajectory bends sharply) and check that the answer stops changing as you do.
Numerical optimal control is no longer an academic afterthought — it is shipped software. Direct collocation packages plan the trajectories of Mars landers and re-entry vehicles, and the same transcription-into-an-NLP idea, solved fast enough to run in a loop, is what lets a humanoid robot plan each footstep in real time. The pattern that began with Pontryagin's hand-derived conditions and Bellman's grids has become, in its computational form, a general-purpose engine: write down a model, a cost and the constraints, discretise, and let a sparse NLP solver find the optimal motion.