---
tag: T58W34D60G
kind: concept
name: Direct collocation
msc: [49M37, 49M25, 65L60]
sources:
  - url: https://en.wikipedia.org/wiki/Collocation_method
---

## Summary

Direct collocation is a method of [[trajectory optimization|58895A7T4H]] that turns an optimal control problem into a finite nonlinear program.
It represents the state and the control by their values on a time grid.
It imposes the differential equation only at chosen collocation points, through a polynomial model of the state on each interval.
The cost integral becomes a quadrature sum, and the resulting sparse nonlinear program is solved by a general optimiser.
It is "direct" because it discretises first and does not use the [[maximum principle|7RPV2T29CF]].

## Explanations

### L1 human

Instead of solving the equations of motion exactly, direct collocation draws the trajectory as a chain of short polynomial pieces through a few grid points.
It asks only that each piece obey the equations of motion at a few chosen times.
The grid values become the unknowns of an ordinary finite optimisation problem.
With the trapezoidal rule, for example, the condition on one step of length $h$ is $x_{k+1} - x_k = \frac{h}{2} (f_k + f_{k+1})$, where $f_k$ is the velocity at grid point $k$.
Constraints such as speed limits are easy to add, because they are just conditions on the grid values.
