**3. The Pontryagin Maximum Principle**

The Pontryagin maximum principle allows one to transform the problem of optimization on infinite dimensional space to the boundary-value problem for the system of differential Equations (1). Let us construct Hamilton function for this problem on the base of the system (1) and the quality functional (2) without terminal conditions

$$H(\mathbf{x}^1, \dots, \mathbf{x}^M, \mathbf{u}^1, \dots, \mathbf{u}^M, \boldsymbol{\psi}) = -f\_0(\mathbf{x}^1, \dots, \mathbf{x}^M, \mathbf{u}^1, \dots, \mathbf{u}^M) -$$

$$a \sum\_{i=1}^r \sum\_{j=1}^M \mu^2(\boldsymbol{\varphi}\_i(\mathbf{x}^j)) - b \sum\_{j=1}^{M-1} \sum\_{k=j+1}^M \mu^2(\boldsymbol{\chi}(\mathbf{x}^j, \mathbf{x}^k)) + \boldsymbol{\psi}^T \mathbf{f}^j(\mathbf{x}^j, \mathbf{u}^j), \tag{12}$$

where *ψ* = [*ψ*<sup>1</sup> ... *ψn*] *<sup>T</sup>* is a vector of conjugate variables, *n* = *n*<sup>1</sup> + ... + *nM*,

$$\psi = -\frac{\partial H(\mathbf{x}^1, \dots, \mathbf{x}^M \mathbf{u}^1, \dots, \mathbf{u}^M, \psi)}{\partial \mathbf{x}^1, \dots, \partial \mathbf{x}^M}. \tag{13}$$

According to the Pontryagin maximum principle, a necessary condition for optimal control is the maximum of Hamilton function (12)

$$\max\_{\mathbf{u}^1 \in \mathbb{U}^1, \dots, \mathbf{u}^M \in \mathbb{U}^M} H(\mathbf{x}^1, \dots, \mathbf{x}^M, \mathbf{u}^1, \dots, \mathbf{u}^M, \boldsymbol{\psi}). \tag{14}$$

Pontryagin maximum principle allows one to transform the optimal control problem to a boundary-value problem. It is necessary to find the initial values of conjugate variables so that the state vector reaches terminal conditions (3). To solve the boundary-value problem, we have to solve a finite dimensional problem of nonlinear programming with the following functional

$$F(\mathbf{q}) = \sum\_{j=1}^{M} ||\mathbf{x}^{j}(t\_{f,j}) - \mathbf{x}^{j,f}|| \to \min\_{\mathbf{q} \in \mathbf{Q}}.\tag{15}$$

where **q** = [*q*<sup>1</sup> ... *qn*] *<sup>T</sup>*, Q is a limited compact set, *qi* = *ψi*(0), *i* = 1, . . . , *n*,

$$\sum\_{i=1}^{n} q\_i^2 = 1.\tag{16}$$

In a boundary-value problem, it is not known exactly when it is necessary to check the boundary conditions (15). The maximum principle does not provide equations for definition of terminal time *tf* ,*<sup>j</sup>* of the control process, while a numerical search of some possible solutions may not reach the terminal condition. To avoid this problem, let us add parameter *qn*+<sup>1</sup> for the time limit of reaching the terminal state. As a result, the goal functional for the boundary-value problem is the following

$$\tilde{F}(\mathbf{q}) = \sum\_{j=1}^{M} \|\mathbf{x}^{j}(t^{+} + q\_{n+1}) - \mathbf{x}^{f,j}\| \to \min\_{\mathbf{q} \in \tilde{\mathbf{Q}}}.\tag{17}$$

where **q˜** = [*q*<sup>1</sup> ... *qn*+1] *<sup>T</sup>*,Q˜ <sup>=</sup> <sup>Q</sup> <sup>×</sup> [*q*<sup>−</sup> *<sup>n</sup>*+1; *<sup>q</sup>*<sup>+</sup> *<sup>n</sup>*+1], *q*<sup>−</sup> *<sup>n</sup>*+1, *<sup>q</sup>*<sup>+</sup> *<sup>n</sup>*+<sup>1</sup> are low and up limitations of the parameter *qn*+1. During the search process, we can decrease time *t* <sup>+</sup> according to sign of parameter *qn*+1. If found parameter *qn*+<sup>1</sup> is less than zero, then *t* <sup>+</sup> is decreased and the interval for values of parameter [*q*<sup>−</sup> *<sup>n</sup>*+1; *<sup>q</sup>*<sup>+</sup> *<sup>n</sup>*+1] is also narrowed.
