# Approaches to Numerical Solution of Optimal Control Problem Using Evolutionary Computations
## 2 Optimal Control Problem for Group of Robots
Dynamic phase constraints that consider collisions between robots are the following:  
\[\delta(\mathbf{x}^{i},\mathbf{x}^{i+k})=r_{0}^{2}-\left(x_{1}^{i}-x_{1}^{i+k} \right)^{2}-\left(x_{2}^{i}-x_{2}^{i+k}\right)^{2}\leq 0,\ i=\overline{1,N-1},\ k= \overline{1,N-i}, \tag{5}\]  
where \(r_{0}\) is the radius of dynamic phase constraints, i.e., outside dimensions of the robot, that cannot be violated. Terminal states of robots are  
\[x_{i}^{j}-x_{i}^{f,j}=0,\ i=1,2,3,\ j=\overline{1,N}. \tag{6}\]  
The quality function is  
\[J=t_{f}\rightarrow\min, \tag{7}\]  
where  
\[t_{f}=\left\{ \begin{array}{ll}t,\ \ \text{if}\ \ t<t^{+}\text{and}\ \max\{\Delta_{j}:j=\overline{1,\ N}\}\leq\varepsilon\\ t^{+},\ \ \text{otherwise}\end{array} \right.,\]  
where \(\Delta_{j}=\sqrt{\sum\limits_{i=1}^{3}\left(x_{i}^{j}(t)-x_{i}^{f,j}\right)}\), \(j=\overline{1,\ N}\), \(t^{+}\) is the maximal control time, and \(\varepsilon\) is a small positive value. Phase constraints are included in the quality criterion using the Heaviside function. \[\widetilde{J}=t_{f}+\sum\limits_{i=1}^{B}\sum\limits_{j=1}^{N}\int\limits_{0} ^{t_{f}}\delta(\beta_{i}(\mathbf{x}^{j}))dt+\sum\limits_{i=1}^{N-1}\sum \limits_{k=i+1}^{N-i}\int\limits_{0}^{t_{f}}\delta(\delta(\mathbf{x}^{i}, \mathbf{x}^{i+k}))dt\rightarrow\min. \tag{8}\]  
When we need to obtain a differentiable quality function, we substitute the Heaviside function with a sigmoid function as follows:  
\[\widetilde{\widetilde{J}}=t_{f}+\sum\limits_{i=1}^{B}\sum\limits_{j=1}^{N} \int\limits_{0}^{t_{f}}\frac{dt}{1+\exp(-A\beta_{i}(\mathbf{x}^{j}))}+\sum \limits_{i=1}^{N-1}\sum\limits_{k=i+1}^{N-i}\int\limits_{0}^{t_{f}}\frac{dt}{1 +\exp(-A\delta(\mathbf{x}^{i},\mathbf{x}^{i+k}))}\rightarrow\min,\]  
where \(A\) is a large positive value. The solution of the optimal control problem is a control vector \(\widetilde{\mathbf{u}}(\cdot)=\left[ \begin{array}{cccc}\widetilde{u}_{1}( \cdot)&\ldots&\widetilde{u}_{m}\end{array} \right.(\cdot)\right]^{T}\). An optimal control problem can be transformed into a finite-dimensional optimization one by discretization of control in time. To apply nonlinear programming methods, we approximated \(\widetilde{u}_{i}(\cdot)\), \(i=\overline{1,m}\) by the functional dependences with a finite number of parameters using piecewise linear approximations. Let us introduce a constant time interval \(\Delta t=t_{i+1}-t_{i}\), \(i=0,\ldots,d=\lfloor t^{+}/\Delta t\rfloor\). The control is searched for in the form of piecewise linear functions between parameters \(q_{i}\), \(i=\overline{0,d}\). The control is constrained by  
\[u(t)=\left\{ \begin{array}{ll}u^{+},&\text{if }\widetilde{u}\geq u^{+}\\ u^{-},&\text{if }\widetilde{u}\leq u^{-}\\ \widetilde{u}^{\prime},&\text{otherwise}\end{array} \right.. \tag{9}\]  
The task is to find a vector of parameters,  
\[\mathbf{q}=[ \begin{array}{cccc}q_{1}&\ldots&q_{(d+1)2N}\end{array} ]^{T}, \tag{10}\]  
where \(q^{-}\leq q_{i}\leq q^{+}\), \(i=1,\ldots,(d+1)2N\). For the search of parameters, we used evolutionary and population methods, as well as a random search.