# Universal Approach to Solution of Optimization Problems by Symbolic Regression
## 5 Computational Experiments  
### Case 1. Control Synthesis for Mobile Robot  
As an example, let us consider the application of the variational symbolic regression method for control synthesis of a mobile robot. In the problem, it is necessary to find a mathematical expression for the control function that transfers the object from the set of initial conditions to the terminal one with the optimal value of the quality criterion. The mathematical model [29] of control object is  
\[ \begin{array}{rcl}\dot{x}_{1}&=&0.5(u_{1}+u_{2})\cos(x_{3}),\\ \dot{x}_{2}&=&0.5(u_{1}+u_{2})\sin(x_{3}),\\ \dot{x}_{3}&=&0.5(u_{1}-u_{2}),\end{array}  \tag{73}\]  
where \(\mathbf{x}=[x_{1}\ x_{2}\ x_{3}]^{T}\) is a state vector, \(\mathbf{u}=[u_{1}\ u_{2}]^{T}\) is a control vector. The control is constrained  
\[u^{-}=-10\leqslant u_{i}\leqslant 10=u^{+},\ \ i=1,2. \tag{74}\]The initial condition is a set of 30 states  
\[ \begin{array}{ll}\mathbf{X}_{0}&=&\{\mathbf{x}^{0,1}=[2\;2.5\;5\pi/12]^{T}, \mathbf{x}^{0,2}=[1\;2.5\;5\pi/12]^{T},\mathbf{x}^{0,3}=[0\;2.5\;5\pi/12]^{T},\\ &\mathbf{x}^{0,A}=[-1\;2.5\;5\pi/12]^{T},\mathbf{x}^{0,5}=[-2\;2.5\;5\pi/12]^{T},\\ &\mathbf{x}^{0,6}=[2\;-2.5\;5\pi/12]^{T},\mathbf{x}^{0,7}=[1\;-2.5\;5\pi/12]^{T},\\ &\mathbf{x}^{0,8}=[0\;-2.5\;5\pi/12]^{T},\mathbf{x}^{0,9}=[-1\;-2.5\;5\pi/12]^{ T},\\ &\mathbf{x}^{0,10}=[-2\;-2.5\;5\pi/12]^{T},\mathbf{x}^{0,11}=[2\;2.5\;0]^{T}, \mathbf{x}^{0,12}=[1\;2.5\;0]^{T},\\ &\mathbf{x}^{0,13}=[0\;2.5\;0]^{T},\mathbf{x}^{0,14}=[-1\;2.5\;0]^{T},\mathbf{ x}^{0,15}=[-2\;2.5\;0]^{T},\\ &\mathbf{x}^{0,16}=[2\;-2.5\;0]^{T},\mathbf{x}^{0,17}=[1\;-2.5\;0]^{T},\mathbf{ x}^{0,18}=[0\;-2.5\;0]^{T},\\ &\mathbf{x}^{0,19}=[-1\;-2.5\;0]^{T},\mathbf{x}^{0,20}=[-2\;-2.5\;0]^{T},\\ &\mathbf{x}^{0,21}=[2\;2.5\;-5\pi/12]^{T},\mathbf{x}^{0,22}=[1\;2.5\;-5\pi/12]^ {T},\\ &\mathbf{x}^{0,23}=[0\;2.5\;-5\pi/12]^{T},\mathbf{x}^{0,24}=[-1\;2.5\;-5\pi/12 ]^{T},\\ &\mathbf{x}^{0,25}=[-2\;2.5\;-5\pi/12]^{T},\mathbf{x}^{0,26}=[2\;-2.5\;-5\pi/1 2]^{T},\\ &\mathbf{x}^{0,27}=[1\;-2.5\;-5\pi/12]^{T},\mathbf{x}^{0,28}=[0\;-2.5\;-5\pi/ 12]^{T},\\ &\mathbf{x}^{0,29}=[-1\;-2.5\;-5\pi/12]^{T},\mathbf{x}^{0,30}=[-2\;-2.5\;-5 \pi/12]^{T}\}.\end{array}  \tag{75}\]  
The terminal condition is  
\[\mathbf{x}^{\prime}=[0\;0\;0]^{T}. \tag{76}\]  
It is necessary to find a control as a function of state coordinates  
\[u_{i}=h_{i}(x_{1},x_{2},x_{3}),\;u^{-}\leqslant h_{i}(x_{1},x_{2},x_{3}) \leqslant u^{+},\;i=1,2, \tag{77}\]  
to minimize the functional  
\[J=\sum_{k=1}^{30}\left(t_{f,k}+\sqrt{\sum_{i=1}^{3}x_{i}^{2}(t_{f,k},\mathbf{ x}^{0,k})}\right), \tag{78}\]  
where  
\[t_{f,k}=\left\{ \begin{array}{l}t,\,\mbox{if}\sqrt{\sum_{i=1}^{3}x_{i}^{2}(t,\mathbf{x}^{0,k})}<\varepsilon\\ t^{+},\,\mbox{otherwise}\end{array} \right., \tag{79}\]  
\(\varepsilon=0.01\), \(t^{+}=1.5\) s, \(x_{i}(t,\mathbf{x}^{0,k})\) is a partial solution of ODE system (73) with control (77) for initial state \(\mathbf{x}^{0,k}\), \(k\in\{1,\ldots,30\}\). To solve the problem, we used variational CGP and obtained the following control function  
\[h_{i}(x_{1},x_{2},x_{3})=\left\{ \begin{array}{l}u^{-},\,\mbox{if}\;\tilde{u}_ {i}<u^{-}\\ u^{+},\,\mbox{if}\;\tilde{u}_{i}>u^{+}\\ \tilde{u}_{i},\,\mbox{otherwise}\end{array} \right.,\;\;i=1,2, \tag{80}\]  
where  
\[ \begin{array}{ll}\tilde{u}_{1}&=&\mbox{sgn}(\arctan(q_{2}x_{2}\,/(q_{3}x_{1 })+1/x_{1}))(\exp(q_{3}\arctan(q_{2}x_{2}\,/(q_{3}x_{1})+\\ &1/x_{1}))-1)-3q_{3}x_{1}-x_{3}\\ \tilde{u}_{2}&=&((-q_{3}x_{1}-x_{2}-\mbox{sgn}(q_{2}x_{2}\,/(q_{3}x_{1})+1/x_{ 1})\times\\ &(\exp(q_{3}\arctan(q_{2}x_{2}/(q_{3}x_{1})+1/x_{1}))-1))^{3}+1+q_{1})^{3} \end{array}  \tag{81}\]  
\(q_{1}=2.74121\), \(q_{2}=1.82129\), \(q_{3}=3.88281\). The value of quality criterion (78) for the solution is \(J=34.6372\). Trajectories of mobile robot from different initial states to terminal one on plane are presented on Figure 5. To solve the problem, the system (73) was integrated 2,386,440 times. The calculations were performed on Intel Core i7, 2.8 GHz. The computational time was approx. 15 min.