Skip to content

What is optimal control?

Optimal control finds time-varying inputs that achieve the best objective while satisfying the required conditions. This page introduces each part of a problem through an example, then gives the general mathematical form.

Ordinary optimization might ask for the number xx that minimizes f(x)=(x−1)2f(x)=(x-1)^2. The answer is x=1x=1. Even with several variables, the unknown is still a finite set of numbers.

Optimal control instead asks for a function of time, u(t)u(t): how much to press the accelerator at every instant, for example. Each input also affects later states. Accelerating too hard now may require harder braking later. We must choose the entire input history while accounting for these effects through time.

Consider Example 02:

Move a cart from rest to a point 10 m away and stop there. Acceleration is limited to 2 m/s² in magnitude. How should acceleration change over time to arrive as soon as possible?

State: the current condition of the system

Section titled “State: the current condition of the system”

The state describes the system at a given time. Here it consists of position xx and velocity vv. Together they provide the starting point for predicting future motion. We collect states in a vector x(t)\boldsymbol{x}(t).

The control is the input we are free to choose at each instant: acceleration aa here. Its time history a(t)a(t) is what we seek. A vector of controls is written u(t)\boldsymbol{u}(t).

Differential equations describe how the state evolves:

x˙=v,v˙=a.\dot{x}=v,\qquad \dot{v}=a.

The dot denotes differentiation with respect to time, x˙=dx/dt\dot{x}=dx/dt. In general,

x˙(t)=f(x(t),u(t),t).\dot{\boldsymbol{x}}(t)=\boldsymbol{f}\bigl(\boldsymbol{x}(t),\boldsymbol{u}(t),t\bigr).

For a rocket, f\boldsymbol{f} includes thrust, drag, gravity, and propellant consumption. The dynamics are constraints that the solution must obey: an advantageous trajectory is unusable if it violates the physical model.

Boundary conditions specify the state at the endpoints:

x(0)=0,v(0)=0,x(tf)=10,v(tf)=0.x(0)=0,\quad v(0)=0,\qquad x(t_f)=10,\quad v(t_f)=0.

The final time tft_f is often unknown and determined as part of the solution, as in this example.

Path constraints must hold throughout the motion. Here,

−2≤a(t)≤2.-2\le a(t)\le 2.

Other examples include maximum thrust, acceleration below 8 G, or altitude above the ground.

The objective function, also called the cost function, expresses what to minimize. Here it is simply arrival time:

J=tf.J=t_f.

To maximize a quantity such as final altitude, minimize its negative.

Apply maximum acceleration during the first half, then switch to maximum braking at the midpoint. The duration is 210/2=4.472\sqrt{10/2}=4.47 s. OpenGoddard recovers this result numerically.

Example 02: position, velocity, and acceleration. Dots are optimized node values; black dashed curves are the analytic solution. A control that switches between its upper and lower bounds is called bang-bang control.
Example 02: position, velocity, and acceleration. Dots are optimized node values; black dashed curves are the analytic solution. A control that switches between its upper and lower bounds is called bang-bang control.

This answer is intuitive, but adding drag, propellant consumption, or altitude-dependent air density soon makes a hand calculation impractical. OpenGoddard solves such problems numerically.

TypeFormMeaningExamples
Terminal cost (Mayer)Φ(x(tf),tf)\Phi(\boldsymbol{x}(t_f),t_f)Depends on the final state and timetft_f, −h(tf)-h(t_f), −m(tf)-m(t_f)
Running cost (Lagrange)∫t0tfL(x,u,t) dt\displaystyle\int_{t_0}^{t_f}L(\boldsymbol{x},\boldsymbol{u},t)\,dtAccumulates along the trajectory∫u2dt\int u^2dt, ∫∣T∣dt\int\lvert T\rvert dt

Their sum is the Bolza form. Example 01 balances shorter travel time against a larger integral of squared control.

MinimizeJ=Φ(x(tf),tf)+∫t0tfL(x(t),u(t),t) dtDynamicsx˙(t)=f(x(t),u(t),t)Boundary conditionsψ(x(t0),t0,x(tf),tf)=0Path constraintsg(x(t),u(t),t)≥0\begin{aligned} &\text{Minimize} &&J=\Phi\bigl(\boldsymbol{x}(t_f),t_f\bigr)+\int_{t_0}^{t_f}L\bigl(\boldsymbol{x}(t),\boldsymbol{u}(t),t\bigr)\,dt\\[4pt] &\text{Dynamics} &&\dot{\boldsymbol{x}}(t)=\boldsymbol{f}\bigl(\boldsymbol{x}(t),\boldsymbol{u}(t),t\bigr)\\[4pt] &\text{Boundary conditions} &&\boldsymbol{\psi}\bigl(\boldsymbol{x}(t_0),t_0,\boldsymbol{x}(t_f),t_f\bigr)=\boldsymbol{0}\\[4pt] &\text{Path constraints} &&\boldsymbol{g}\bigl(\boldsymbol{x}(t),\boldsymbol{u}(t),t\bigr)\ge\boldsymbol{0} \end{aligned}
SymbolMeaningIn Example 02
x(t)\boldsymbol{x}(t)State(x,v)(x,v)
u(t)\boldsymbol{u}(t)Controlaa
f\boldsymbol{f}Dynamics right-hand side(v,a)(v,a)
Φ\PhiTerminal costtft_f
LLRunning cost integrand00
ψ=0\boldsymbol{\psi}=\boldsymbol{0}Boundary conditionsx(0)=0, v(0)=0, x(tf)−10=0, v(tf)=0x(0)=0,\ v(0)=0,\ x(t_f)-10=0,\ v(t_f)=0
g≥0\boldsymbol{g}\ge\boldsymbol{0}Path constraints2−a≥0, a+2≥02-a\ge0,\ a+2\ge0

Write inequalities in the ≥0\ge0 direction: a≤2a\le2 becomes 2−a≥02-a\ge0. OpenGoddard follows the same convention (writing a problem).

Some systems change during a trajectory, such as a rocket at stage separation. Divide time into phases and provide dynamics for each. At the boundaries, impose linkage conditions: position and velocity remain continuous, while mass drops by the discarded stage mass. OpenGoddard supports any number of phases (Example 11).

A function contains infinitely many values. Analytic solutions are available mainly for simple dynamics and few constraints, as in Examples 01–03. For practical problems, approximate these functions with finitely many numbers and solve the resulting computational problem. The next page introduces the two main approaches to this conversion.