Skip to content

Formulation ​

This page fixes the mathematical setting and the notation used throughout the documentation. The @def syntax and the functional API both transcribe it into code.

The problem ​

An optimal control problem (OCP) with fixed initial and final times consists in minimising the cost functional, written in Bolza form,

where the state   and the control   are functions of time  . They are subject to the differential constraint (the dynamics)

and to other constraints such as

The first two lines are box constraints, is a path constraint, and gathers the boundary conditions. An equality constraint is the case where both bounds are equal.

If  , the cost is said to be in Lagrange form; if  , it is in Mayer form. Maximising is the same as minimising , so a cost can be written with → max as well.

When , and do not depend on explicitly, the problem is autonomous. See Time dependence for how to check it on a model.

Free times and extra variables ​

The initial time and the final time may also be free, that is, part of the optimisation variables:

More generally, a vector   of additional variables can be optimised together with and . It may contain , , or any other free parameter, and the cost, the dynamics and the constraints may all depend on it:

with, in addition, box constraints on :

The control-free case ​

Nothing above requires a control: taking   (no ) is a legitimate degenerate case. It is used to fit or optimise the parameters of a dynamical system rather than to steer it. See Control-free problems for how to declare and solve such problems.

Notation and conventions ​

The pages on the indirect method (Flows, Geometry and the examples) use the following conventions. They refer to this section rather than redefine them.

Dimensions.  ,  ,  . A dimension-one quantity is a scalar, in the mathematics as in the code.

Pseudo-Hamiltonian. With the costate   and the constant  ,

The normal case is   ;   is the abnormal case. In the code, is a PseudoHamiltonian.

Maximum principle. Along an optimal trajectory, the control maximises . When this maximisation gives the control in feedback form , the maximised Hamiltonian is

a Hamiltonian in the code. Its Hamiltonian vector field    gives the extremals:

State constraints. A state constraint is a path constraint that does not depend on the control. It is written in the normalised form  . Along a boundary arc, where  , the pseudo-Hamiltonian gains the term   , with a multiplier  :

Minimal time. A free final time to minimise is written as a Mayer cost,  . Then  , so   , and the transversality condition reads

Writing the same cost in Lagrange form,   , gives instead     and   for an autonomous problem. Both are correct; the documentation uses the Mayer form.

Variable costate. When the variable is optimised, the indirect method treats it as a constant state ( ) with its own costate :

for a Mayer term that depends on and no boundary condition that involves . For instance, with the cost term and   ,   .

See also ​