Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

From Optimization to Optimal Control

Optimal control is concerned with choosing the best possible evolution of a dynamical system. The word best must always be interpreted relative to a clearly defined performance measure. Depending on the application, one may wish to minimize travel time, energy consumption, fuel use, tracking error, vibration, or economic cost. In other applications, the objective may be to maximize profit, harvested energy, range, or reliability.

The central ideas of optimal control are easiest to understand by first returning to ordinary scalar optimization. In scalar optimization, the unknown is a number. In optimal control, the unknown is an entire function of time. The mathematical transition from optimizing a number to optimizing a function is the key conceptual step developed in this section.

Optimization as Efficient Decision Making

Optimization appears whenever a task can be accomplished in more than one way and some alternatives are preferred over others. Everyday scheduling, route planning, engineering design, and resource allocation all possess the same basic structure:

  1. there is a decision to be made;

  2. there is a goal or objective;

  3. there are constraints that restrict what is possible;

  4. there may be many feasible alternatives;

  5. one seeks the alternative that performs best according to a chosen metric.

For example, suppose a person must complete grocery shopping. The task can be completed by many different routes through the store. One route may minimize time, while another may minimize walking distance or physical effort. The optimal route therefore depends on the chosen objective.

The Elements of an Optimization Problem

A generic finite-dimensional optimization problem can be written as

minxRnf(x)\min_{\boldsymbol{x}\in\mathbb{R}^n} f(\boldsymbol{x})

subject to

gi(x)0,i=1,,m,hj(x)=0,j=1,,p.\begin{aligned} g_i(\boldsymbol{x}) &\le 0, \qquad i=1,\ldots,m,\\ h_j(\boldsymbol{x}) &=0, \qquad j=1,\ldots,p. \end{aligned}

Here:

The set of all points satisfying the constraints is called the feasible set:

F={xRn:gi(x)0,  hj(x)=0}.\mathcal{F} = \left\{ \boldsymbol{x}\in\mathbb{R}^n: g_i(\boldsymbol{x})\le 0,\; h_j(\boldsymbol{x})=0 \right\}.

The grocery-shopping example illustrates infeasibility. If the complete task must be finished in two minutes, no physically realizable route may satisfy the time constraint. If the allowed time is increased to three hours, the feasible set may become nonempty.

The Objective Function and the Meaning of “Optimal”

The objective function is the numerical quantity used to compare feasible solutions. For a minimization problem, a feasible point x\boldsymbol{x}^{*} is globally optimal if

f(x)f(x)xF.f(\boldsymbol{x}^{*})\le f(\boldsymbol{x}) \qquad \forall \boldsymbol{x}\in\mathcal{F}.

For a maximization problem, x\boldsymbol{x}^{*} is globally optimal if

f(x)f(x)xF.f(\boldsymbol{x}^{*})\ge f(\boldsymbol{x}) \qquad \forall \boldsymbol{x}\in\mathcal{F}.

Different objective functions generally produce different optimal solutions. For the same physical task, minimizing elapsed time may lead to a different decision than minimizing energy expenditure.

Scalar Functions

The simplest optimization setting is a scalar-valued function of a scalar variable:

f:RR,y=f(x).f:\mathbb{R}\rightarrow\mathbb{R}, \qquad y=f(x).

The input xx is a real number, and the output f(x)f(x) is also a real number. For a smooth function, classical calculus provides useful necessary and sufficient conditions for identifying local minima and maxima.

Critical Points and the First-Derivative Condition

Suppose ff is differentiable. At an interior local minimum or maximum, the slope must vanish under standard regularity assumptions:

dfdx(x)=0.\frac{df}{dx}(x^*)=0.

For the smooth functions considered here, critical points are obtained by solving

f(x)=0.f'(x)=0.

Let

x1,x2,,xNx_1,x_2,\ldots,x_N

denote all roots of this equation. These points are only candidates for extrema. A zero derivative does not by itself prove that a point is a minimum or maximum.

Why the first derivative vanishes

If xx^* is an interior local minimum and ff is differentiable, then for sufficiently small hh,

f(x+h)f(x).f(x^*+h)\ge f(x^*).

For h>0h>0,

f(x+h)f(x)h0,\frac{f(x^*+h)-f(x^*)}{h}\ge 0,

while for h<0h<0,

f(x+h)f(x)h0.\frac{f(x^*+h)-f(x^*)}{h}\le 0.

Taking the limit h0h\rightarrow 0 from the right and left implies

f(x)=0.f'(x^*)=0.

This result is a necessary condition for a smooth interior optimum, but it is not sufficient.

The Second-Derivative Test

The second derivative describes local curvature.

The interpretation follows from a second-order Taylor expansion:

f(xc+h)=f(xc)+f(xc)h+12f(xc)h2+o(h2).f(x_c+h) = f(x_c) + f'(x_c)h + \frac{1}{2}f''(x_c)h^2 + o(h^2).

