## Introduction

The HamPath package  is a an open-source software developed to solve optimal control problems via indirect methods but also to study Hamiltonian systems. HamPath is developed since 2009 by members of the APO (Algorithmes Parallèles et Optimisation) team from Institut de Recherche en Informatique de Toulouse, jointly with colleagues from the Université de Bourgogne and Inria Sophia. HamPath is distributed under the GNU Lesser General Public License, and is free for both academic and industrial use.

The main use of HamPath is to study and solve optimal control problems depending on parameters and of the general form: $\left\{ \begin{array}{l} \displaystyle J(x(\cdot),u(\cdot),t_0,t_f) = \displaystyle g(t_0,x(t_0),t_f,x(t_f),\Lambda) + \int_{t_0}^{t_f} f^0(t,x(t),u(t),\Lambda) \, \mathrm{d}\, t \longrightarrow \min \\[1.0em] \dot{x}(t) = \displaystyle f(t,x(t),u(t),\Lambda), \quad u(t) \in U, \quad t \in [t_0,t_f] \text{ a.e.}, \\[1.0em] (t_0,x(t_0),t_f,x(t_f)) \in M_b, \\[1.0em] x(t) \in X_c \subset X, \quad t \in [t_0,t_f]. \end{array} \right.$

Here, $x(\cdot)$ is the state, $u(\cdot)$ the control and $\Lambda$ the parameters. #### Keywords.

• Geometric optimal control;
• State and/or control constraints;
• Maximum principle;
• Simple and multiple shooting methods;
• Homotopy (or differential path following);
• Second order conditions of optimality (conjugate points);

#### From the user sight.

Applying the maximum principle leads to define a set of Hamiltonians and a Boundary Value Problem, which is described by a set of non linear equations, that can be grouped together in what we call the shooting equations. HamPath compiles the Fortran codes of the (maximized) Hamiltonians and the shooting function (defined by the shooting equations) and produces a collection of Matlab, Octave, Fortran or Python functions (depending on the chosen user interface) which allows to compute the solutions of the Hamiltonian systems but also to solve the implemented shooting equations.

However, it is well-known that the main difficulty to solve such problems – with indirect methods based on Newton algorithms – is to find a good initial guess. So a differential path following method has been implemented which makes HamPath the natural extension of the cotcot package . It is also possible to compute Jacobi fields of the Hamiltonian systems to check order two conditions of optimality and look for conjugate points, as cotcot does.