We present in this notebook the **indirect simple shooting** method based on the [Pontryagin Maximum Principle (PMP)](https://en.wikipedia.org/wiki/Pontryagin%27s_maximum_principle) to solve a smooth optimal control problem. By smooth, we mean that the maximization condition of the PMP gives a control law in feedback form (i.e. with respect to the state and the costate) at least [continuously differentiable](https://en.wikipedia.org/wiki/Smoothness#Differentiability_classes).
We use the [nutopy](https://ct.gitlabpages.inria.fr/nutopy/) package to solve the optimal control problem by simple shooting. You can find another smooth example with more details about the use of nutopy at this [page](https://ct.gitlabpages.inria.fr/gallery/smooth_case/smooth_case.html): note that in this example, the nutopy package is interoperated with the [bocop](https://ct.gitlabpages.inria.fr/bocop3/) software, implementing a direct collocation method.
**_Goal_**
The goal of this presentation is that at the end, you will be able to implement an indirect simple shooting method with nutopy package on an academic optimal control problem for which the optimal control (that is the solution of the problem) is smooth. We assume you have some basic knowledge on optimal control theory. To achieve the goal, you can start by simply read the text and the code at the end of the notebook. For a deeper understanding and more details, you can watch the videos embedded in the notebook. All these videos explain the material you can find here: [pdf file](https://gitlab.inria.fr/ct/gallery/-/raw/master/examples/shooting_tutorials/lecture.pdf).
**_Contents_**
* I) Statement of the optimal control problem and necessary conditions of optimality
* a) Definition of the optimal control problem - [Video](https://youtu.be/QUbeyLNZR8A)
* b) Application of the Pontryagin Maximum Principle - [Video](https://youtu.be/xedLNn08Kn4)
* c) The hidden true Hamiltonian - [Video](https://youtu.be/inCRJZWT3Ng)
* d) Illustration of the resolution of the necessary conditions of optimality - [Video](https://youtu.be/oRm8_Grs2Aw)
* II) Examples and boundary value problems
* a) Simple 1D example - [Video](https://youtu.be/r4oYTkF76TA)
* b) Calculus of variations - [Video](https://youtu.be/Ud16jTQbsQ0)
* c) An energy min navigation problem
* III) Indirect simple shooting
* a) The shooting equation - [Video](https://youtu.be/YVG2Z_TEkBQ)
* b) The iteration of the Newton solver and the Jacobian of the shooting function -
[Video](https://youtu.be/hVbi9kShR90)
* c) A word on the Lagrange multiplier - [Video](https://youtu.be/3VEi-UHAS6w)
* IV) Numerical resolution of the shooting equations with the nutopy package
* a) Simple 1D example
* b) Calculus of variations
* c) An energy min navigation problem - exercice
## I) Statement of the optimal control problem and necessary conditions of optimality
### a) Definition of the optimal control problem
We consider the following smooth (all the data are at least $C^1$) *Optimal Control Problem* (OCP) in Lagrange
form, with fixed initial condition and final time: