## 4 Selection of Computational Intelligence and Reinforcement Learning Solutions
### Genetic Algorithms  
The GA is a metaheuristic inspired by biological evolution. The GA considers a population of individuals, which represent candidate solutions for the optimization problem. Each individual has a genotype, which represents its specific coordinate on the search space, and a phenotype, i.e., the evaluation of the objective function in the corresponding coordinate, which represents a \"fitness\" value capturing how well the individual adapts to the current environment. By evolving populations through selection and recombination, which generate new individuals with better fitness values, the GA naturally explores the search space in an attempt to discover global optima.  
More specifically, as the pseudo-code in Algorithm 1 illustrates, the GA implements several phases, beginning with the initial setup of a population. Then, the population is evolved through a number of generations--each one created through a process that involves the selection of individuals for mating and the recombination and mutation of genetic material.  
```
1:procedureGA(target_function,conf)
2:\(P\gets initialize\_random\_population(conf)\)
3:\(generation\gets 1\)
4:\(fittest\gets evaluate\_population(P,target\_function)\)
5:repeat
6:\(P_{next}\leftarrow\emptyset\)
7:\(parents\gets select\_parents(P,conf)\)
8:for all\(p_{1},p_{2}\in parents\)do
9:\(c_{1},c_{2}\gets crossover(p_{1},p_{2},conf)\)
10:\(P_{next}\gets mutate(c_{1},conf),mutate(c_{2},conf)\)
11:endfor
12:\(P\gets P_{next}\)
13:for all\(m\in P\)do
14:\(m.fitness\gets target\_function(m.genotype)\)
15:endfor
16:\(fittest\leftarrow\operatorname*{argmax}_{m\in P}\ m.fitness\)
17:\(generation\gets generation+1\)
18:until\(generation\geq conf.max\_generations\)
19:return\(fittest.genotype,fittest.fitness\)
20:endprocedure
```  
**Algorithm 1** Genetic Algorithm.  
Newer generations have a different genetic material, which has the potential to create fitter individuals. With an exchange or recombination of different genes, the evolutionary processes implemented by the GA promote the generation of improved solutions, and their propagation to future generations, at the same time introducing new genes, maintaining a certain degree of diversity in the population--thus preventing premature convergence. This enables the exploration of the search space in a relatively robust and efficient fashion.  
The GA presents many customization and tuning opportunities. In fact, the genotype of individuals can be represented in many different ways, such as bitstrings, integers, and real values, and the choice of chromosome encoding represents a crucial aspect of the search performance and convergence speed of the GA [48]. In addition, the GA can use different selection, recombination, and mutation operators. The binary tournament is the most-used selection scheme due to its easy implementation, minimal computational overhead, and resilience to excessively exploitative behaviors, which other selection operatorsoften exhibit [51]. Popular recombination operators include 1-point, 2-point, and uniform crossover, and a plethora of random mutation operators have been proposed in the literature, ranging from bit flip mutation to geometrically distributed displacements with hypermutation [35].  
Choosing the specific operators and parameters that control the selection and mutation processes, it is possible to easily modulate the behavior of GAs, making them more explorative or exploitative. Both choices are dependent also on the problem domain and the representation of the chromosomes. The final goal of the GA is to converge to an optimal population, which means that it is not able to produce new offspring notably different from the previous.