%% LyX 2.3.7 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=3cm,rmargin=3cm}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{graphicx}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\theoremstyle{definition}
    \ifx\thechapter\undefined
      \newtheorem{xca}{\protect\exercisename}
    \else
      \newtheorem{xca}{\protect\exercisename}[chapter]
    \fi

\makeatother

\usepackage{babel}
\providecommand{\exercisename}{Exercise}

\begin{document}
\title{Exercise for Optimal control -- Week 3\date{}}
\author{Choose \textbf{1.5 }problems to solve.}
\maketitle
\begin{xca}
Consider a harmonic oscillator $\ddot{x}+x=u$ whose control is constrained
in the interval $[-1,1]$. Find an optimal controller $u$ which drives
the system at initial state $(x(0),\dot{x}(0))=(X_{1},X_{2})$ to
the origin in minimal time. Draw the phase plot.
\end{xca}
%
\begin{xca}
Consider a rocket, modeled as a particle of constant mass $m$ moving
in zero gravity empty space. Let $u>0$ be the mass flow, assumed
to be a known function of time, let $c$ be the constant thrust velocity
and $v$ an angle that can be controlled. See Figure \ref{fig:A-rocket-model}.
The equations of motion are
\begin{align*}
\dot{x}_{1} & =x_{3}\\
\dot{x}_{2} & =x_{4}\\
\dot{x}_{3} & =\frac{c}{m}u(t)\cos(v(t))\\
\dot{x}_{4} & =\frac{c}{m}u(t)\sin(v(t))
\end{align*}

\begin{figure}[H]
\begin{centering}
\includegraphics[scale=0.6]{rocket-cropped}
\par\end{centering}
\caption{A rocket model. \label{fig:A-rocket-model}}

\end{figure}

1) Show that cost functionals of the class 
\[
\min_{v(\cdot)}\int_{0}^{t_{f}}{\rm d}t\text{ or }\min_{v(\cdot)}\phi(x(t_{f}))
\]
gives the optimal control
\[
\tan v^{*}(t)=\frac{c_{1}+c_{2}t}{c_{3}+c_{4}t}.
\]

2) Assume that the rocket starts at rest at the origin and that we
want to drive it to a given height $x_{2f}$ in a given time $t_{f}$
such that the final velocity in the horizontal direction $x_{3}(t_{f})$
is maximized while $x_{4f}=0$. Show that the optimal control is reduced
to a linear tangent law
\[
\tan v^{*}(t)=c_{1}+c_{2}t.
\]

3) Let the rocket in represent a missile whose target is at rest.
Minimize the transfer time $t_{f}$from the state $[0,0,x_{3i},x_{4i}]$
to the state $[x_{1f},x_{2f},\text{free},\text{free}]$. Solve the
problem under the assumption that $u$ is constant.

4) To increase the realism now assume that the motion is under a constant
gravitational force. The only equation that needs to be modified is
the one for $x_{4}$ (the acceleration in the vertical direction):
\[
\dot{x}_{4}=\frac{c}{m}u(t)\sin(v(t))-g.
\]
Show that the optimal law is still optimal for the cost functional
\[
\min_{v(\cdot)}\phi(x(t_{f}))+\int_{0}^{t_{f}}{\rm d}t.
\]

5) Now we take into consideration of the mass loss of the rocket.
Let $x_{5}$ denote the mass of the rocket. The overall equations
of motion now read
\begin{align*}
\dot{x}_{1} & =x_{3}\\
\dot{x}_{2} & =x_{4}\\
\dot{x}_{3} & =\frac{c}{m}u(t)\cos(v(t))\\
\dot{x}_{4} & =\frac{c}{m}u(t)\sin(v(t))-g\\
\dot{x}_{5} & =-u(t)
\end{align*}
where $u\in[0,u_{\max}]$. Show that the optimal solution to transferring
the rocket from a state of given position, velocity and mass to a
given altitude $x_{2f}$ using a given amount of fuel, such that the
distance $x_{1}(t_{f})-x_{1}(0)$ is maximized, is
\[
v^{*}(t)=\text{constant},\;u^{*}(t)=\{u_{\max},0\}.
\]
\end{xca}
%
\begin{xca}
Try to solve the Rayleigh problem: consider minimizing 
\[
J=\int_{0}^{t_{f}}(u^{2}+x_{1}^{2}){\rm d}t
\]
subject to (the controlled van de Pol oscillator):
\begin{align*}
\dot{x}_{1} & =x_{2},\\
\dot{x}_{2} & =-x_{1}+x_{2}(1.4-0.14x_{2}^{2})+4u
\end{align*}
with initial condition $(x_{1}(0),x_{2}(0))=(-5,-5)$, $t_{f}=4.5$
and a mixed input and state constraint:
\[
-1\le u(t)+\frac{x_{1}(t)}{6}\le0.
\]
Draw the optimal controller and the state trajectory. You may use
numerical methods, e.g., discretization.
\end{xca}
%

\end{document}
