For the system $$\ddot{x}+x=u$$ with $\|u\| \le 1$, find the optimal way to steer the system from

(a) $(x(0),\dot{x}(0))$ to $(0,0)$

(b) $(x(0),\dot{x}(0))$ to $x=0$

and minimize $$\int_0^{t_f} \|u(t)\| \,\mathrm{d} t$$

Attemp (for part a) the system can be written as $$\dot{x}_1=x_2~ ,~ \dot{x}_2=-x_1+u$$ and the hamiltonian can be written as $$H(x,t,u,\lambda)=|u(t)|+x_2\lambda_1-x_1\lambda_2+u(t)\lambda_2$$then i'll have $$\begin{bmatrix}\dot{\lambda}_1 \\ \dot{\lambda}_2 \end{bmatrix}= \begin{bmatrix}0 &1 \\ -1 &0 \end{bmatrix}\begin{bmatrix}\lambda_1 \\ \lambda_2 \end{bmatrix},$$ With initial conditions $\lambda_1(0)=A\cos \theta, \lambda_2(0)=A\sin \theta$ i have $$\lambda_1(t)=A\cos(t-\theta), \lambda_2(t)=A\sin(t-\theta)$$ and $u(t)=-sign(\lambda_2(t))=+1 ~\text{or} -1$.

Is my approach correct ? i'm confused about the range of optimal $u(t)$ for various $\lambda$. And i'm also confused about approaching part b, when $x=0$ then i've the set $S =\{(x_1,x_2)|x_1=0, -\infty<x_2<+\infty\}$ , then i think i need to find a vector $q=[K ~0]^{\top}$ such that $<\lambda(t_f),q>=0$ ?


You also have to take the absolute value of $u(t)$ into account. Namely say $\lambda_2=0.5$ then your solution gives $u(t)=-1$ with $|u(t)|+u(t)\,\lambda_2=0.5$. However, $u(t)=0$ yields $|u(t)|+u(t)\,\lambda_2=0$ which is lower. Namely $|u(t)|$ is the dominant term when $|\lambda_2|<1$, which has the minimum $u(t)=0$. So the expression which would minimize the Hamiltonian would be

$$ u(t) = \left\{ \begin{array}{ll} 1, & \text{if}\ \lambda_2 < -1 \\ -1, & \text{if}\ \lambda_2 > 1 \\ 0, & \text{otherwise} \end{array} \right. . $$

You still need to find values for $\lambda_1(0)$ and $\lambda_2(0)$, however I am not sure there would be a closed form solution for it. There isn't even always a solution, for example if $t_f$ is too small such that the constrained input can't drive the system from its initial conditions to zero. In general this is solved with the shooting method. In the case that $(x(t_f),\dot{x}(t_f))=(0,0)$ then $(\lambda_1(t_f),\lambda_2(t_f))$ is allowed to be anything. In the case that only $x(t_f)=0$ ($\dot{x}(t_f)$ can be anything) then $\lambda_1(t_f)$ can still be anything, however the other co-state has to satisfy

$$ \lambda_2(t_f) = \left[\frac{\partial g_{t_f}}{\partial \dot{x}}\right]_{x=x(t_t)}, $$

with $g_{t_f}$ the terminal cost, which in this case is zero.

  • $\begingroup$ yes that's right, but how do i find $\lambda_1(0), \lambda_2(0)$ such that $x(t_f)=0$ ? and what about part (b) how do i approach with the transversality conditions ? $\endgroup$ – Zeno San Sep 14 at 5:17

It is a tricky problem to solve with traditional methods, because the problem doesn't have a nice optimal control function. See the reasoning.

We rewrite the initial equation as: $$ 0=\ddot x+x-u=\ddot x\dot x+\dot x x+u\dot x=\frac d{dt}\frac{\dot x^2+x^2}2+u\dot x=0. $$

The value $E=(\dot x^2+x^2)/2$ is strictly non-negative, and goes from the positive value to zero by the influence of $u\dot x$. It doesn't matter what $\dot x$ and $x$ are, because if there is optimal trajectory from some $(\dot x, x)=(a,b)|_{E=E_0}$ there is optimal trajectory from other $(\dot x, x)=(c,d)|_{E=E_0}$, since we can simply wait doing nothing until $(\dot x, x)=(a,b)$ and then use the optimal control (we have not restriction or penalty on time).

Thus we can think only about $E$. When is there the least penalty to decrease $E$ to $E-dE$? Of course when $\dot x$ is maximal (or $x=0$). Thus any non-zero control outside of $x=0$ is sub-optimal. (You can show this in a more formal way).

Finally, there is an infinite number of optimal controlling functions: $$ u^*(t) = \sum_{k=1}^\infty -a_k\mathop{\mathrm{sign}} \dot x(t_k)\delta(t-t_k), $$ where $t_k$ is the time when $x=0$ at $k$-th time and $\sum a_k=\sqrt{\dot x(0)^2+x(0)^2}=L$ with the same penalty $L$. In other words you need a total boost of $L$ but you can split it over as many passings through zero as you want.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.