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.

0.4 Optimization and Discretization

Optimization provides a precise language for stating what may change, what should improve, and what conditions must remain satisfied. Discretization then converts continuous-time functions into finite vectors that numerical algorithms can manipulate.

Basic optimization language

Optimization problem structure

A constrained optimization problem can be written as

minxf(x)subject togi(x)0,i=1,,ng,hj(x)=0,j=1,,nh,xLxxU.\begin{aligned} \min_{\mathbf{x}}\quad & f(\mathbf{x})\\ \text{subject to}\quad & g_i(\mathbf{x})\leq 0, && i=1,\ldots,n_g,\\ & h_j(\mathbf{x})=0, && j=1,\ldots,n_h,\\ & \mathbf{x}^{L}\leq\mathbf{x}\leq\mathbf{x}^{U}. \end{aligned}
Decision variables enter an objective and constraints to produce a feasible optimization solution.

The principal parts of an optimization problem.

Core terms

Example optimization statement

A simple engineering design problem is

minm,kJ(m,k)=m2+0.5k2subject tom0.1,10k1000.\begin{aligned} \min_{m,k}\quad & J(m,k)=m^2+0.5k^2\\ \text{subject to}\quad & m\geq0.1,\\ &10\leq k\leq1000. \end{aligned}

This statement specifies the quantities being chosen, the performance measure being improved, and the bounds that must hold.

How CCD builds on this structure

A CCD problem uses the same optimization language but adds dynamic-system structure. Its decision variables include plant and controller quantities, while its constraints often include state equations over time:

x˙=f(x,u,xp,xc,t).\dot{\mathbf{x}}=\mathbf{f}(\mathbf{x},\mathbf{u},\mathbf{x}_p,\mathbf{x}_c,t).

The objective may also depend on an entire trajectory rather than on a few static variables.

Discretization and sampled variables

Why discretization is needed

Many CCD problems are naturally continuous in time. Numerical optimizers, however, operate on finite-dimensional vectors rather than on arbitrary continuous functions. Continuous trajectories must therefore be approximated by samples or coefficients.

Time mesh

Divide a time interval into nodes:

t0<t1<<tN.t_0<t_1<\cdots<t_N.

The width of interval ii is

Δti=ti+1ti.\Delta t_i=t_{i+1}-t_i.

The mesh is uniform if every Δti\Delta t_i is equal and nonuniform otherwise.

Sampled states and controls

At each node, approximate the state and control by

xix(ti),uiu(ti).\mathbf{x}_i\approx\mathbf{x}(t_i), \qquad \mathbf{u}_i\approx\mathbf{u}(t_i).

If the control is scalar, its sampled trajectory becomes the finite vector

U=[u0u1uN]T.\mathbf{U}= \begin{bmatrix} u_0&u_1&\cdots&u_N \end{bmatrix}^{T}.
Values of a continuous control trajectory sampled at time nodes form a finite decision vector.

A continuous trajectory becomes a finite vector when sampled on a time mesh.

From differential equations to algebraic constraints

Discretization must also enforce the system dynamics. A simple forward-Euler approximation is

x˙(ti)xi+1xiΔti.\dot{\mathbf{x}}(t_i) \approx \frac{\mathbf{x}_{i+1}-\mathbf{x}_i}{\Delta t_i}.

Substituting this approximation into

x˙=f(x,u,t)\dot{\mathbf{x}}=\mathbf{f}(\mathbf{x},\mathbf{u},t)

gives the algebraic relation

xi+1xiΔtif(xi,ui,ti)=0.\mathbf{x}_{i+1}-\mathbf{x}_i -\Delta t_i\mathbf{f}(\mathbf{x}_i,\mathbf{u}_i,t_i)=\mathbf{0}.

Higher-accuracy methods use different approximations, but the central idea remains: a continuous-time model becomes a finite set of algebraic equations.

Why this matters later

This conversion underlies direct shooting, multiple shooting, direct transcription, and collocation. It also introduces important numerical questions:

Activity 0.5: Discretized Minimum-Energy Control Solved by Linear Algebra