Because f(xc)=0f'(x_c)=0,

f(xc+h)f(xc)=12f(xc)h2+o(h2).f(x_c+h)-f(x_c) = \frac{1}{2}f''(x_c)h^2 + o(h^2).

Since h20h^2\ge 0, the sign of f(xc)f''(x_c) determines whether nearby function values are larger or smaller.

Stationary Points That Are Not Extrema

A stationary point need not be a minimum or maximum.

Consider

f(x)=x3.f(x)=x^3.

Then

f(x)=3x2,f'(x)=3x^2,

so

f(0)=0.f'(0)=0.

However, x=0x=0 is neither a local minimum nor a local maximum, because f(x)<0f(x)<0 for x<0x<0 and f(x)>0f(x)>0 for x>0x>0.

A stationary inflection point: f'(0)=0, but x=0 is neither a local minimum nor a local maximum.

Figure 1:A stationary inflection point: f(0)=0f'(0)=0, but x=0x=0 is neither a local minimum nor a local maximum.

Local and Global Extrema

A local optimum is best only in a neighborhood. A global optimum is best over the entire admissible domain.

A smooth function may have several local extrema. Only one may be globally optimal.

Figure 2:A smooth function may have several local extrema. Only one may be globally optimal.

For a smooth function with finitely many local maxima x1,,xkx_1,\ldots,x_k, the global maximum among those candidates is found by comparing their objective values:

x=arg maxxi,  i=1,,kf(xi).x^* = \operatorname*{arg\,max}_{x_i,\;i=1,\ldots,k} f(x_i).

Constrained Scalar Optimization

Now consider

maxx[a,b]f(x).\max_{x\in[a,b]} f(x).

The feasible set is the closed interval

F=[a,b].\mathcal{F}=[a,b].

A crucial point is that the optimizer may lie at a boundary:

x=aorx=b.x^*=a \qquad\text{or}\qquad x^*=b.

At a boundary optimum, the derivative need not be zero.

Why the derivative test can fail

Consider

f(x)=x,x[0,1].f(x)=x, \qquad x\in[0,1].

Then

f(x)=1f'(x)=1

for every x[0,1]x\in[0,1]. There is no solution of f(x)=0f'(x)=0, yet the maximum is clearly

x=1,f(x)=1.x^*=1, \qquad f(x^*)=1.

Thus, the equation

f(x)=0f'(x)=0

detects only smooth interior stationary points. It does not detect active-boundary optima.

A Systematic Procedure on a Closed Interval

If ff is continuous on [a,b][a,b], the extreme value theorem guarantees that ff attains both a global minimum and a global maximum on [a,b][a,b].

A systematic procedure is:

  1. solve

f(x)=0f'(x)=0

for all critical points in (a,b)(a,b);

  1. evaluate ff at every interior critical point;

  2. evaluate the endpoints:

f(a),f(b);f(a),\qquad f(b);
  1. compare all candidate values.

Therefore,

maxx[a,b]f(x)=max{f(a),f(b),f(x1),,f(xN)},\max_{x\in[a,b]} f(x) = \max \left\{ f(a), f(b), f(x_1), \ldots, f(x_N) \right\},

where x1,,xNx_1,\ldots,x_N are the critical points in (a,b)(a,b).

One-Sided Neighborhoods at a Boundary

At an interior local maximum xx^*, one compares f(x)f(x^*) to function values on both sides. At a right boundary bb, only feasible perturbations to the left are allowed.

Thus, bb is a local maximum relative to the feasible set [a,b][a,b] if there exists δ>0\delta>0 such that

f(b)f(x),x[bδ,b].f(b)\ge f(x), \qquad x\in[b-\delta,b].

Similarly, aa is a local maximum relative to [a,b][a,b] if there exists δ>0\delta>0 such that

f(a)f(x),x[a,a+δ].f(a)\ge f(x), \qquad x\in[a,a+\delta].

These are one-sided optimality statements because the feasible set restricts allowable perturbations.

Maximum Value Versus Maximizing Argument

There is an important distinction between the value of the objective and the point at which that value occurs.

The maximum value is

maxx[a,b]f(x).\max_{x\in[a,b]} f(x).

The maximizing argument is

x=arg maxx[a,b]f(x).x^* = \operatorname*{arg\,max}_{x\in[a,b]} f(x).

The first expression returns a number in the range of ff. The second returns a point in the domain of ff.

For example, if

f(x)=(x2)2+5,f(x)=-(x-2)^2+5,

then

maxxRf(x)=5,\max_{x\in\mathbb{R}} f(x)=5,

whereas

arg maxxRf(x)=2.\operatorname*{arg\,max}_{x\in\mathbb{R}} f(x)=2.

If several points yield the same maximum value, the argmax is a set:

arg maxxFf(x)={xF:f(x)=maxzFf(z)}.\operatorname*{arg\,max}_{x\in\mathcal{F}} f(x) = \left\{ x\in\mathcal{F}: f(x)=\max_{z\in\mathcal{F}} f(z) \right\}.

