# Universal Approach to Solution of Optimization Problems by Symbolic Regression
## 2 Optimization Problem in Non-Euclidean Space  
Let us start from some basic definitions. Definition 1: Optimization in a non-numerical space is an optimization when a target function is calculated for elements in a space with one metrics, and the search of optimal solution is performed in a space with other metrics, and these two metrics do not coincide. In many optimization problems, a target function is calculated for elements in the space of real vectors or functions. Metrics in these spaces are Euclidean distance or the maximal distance between functions for one value of argument  
\[d_{\mathbb{R}}(\mathbf{x}^{1},\mathbf{x}^{2})=\|\mathbf{x}^{1}-\mathbf{x}^{2} \|_{2}=\sqrt{\sum_{i=1}^{n}(x_{i}^{1}-x_{i}^{2})}, \tag{1}\]\[d_{C}(y_{1}(\cdot),y_{2}(\cdot))=\max_{a\leqslant t\leqslant b}|y_{1}(t)-y_{2}(t)|, \tag{2}\]  
\[d_{\mathbf{C}}(\mathbf{y}^{1}(\cdot),\mathbf{y}^{2}(\cdot))=\max_{a\leqslant t \leqslant b}\|\mathbf{y}^{1}(t)-\mathbf{y}^{2}(t)\|_{2}, \tag{3}\]  
where \(\mathbf{x}^{1},\mathbf{x}^{2}\in\mathbb{R}^{n}\), \(y_{1}(\cdot),y_{2}(\cdot)\in C[a,b]\), \(\mathbf{y}^{1}(\cdot),\mathbf{y}^{2}(\cdot)\in\mathbf{C}[a,b]\). \[f_{0}(\mathbf{x}):\mathbb{R}^{n}\rightarrow\mathbb{R}^{1}, \tag{4}\]  
\[J(y(\cdot)):C[a,b]\rightarrow\mathbb{R}^{1}, \tag{5}\]  
\[J(\mathbf{y}(\cdot)):\mathbf{C}[a,b]\rightarrow\mathbb{R}^{1}, \tag{6}\]  
When calculating the target function, arithmetic operations are performed on the components of possible solutions. The search for the optimal solution consists of performing certain actions on the elements of spaces, for example, calculating the gradient, addition, multiplication by scalars, etc., which also includes arithmetic operations on the components of possible solutions in order to obtain new possible solutions with the optimal value of the target function. There are optimization problems in which the target function is calculated over the elements of possible solutions presented in spaces with metrics (1)-(3), but the possible solutions and the actions performed on them to obtain new solutions are presented in a different space, with different metrics. Let us call this generalized space the code space  
\[\mathbf{s}\in\mathbb{S}, \tag{7}\]  
where \(\mathbf{s}\) is a code of possible solution from space with numerical metrics (1)-(3), \(\mathbb{S}\) is a code space. There is a one-to-one correspondence between the code space and the spaces with numerical metrics  
\[\mathbf{x}=\Omega_{\mathbb{R}}(\mathbf{s}):\mathbb{S}\rightarrow\mathbb{R}^{n}, \tag{8}\]  
\[y(\cdot)=\Omega_{C}(\mathbf{s}):\mathbb{S}\to C[a,b], \tag{9}\]  
\[\mathbf{y}(\cdot)=\Omega_{\mathbf{C}}(\mathbf{s}):\mathbb{S}\rightarrow\mathbf{ C}[a,b]. \tag{10}\]  
It is also possible to define metrics in the code space, for example, the Levenshtein [25] or Hamming distance or some other, but these metrics will not be the same for the corresponding elements from the spaces with distances (1)-(3). It means that if the inequality is satisfied  
\[d_{C}(y_{1}(\cdot),y_{2}(\cdot))=\max_{a\leqslant t\leqslant b}|y_{1}(t)-y_{2}(t)|, \tag{2}\]0  
where \(\mathbf{s}^{1},\mathbf{s}^{2},\mathbf{s}^{3}\in\mathbb{S}\), then the inequality  
\[d_{C}(y_{1}(\cdot),y_{2}(\cdot))=\max_{a\leqslant t\leqslant b}|y_{1}(t)-y_{2}(t)|, \tag{2}\]1  
\(G\in\{\mathbb{R},C,\mathbf{the vector space into the space of Gray codes. Genetic operations are performed on the Grey codes. Then, to evaluate the new codes of possible solutions they are decoded into real vectors. Such complications in the search are most likely associated with the fact that the problem of global optimization is being solved, and the target function is not unimodal. This work is devoted to the methods of symbolic regression. These techniques emerged as a development in genetic programming [1]. Here, we use symbolic regression to find the mathematical expression of some function coded in some way. Then, GA is applied to these codes to find the optimal solution. Note that classical GA performs the crossover operation similar to the crossover of genes in living organisms.