## 5 Experiment and Results
### Preparation for Experiment  
The object-orientated architecture of GA, with defined classes for genes, chromosomes, and populations, facilitated the implementation of key functionalities, including selection, crossover, mutation, and elitism. This approach also allowed for detailed tracking of the optimisation process across generations, enabling the identification of changes in individuals and aiding in troubleshooting potential issues. In the GA, a gene is represented as an object storing the value of a specific hyperparameter, along with its range and type. The class also includes methods for mutating the gene, which use the information stored in the instance variables. The mutation function, triggered when mutation conditions are met, applies one of the following mutation methods:  
* Boundary mutation;
* Uniform mutation;
* Non-uniform mutation. The chromosome is an object that groups genes and allows the creation of new chromosomes, distinct from the parent individuals. It is initialised with a list of Gene objects and includes functions to randomise gene mutations based on the mutation probability. Additionally, it implements a fitness function that stores hyperparameter values, which are then passed to the RL agent training function. The training function returns the agent's performance over the last 50 episodes, which the GA uses to adapt the hyperparameter configuration. The population class manages the generation of chromosomes, the selection of parents, crossover, mutation, and elitism. Each population object represents a generation in the GA' iterative process. Two selection methods are implemented:* Tournament selection: Randomly groups chromosomes into sets of four, selecting the highest-fitness individual from each group to move forward. The choice of \(k=4\) balances selection pressure with computational costs. Larger values of \(k\) tend to favour high-fitness chromosomes prematurely, leading to potential convergence in suboptimal regions, whereas smaller values introduce greater randomness and can slow the rate of improvement due to additional overhead in the fitness function evaluation. Adopting \(k=4\) preserves sufficient diversity while keeping the number of evaluations manageable. * Roulette selection: Assigns selection probabilities to chromosomes based on their fitness values and uses these probabilities to randomly select four parents. The population class also includes various crossover methods, such as one-point, multi-point, uniform, and arithmetic crossover. First, regardless of the chosen crossover method, the parents who are to undergo recombination are selected. * One-point crossover: A crossover point is randomly chosen within the range from 1 to the number of genes \(-1\) to avoid situations where the offspring inherits genes from only one parent. Pairs are drawn from selected individuals, where the first offspring inherits the first part of the chromosome from the first parent and the second part from the second parent. Similarly, the second offspring inherits parts of the chromosome in reverse--the first part from the second parent and the second part from the first;
* Multi-point crossover: A specified number of crossover points are randomly selected, ensuring that they do not repeat and fall within the range from 1 to the number of genes \(-1\). The pairs of parents are then drawn and, according to the designated points, their chromosomes are divided. The first offspring inherits the odd sections of chromosomes from the first parent and the even sections from the second, while the second offspring inherits the odd sections from the second parent and the even sections from the first;
* Uniform crossover: The selected individuals are paired, and two random binary masks of length equal to the number of optimised hyperparameters are created. The drawn masks must differ from each other.