Collocation, Single and Multiple Shooting

Lecture 2 of IRC, LIAM, Fields-CQAM MfPH Training Series

Sanafi, NSERC, YorkU

Professor Michael Chen

2020-03-16

@York University

Continuous Optimal Control Problem

\begin{align*} &\underset{x(\cdot),u(\cdot)}{\text{minimize}} & &\psi(x(\cdot),u(\cdot)) \\ &\text{subject to} & &\dot{x}(t) = f(t, x(t),u(t)) \;\; \forall t \in \mathcal{T}, \\ &&&0 \le c(t, x(t),u(t)) \;\; \forall t \in \mathcal{T}, \tag{1.1}\\ &&&0 \le r(\{x(t_i)\}) \;\; \{t_i \}\subset \mathcal{T}, \\ \end{align*}

where codomain dimensions of dynamic process \(x\), control \(u\), performance index \(\psi\), ODE constraints rhs \(f\), path constraints \(c\), and point constraints \(r\) are \(n^x,n^u,n^x,n^c,n^r\) respectively. Time horizon \(\mathcal{T}\) is \([t_0,t_f]\) and grid points are \(t_i, 0\le i \le m\).

Assumptions

Objective Function Types

BOLZA type is the sum of an integral contribution(the LAGRANGE) and an end-point contribution(the MAYER),

\begin{equation*} \psi(x(\cdot),u(\cdot)) = \int_{t_0}^{t_f} l(t,x(t),u(t)) dt + m(t_f,x(t_f)) \tag{1.3} \end{equation*}

Least-square type is about the deviation of state trajectory from the desired path and terminal state,

\begin{equation*} \psi(x(\cdot),u(\cdot)) = \int_{t_0}^{t_f} \|r(t,x(t),u(t))\|_2^2 dt + \|m(t_f,x(t_f))\|_2^2 \tag{1.4} \end{equation*}

Constraint Types

coupled or decoupled?

\begin{equation*} 0 \le c(x(t),u(t)) \; \forall t\in \mathcal{T} \end{equation*}
\begin{equation*} 0 \le c(x(t_i)) \; 0\le i\le m \end{equation*}
\begin{equation*} 0 \le c(x(t_0), \cdots, x(t_m)) \end{equation*}

Collocation Method

The state \(x(t)\) is approximated; the control \(u(t)\) is specified. For example,

\begin{align*} x(t) &\approx a_0 + a_1 t + a_2 t^2\\ u(t) &= b_0 + b_1 t + b_2 t^2 \end{align*}

then model (1.1) has a straightforward transcription of every component: the objective function or the performance measure \(\psi(\cdot)\), the ODE, the path constraints, and the point constraints. Especially the path constraint is only respected on grids \(t_i, i=0,\cdots,m\).

Collation Method Example

\begin{align*} &\underset{x(\cdot),u(\cdot)}{\text{minimize}} & &\frac{1}{2} \int_0^1 [x(t)^2 + u(t)^2] dt\\ &\text{subject to} & &\dot{x}(t) = -x(t) + u(t) \; \forall t \in \mathcal{T}, \\ &&& x(0) = 1 \end{align*}

transcripted as:

\begin{align*} &\underset{a_0,a_1,a_2,b_0,b_1,b_2}{\text{minimize}} & &\left[\frac{1}{2} (a_0^2 + b_0^2)t + \frac{1}{2} (a_1 + b_0 b_1)t^2 + \cdots + \frac{1}{10}(a_2^2 + b_2^2)t^5 \right]_{t=0}^{t=1}\\ &\text{subject to} & & a_1 + 2a_2 t_i = -(a_0 + a_1 t_i + a_2 t_i^2) + (b_0 + b_1 t_i + b_2 t_i^2) \; \forall i=0,\cdots,m\\ &&& a_0 = 1 \end{align*}

which is solved as a Nonlinear Optimization problem.

Nonlinear Optimization in a Nutshell

\begin{align*} &\underset{x}{\text{minimize}} & &f(x)\\ &\text{subject to} & &g(x)=0 \\ &&& h(x) \ge 0 \end{align*}

Advanced Collocation Method

Strength of Collocation Method

Strength of Shooting Method

Direct Single Shooting

Only the control is specified. For example, \(\mathbb{q}=[q_0,\cdots,q_m], u(t)=q_i, \forall t \in [t_i, t_{i+1}], i=0,\cdots,m\) as vaccination levels.

