## 3 Research Background
### The Genetic Algorithm (GA)  
The GA is a search algorithm inspired by natural selection. This is a breeding process [38; 39]. Initially, a GA is composed of individuals called populations, which represent possible solutions to specific problems. Subsequently, through selection, crossover, and mutation, the GA iteratively creates new individuals, called generations, from the old population [38; 39]. Each generated individual was evaluated using a fitness value that reflected the quality of the new individual in detecting intrusions.  
In the IDS proposed in the current study, the XCS employs two algorithms, the GA and a cuckoo search algorithm, to boost ID accuracy. The fundamental improvement introduced in the present study to the GA is the use of the XCS to select individuals to perform crossover and mutation to produce new individuals who replace their precursors.  
* The basic elements and processes of the GA involved in the production of new individuals, which include the proposed modification of the GA [38; 39].
* Population Populations are defined as individuals and classifiers that represent the possible solutions. Initially, all individuals are randomly generated to represent the current generation, which is considered the initial search space of the GA.
* Evaluation Fitness functions are used to evaluate the accuracy of detection for each individual.
* Encoding Encoding is one of the most important features of a GA because it represents the solutions. The correct representation method is the best way to improve the effectiveness of GA in solving problems. In the IDS proposed herein, binary encoding was applied.
* Selection  
One of the main contributions of the proposed IDS is the adaptation of a selection method to improve detection accuracy. Thus, the XCS is used instead of traditional and popular selection methods such as roulette wheel selection (RWS), rank selection, and tournament selection. The CS successfully selects individuals for crossover and mutation  
Figure 1: XCS primary components [33; 34].  
to increase the intrusion of the DR and accuracy. In addition, it represents an alternative selection method that helps overcome the rapid convergence and slow termination problems.
* Crossover  
Crossover is the process by which individuals exchange the values of their features to produce new individuals who have the characteristics of their parents [40]. The probability of crossover (Pc) determines how often the crossover is performed. If Pc is set to zero, the new individuals will have identical copies of their parents.
* Replacement  
The chromosomes were compared to determine the best one. Popular replacement methods include binary and triple tournament methods. The binary tournament method uses two chromosomes. Subsequently, it chooses the best chromosome based on its function and ignores the second chromosome. The triple tournament method replaces the worst two chromosomes and considers only the chromosome with the highest functional value.  
Furthermore, the GA comprises two operators employed to reproduce new individuals over subsequent generations: crossover and mutation.
* Crossover  
Crossover is one of the features of the GA that distinguishes it from other revolutionary algorithms. It is the process of the exchange of chromosomes (genes) between two individuals to reproduce new chromosomes that inherit the behaviors of their parents. The implementation of the crossover for all chromosomes is dependent on Pc. This probability specifies the frequency at which crossover is performed. However, when no crossover occurs, the offspring are exact copies of their parents. Several crossover methods are known, including uniform, single crossover, and two-point crossover.
* Mutation  
In the mutation process, the feature value is changed randomly to avoid local maxima and to generate new individuals that are different from the existing ones to further explore the search space. The decision to implement mutations for all feature values depended on the mutation probability (Pm).