## Optimal control and HamPath

Let consider a simple optimal control problem with the state and with a parameter:

where the initial and final times are fixed ( and ) and the boundaries are fixed to and . Define the *pseudo-Hamiltonian* depending on :

with the state dimension, and we fix (normal case). The application of the *Pontryagin Maximum Principle* (PMP) tells us that the minimizing trajectories are the projection of absolutely continuous *extremals * satisfying a.e.

with

**Definition 1** (Maximized Hamiltonian).

*the maximized (or true) Hamiltonian, where the optimal control is*

*and where the Hamiltonian system is given by*

**Definition 2** (Exponential mapping). For fixed and , we define in a neighborhood of (if possible), the following exponential mapping as the trajectory at time satisfying the Hamiltonian system for every in , with .

The minimizing curves are the projection of BC-extremals, *i.e. *extremals which satisfy the boundary conditions, and we can define the following shooting function:

**Definition 3** (Shooting function).

*where is the canonical q-projection, i.e. .*

The simple shooting method consists in finding a zero of the simple shooting function , *i.e. *in solving This is done by Newton type methods. A zero of the simple shooting function satisfies the necessary conditions of optimality given by the PMP.

**Remark 4. ** depends on , and we write the homotopic function (instead of shooting function) when we consider the parameter as an independent variable. With HamPath, it is possible to solve for in for instance, using differential path following methods. In this case, we say that is a homotopic parameter.

If we note then the trajectory ceases to be optimal after the time if is a critical point of the mapping . In this case, we name a conjugate time and the associated conjugate point. Let give the following definition.

**Definition 5** (Jacobi field). The differential equation on

*is called a Jacobi equation, or variational system, along the extremal . A solution of the Jacobi equation along is called a Jacobi field and we write*

As a conclusion, it comes that if is a conjugate time then

is not of full rank .

#### Summary of HamPath possibilities.

The idea of HamPath is to produce a collection of numerical functions in order to solve general optimal control problems. The user must only implement the maximized Hamiltonian (definition 1) and the shooting function (definition 3). The different numerical functions can be used to:

- compute the solutions of the exponential mapping (definition 2);
- solve the shooting equations (definition 3);
- compute the set of zeros of a homotopic function
- compute the Jacobi fields (definition 5) and check if there exists any conjugate points.

#### Schematic view of HamPath.

At the bottom of the following figure, the part below the doted lines is a fragment of the outputs of HamPath which is in the language chosen during the installation: it may be chosen among Fortran, Python, Matlab (only) or both Matlab and Octave. AD stands for Automatic Differentiation, RK for Runge-Kutta integrators used to solve ordinary differential equations, Newton for Newton-type methods to solve non-linear equations and QR for QR factorization.