\begin{align*} &\underset{\mathbb{q}}{\text{minimize}} & &\psi(x(\cdot;q)) \\ &\text{subject to} & &0 \le c(t_i, x(t_i;\mathbb{q})) \; \forall i=0,\cdots,m \\ &&&0 \le r(\{x(t_i;\mathbb{q})\}) \; \{t_i \}\subset \mathcal{T}, \\ &&&x(t_0)=s_0 \end{align*}

\(x(\cdot;\mathbb{q})\) is evaluated as an initial value problem(IVP) for any iterate \(\mathbb{q}\) during the nonlinear optimization process. The gradients of \(\psi(\cdot), c(\cdot), r(\cdot)\) with respect to \(\mathbb{q}\) are numerically approximated, to be detailed in the multiple shooting method.

Direct Single Shooting

./images/fig1.1.png

Direct Multiple Shooting

./images/fig1.2.png

Direct Multiple Shooting

For each \(i=0,\cdots,m\), the \(x_i(t;\mathbb{q_i}), t \in [t_i,t_{i+1}]\) is evaluated as an independent IVP for any iterate \(\mathbb{q_i}\) in the optimization process. Apprantly we can achieve higher accuracy on smaller intervals. To match these pieces, we create aux variables \(s_0,\cdots,s_m\) as the initial state on each interval and add matching constraints:

\begin{equation*} s_{i+1} = x_i(t_{i+1}-t_i; \mathbb{q_i}) \; \forall i=0,\cdots,m \end{equation*}

Direct Multiple Shooting

Direct Multiple Shooting

\begin{align*} &\underset{\mathbb{q,s_0,\cdots,s_m}}{\text{minimize}} & &\psi(x(\cdot;q)) + \rho\sum_{i=0}^{m-1} (s_{i+1} - x_i(t_{i+1}-t_i; \mathbb{q_i}))^2\\ &\text{subject to} & &0 \le c(t_i, x_i(t_i;\mathbb{q_i})) \; \forall i=0,\cdots,m \\ &&&0 \le r(\{x_i(t_i;\mathbb{q_i})\}) \; \{t_i \}\subset \mathcal{T}, \\ \end{align*}

Sensitivity of IVP

\begin{align*} \dot{x}(t;q) &= f(t, x(t), q)\; \\ x(t_0;q) &= s \end{align*}

and derivatives of \(x(t_f;q)\) w.r.t. \(q, s\) are sensitivities of this IVP. We need to apply this analysis to all IVP problems of multi shooting intervals, so the nonlinear solver can get derivatives to make progress.

External Numerical Differentiation (END)

\begin{equation*} x_d(t_f;t_0, x_0, q_0) = \frac{1}{h} \left(\eta(t_f;t_0, x_0 + h d^x, q_0 + h d^q) - \eta(t_f;t_0, x_0, q_0)\right) \end{equation*}

where \(\eta(\cdot)\) is the numerical result, etc., Runge-Kutta, \(x_d(\cdot)\) is the directional derivative w.r.t. \(d=[d^x,d^q]\). END is not accurate since the two \(\eta(\cdot)\) evaluations may internally used different grids, different pivoting, and even different adaptive schemes.

Internal Numerical Differentiation (IND)

We define a new IVP for computing the directional derivative:

\begin{align*} \dot{x}_d(t) &= \frac{1}{h}\left(f(t, x(t)+h d^x, q + h d^q) - f(t, x(t), q)\right)\\ x_d(t_0) &= d \tag{3.4.3} \end{align*}

where \(\dot{x}_d(t)\) is an artificially constructed dynamic process, which shall be evaluated simutaneously with the \(x(t)\). Second order derivatives could be calculated from this new IVP and automatic differentiation.

Automatic Differentiation

Single or Multiple Shooting

Homework

Next Lecture

Mixed-Integer Optimal Control, Convexification and Relaxation.

Bibliography

  1. KIRCHES, CHRISTIAN. Fast Numerical Methods for Mixed-Integer Nonlinear Model-Predictive Control, 2010, PhD dissertation.

  2. MATTHEW KELLY. An Introduction to Trajectory Optimization: How to Do Your Own Direct Collocation. SIAM Review, Vol. 59, No. 4, pp. 849-904, 2017.

  3. ZBIKOWSKI, RAFAL, and SUBCHAN SUBCHAN. Computational Optimal Control: Tools and Practice, John Wiley & Sons, Incorporated, 2009.

  4. T.H. TSANG, D. M. HIMMELBLAU and T. F. EDGAR. Optimal control via collocation and non-linear programming, INT.J. CONTROL, 1975, VOL. 21, NO.5, 763-768.