Problem Statement

This problem serves as an example of bang-bang control which often arise when the control input $u(t)$ appears linearly in the cost function. We consider a single double integrator moving in one dimension which has two control inputs with end-point constraints. $$ \begin{array}{ll} \min & J = \int_0^{t_f} u(t) dt\\ \text{s.t.} & \dot{x}(t) = v(t)\\ & \dot{v}(t) = -Gv(t) + u(t) - b(t)\\ & 0 \leq u(t) \leq u_{\max}\\ & 0 \leq b(t) \leq b_{\max}\\ & x(0) = x_0, \quad x(t_f) = x_f\\ & v(0) = 0, \quad v(t_f) = 0 \end{array} $$ In words, $x(t)$ is the position, $v(t)$ is the velocity, $u(t)$ is the forward force while $b(t)$ is the braking force. We assume that $x_0 < x_f$. The vehicle starts at some position $x_0$ at rest and arrives at its destination, $x_f$, and stops.

Solution

As usual, we write the Hamiltonian of the optimal control problem. $$ H = u(t) + \lambda_x(t) v(t) - G\lambda_v(t) v(t) + \lambda_v(t) u(t) - \lambda_v(t) b(t) + \mu_u(t) u(t) + \mu_b(t) b(t) $$ We first write the stationarity conditions, $$ \frac{\partial H}{\partial u} = 1 + \lambda_v(t) + \mu_u(t) = 0 \quad \rightarrow \quad \mu_u(t) = -1-\lambda_v(t) $$ and $$ \frac{\partial H}{\partial b} = -\lambda_v(t) + \mu_b(t) = 0 \quad \rightarrow \quad \mu_b(t) = \lambda_v(t) $$ The complementarity condition determines when we are accelerating or braking or neither. $$ \mu_u(t) \left\{ \begin{array}{ll} \leq 0, & u(t) = 0\\ = 0, & 0 < u(t) < u_{\max}\\ \geq 0, & u(t) = u_{\max} \end{array} \right. $$ and $$ \mu_b(t) \left\{ \begin{array}{ll} \leq 0, & b(t) = 0\\ = 0, & 0 < b(t) < b_{\max}\\ \geq 0, & b(t) = b_{\max} \end{array} \right. $$ The co-position is governed by the dynamics, $$ \dot{\lambda}_x(t) = -\frac{\partial H}{\partial x} = 0 \quad \rightarrow \quad \lambda_x(t) = \lambda_x(t_f) $$ which is constant and the co-velocity state is governed by the dynamics, $$ \dot{\lambda}_v(t) = -\frac{\partial H}{\partial v} = -\lambda_x(t) + G \lambda_v(t) \quad \rightarrow \quad \lambda_v(t) = e^{G(t_f-t)} \lambda_v(t_f) + \int_t^{t_f} e^{G(t-\tau)} \lambda_x(t_f) d\tau = e^{G(t_f-t)} \lambda_v(t_f) + \frac{\lambda_x(t_f)}{G} \left[1 - e^{G(t-t_f)} \right] $$ Note that $\lambda_v(t)$ is an exponential function, that is, there does not exist a finite time interval over which $\lambda_v(t) = 0$. This means that $\mu_u(t) = 0$ and $\mu_b(t) = 0$ only for single values of $t$. From the complementarity conditions, this quick switching implies jumps between the minimum input and maximum input. The switching structure we hypothesize is the following:

  1. For $t \in \mathcal{I}_1 = [0,t_1)$, we are fully accelerating, i.e., $u(t) = u_{\max}$, while we are not braking, that is, $b(t) = 0$.
  2. For $t \in \mathcal{I}_2 = (t_1,t_2)$, we are coasting, that is, $u(t) = b(t) = 0$.
  3. Finally, for $t \in \mathcal{I}_3$, we are fully braking, that is, $b(t) = b_{\max}$ and $u(t) = 0$.
With this switching structure in mind, we can compute the optimal velocity from the following expressions for the optimal controls. $$ u(t) = (1-H(t,t_1)) u_{\max} $$ and $$ b(t) = H(t,t_2) b_{\max} $$ where $H(t,\bar{t})$ is the Heaviside step function which is equal to zero when $t < \bar{t}$ and is equal to one when $t \geq \bar{t}$. $$ v(t) = \int_0^t e^{-G(t-\tau)} u(\tau) d\tau + \int_0^t e^{-G(t-\tau)} b(\tau) $$ These integrals can be solved in terms of the three intervals. $$ v(t) = \left\{ \begin{array}{ll} \frac{u_{\max}}{G} (1 - e^{-Gt}), & t \in \mathcal{I}_1\\ \frac{u_{\max}}{G} e^{-Gt} (e^{Gt_1}-1), & t \in \mathcal{I}_2\\ \frac{u_{\max}}{G} e^{-Gt}(e^{Gt_1}-1) - \frac{b_{\max}}{G} (1 - e^{G(t_2-t)}), & t \in \mathcal{I}_3 \end{array} \right. $$ In a similar fashion, we can determine the optimal position velocity by integrating the velocity. $$ x(t) = \int_0^t v(\tau) d\tau + x_0 = \left\{ \begin{array}{ll} \frac{u_{\max}}{G^2} \left[e^{-Gt}-1+Gt \right], & t \in \mathcal{I}_1\\ \frac{u_{\max}}{G^2} \left[Gt_1 + e^{G(t_1-t)} + e^{-Gt}\right], & t \in \mathcal{I}_2\\ \frac{u_{\max}}{G^2} \left[Gt_1 + e^{G(t_1-t_2)} + e^{-Gt_2} \right] + \frac{u_{\max}}{G^2} \left[(e^{Gt_1}-1)(e^{-Gt_2} - e^{-Gt}) \right] - \frac{b_{\max}}{G^2} (t-t_2)(1-e^{G(t_2-t)}), & t \in \mathcal{I}_3 \end{array} \right. $$