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.
Beyond ordinary optimization
Section titled “Beyond ordinary optimization”Ordinary optimization might ask for the number that minimizes . The answer is . Even with several variables, the unknown is still a finite set of numbers.
Optimal control instead asks for a function of time, : 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.
Example: move and stop in minimum time
Section titled “Example: move and stop in minimum 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 and velocity . Together they provide the starting point for predicting future motion. We collect states in a vector .
Control: the input we can choose
Section titled “Control: the input we can choose”The control is the input we are free to choose at each instant: acceleration here. Its time history is what we seek. A vector of controls is written .
Dynamics: how inputs change the state
Section titled “Dynamics: how inputs change the state”Differential equations describe how the state evolves:
The dot denotes differentiation with respect to time, . In general,
For a rocket, 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: the start and finish
Section titled “Boundary conditions: the start and finish”Boundary conditions specify the state at the endpoints:
The final time is often unknown and determined as part of the solution, as in this example.
Path constraints: limits along the way
Section titled “Path constraints: limits along the way”Path constraints must hold throughout the motion. Here,
Other examples include maximum thrust, acceleration below 8 G, or altitude above the ground.
Objective: what to improve
Section titled “Objective: what to improve”The objective function, also called the cost function, expresses what to minimize. Here it is simply arrival time:
To maximize a quantity such as final altitude, minimize its negative.
The answer
Section titled “The answer”Apply maximum acceleration during the first half, then switch to maximum braking at the midpoint. The duration is s. OpenGoddard recovers this result numerically.

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.
Two forms of cost
Section titled “Two forms of cost”| Type | Form | Meaning | Examples |
|---|---|---|---|
| Terminal cost (Mayer) | Depends on the final state and time | , , | |
| Running cost (Lagrange) | Accumulates along the trajectory | , |
Their sum is the Bolza form. Example 01 balances shorter travel time against a larger integral of squared control.
General formulation
Section titled “General formulation”| Symbol | Meaning | In Example 02 |
|---|---|---|
| State | ||
| Control | ||
| Dynamics right-hand side | ||
| Terminal cost | ||
| Running cost integrand | ||
| Boundary conditions | ||
| Path constraints |
Write inequalities in the direction: becomes . OpenGoddard follows the same convention (writing a problem).
Multiple phases
Section titled “Multiple phases”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).
Why numerical methods?
Section titled “Why numerical methods?”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.