A Maximum-Principle Viewpoint

A derivative-free statement of optimality is

f(x)f(x)xF.f(x^*)\ge f(x) \qquad \forall x\in\mathcal{F}.

Equivalently,

xarg maxxFf(x).x^*\in\operatorname*{arg\,max}_{x\in\mathcal{F}} f(x).

This statement is more general than the condition f(x)=0f'(x^*)=0 because it remains meaningful when:

Derivative conditions are powerful computational tools when their assumptions hold, but they are not the definition of optimality.

From Points to Functions

Classical scalar optimization searches for a number:

xR.x^*\in\mathbb{R}.

Optimal control searches for one or more functions of time:

u(t),x(t).\boldsymbol{u}^*(t), \qquad \boldsymbol{x}^*(t).

The unknown is therefore an entire trajectory, not a single point.

A standard optimal control problem has the form

minu()J[x(),u()]\min_{\boldsymbol{u}(\cdot)} J[\boldsymbol{x}(\cdot),\boldsymbol{u}(\cdot)]

subject to the differential equation

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

boundary conditions such as

x(t0)=x0,\boldsymbol{x}(t_0)=\boldsymbol{x}_0,

and possibly path constraints

g(x(t),u(t),t)0.\boldsymbol{g}\bigl(\boldsymbol{x}(t),\boldsymbol{u}(t),t\bigr)\le \boldsymbol{0}.

Functions and Functionals

A function maps numbers or vectors to numbers or vectors. For example,

f:RR.f:\mathbb{R}\rightarrow\mathbb{R}.

A functional maps an entire function to a number:

J:UR,J:\mathcal{U}\rightarrow\mathbb{R},

where U\mathcal{U} is a space of admissible functions.

A common functional is

J[u]=t0tfL(u(t),t)dt.J[u] = \int_{t_0}^{t_f} L\bigl(u(t),t\bigr)\,dt.

The input to JJ is the complete function u(t)u(t), while the output is a scalar.

A Route-Planning Interpretation

Suppose a traveler wishes to move from an initial location to a destination. A route can be represented by a path

r(t)=[x(t)y(t)].\boldsymbol{r}(t) = \begin{bmatrix} x(t)\\ y(t) \end{bmatrix}.

Many paths may connect the same endpoints:

r(t0)=r0,r(tf)=rf.\boldsymbol{r}(t_0)=\boldsymbol{r}_0, \qquad \boldsymbol{r}(t_f)=\boldsymbol{r}_f.

A minimum-time problem seeks

r()arg minr()tf,\boldsymbol{r}^*(\cdot) \in \operatorname*{arg\,min}_{\boldsymbol{r}(\cdot)} t_f,

subject to kinematic, road, and speed constraints.

A minimum-distance problem instead minimizes

J[r]=t0tfr˙(t)dt.J[\boldsymbol{r}] = \int_{t_0}^{t_f} \left\| \dot{\boldsymbol{r}}(t) \right\|\,dt.

The two formulations may produce different paths. Again, the meaning of optimality depends on the performance index.

The Conceptual Transition

The progression from elementary optimization to optimal control can be summarized as follows:

ConceptStatic optimizationOptimal control
UnknownPoint x\boldsymbol{x}Function u(t)\boldsymbol{u}(t) or trajectory x(t)\boldsymbol{x}(t)
Objectivef(x)f(\boldsymbol{x})Functional J[x,u]J[\boldsymbol{x},\boldsymbol{u}]
ConstraintsAlgebraicDifferential and algebraic
SolutionOptimal pointOptimal path or control history
Mathematical toolsCalculus, nonlinear programmingCalculus of variations, maximum principle, dynamic programming, direct transcription

Chapter Summary

The main ideas are:

  1. Optimization selects the best feasible decision according to a specified performance measure.

  2. A problem may be infeasible if its constraints cannot be satisfied.

  3. For a smooth scalar function, interior critical points satisfy

f(x)=0.f'(x)=0.
  1. The second derivative classifies nondegenerate critical points:

f(x)>0local minimum,f''(x)>0 \Rightarrow \text{local minimum},
f(x)<0local maximum.f''(x)<0 \Rightarrow \text{local maximum}.
  1. A critical point need not be an extremum.

  2. Local extrema are not necessarily global extrema.

  3. In constrained optimization, the optimizer may occur on the boundary, where the derivative need not vanish.

  4. The expression

maxxFf(x)\max_{x\in\mathcal{F}} f(x)

gives the optimal value, while

arg maxxFf(x)\operatorname*{arg\,max}_{x\in\mathcal{F}} f(x)

gives the maximizing argument.

  1. Optimal control extends optimization from points to functions.

  2. A functional maps a function to a scalar.

Connection. Optimizing trajectories requires a space in which functions themselves can vary, so the scalar ideas above now give way to function spaces and functionals.