# Neuroevolution for Parameter Adaptation in Differential Evolution
## 2 Materials and Methods
### Proposed Approach
After the crossover and mutation steps, the newly generated offspring is checked for cycles in the network graph. If cycles are present, then the offspring is discarded and generated again. The evaluation of NEAT solutions was performed on a set of benchmark functions from the CEC 2022 competition on numerical optimization. The benchmark consists of 12 functions defined for 10-dimensional and 20-dimensional search spaces. To evaluate a single parameter adaptation heuristic designed by NEAT, 10 independent runs were performed for each of the 12 test functions in 10\(D\) case. On each of the runs, the result consisted of the best reached function value and the computational resource spent to reach the goal, if it was reached. The CEC 2022 competition rules introduced the ranking of solutions based on both convergence speed and the best-found solution, where, between the two algorithms which found the solution, the one that did it faster was ranked higher. In order to take such a mechanism into account, the following evaluation metric was proposed:  
\[EM_{fn,r}= \begin{cases}f_{r,NFE_{max}},&\text{if }f_{r,NFE_{max}}>10^{-8}\\ \frac{NFE_{s}}{NFE_{max}}\cdot 10^{-9},&\text{otherwise}\end{cases}  \tag{15}\]  
where \(NFE_{s}\) is the number of goal function evaluations where the \(10^{-8}\) threshold was reached, \(f_{r,NFE_{max}}\) is the best function value at the end of the search on run \(r\) and \(fn\) is the function number. Such an evaluation metric allows two criteria to be combined into a single one when those runs in which the algorithm found the global optimum are better (have smaller \(EM_{r}\)) than those runs in which the optimum was not found. The quality of each parameter adaptation heuristic designed by NEAT is described by a matrix of 12 by 10 values, which should be properly utilized in the search process. The classical selection mechanisms, such as tournament selection, are not able to efficiently compare such evaluation metrics, so for this purpose, lexicase selection was applied [56]. Lexicase selection implements a parent selection mechanism, which allows population diversity to be increased by giving a chance to be selected to each individual capable of \begin{table}
\begin{tabular}{c c} \hline \hline
**Mutation Type** & **Probability to Use** \\ \hline Add connection & 0.1 \\ Adding node to connection & 0.3 \\ Mutating random node & 0.2 \\ Assigning random weights & 0.2 \\ Difference-based mutation & 0.1 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Probabilities of mutation operators in NEAT. solving some part of the problem. Lexicase selection was shown to improve the problem-solving power in program synthesis [57], as well as classifier systems [58] and other approaches [59]. As the evaluation metric values in the current study are real numbers, \(\epsilon\)-lexicase selection was applied [60] because the standard case passing criteria is too strict for continuous problems. Lexicase selection works by adding the population into the selection pool, shuffling the fitness values (\(EM\) matrix in this case, flattened to a vector \(EMF_{t}\), \(t=1,\ldots,120\)), removing the cases with fitness values larger than the fitness of the first case \(+\epsilon_{1}\) level, and if more than one individual remains, then the first case is removed and the algorithm is repeated. If there are no more fitness cases, or only one case in the pool, then the parent individual is chosen from the pool. The \(\epsilon_{t}\) level is determined for a case \(t\) as follows:  
\[\epsilon_{t}=median_{j}(EMF_{t,j}-mean(EMF_{t})). \tag{16}\]  
The idea of applying \(\epsilon\)-lexicase selection in this study was to allow NEAT to evolve specialists solutions are capable of solving certain types of optimization problems, so that later such individuals could be combined to obtain universal parameter adaptation heuristics. Another mechanism in addition to lexicase selection applied in this study is the behavior-based speciation inspired by [61].