# Calibration of an Adaptive Genetic Algorithm for Modeling Opinion Diffusion
## 2 Materials and Methods
### Genetic Algorithm
#### 2.2.2 Operators  
We apply selection, blending, crossover, mutation, and survival operators to our population of chromosomes. The application of all operators constitutes a single iteration of the algorithm and produces a new generation of chromosomes. We use \"iteration\" and \"generation\" interchangeably except where a distinction between the process of producing a new generation (in this case referred to as an iteration) and the generation itself is meaningful. We repeat the process until stopping criterion are met, modifying the behavior of the operators as the generations progress to shift from exploration of the parameter space to exploitation of existing solutions, making this an adaptive genetic algorithm as suggested by the literature [2; 17; 18; 19]. Descriptions of the operators that include examples are available in [PERSON] et al. and the code is linked in the Data Availability Statement [9]. **Selection:** In order to preserve the best solution identified in any previous generation, we use selection with elitism: identifying the fittest chromosome (the chromosome producing the lowest value of the objective function), and exempting it from the remaining operators until the next generation. After identifying the elite chromosome, we attempt gene swapping between that chromosome and the remaining population of non-elite chromosomes. We exempt either the original elite chromosome or row-swapped elite chromosome, depending on the fitness of each, and proceed with either the original remaining population or the row-swapped remaining population as appropriate. **Blending:** Using the even number of chromosomes remaining after the selection operator, we randomly pair all chromosomes. For each pair of chromosomes, blending occurs independently for each gene with probability \(p_{b}\). For a pair of chromosomes \(B\) and \(C\), if blending occurs for row \(i\), a blending factor \(\beta\) is drawn from a \(Unif(0,1)\) distribution. The new genes (\(B_{i}^{*}\) and \(C_{i}^{*}\)) are the weighted averages of the current genes and corresponding genes from the paired chromosome according to:  
\[B_{i}^{*}=\beta B_{i}+(1-\beta)C_{i}\quad\text{and}\quad C_{i}^{*}=(1-\beta)B _{i}+\beta C_{i}. \tag{3}\]  
While this can result in substantial changes to genes \(B_{i}\) and \(C_{i}\) when these genes are very different, we use the blending operator primarily to make slight changes to a population of similar chromosomes for later generations in order to refine a solution as we shift from exploration to exploitation, meaning we begin with a lower value of \(p_{b}\) and increase the probability over time. **Crossover:** The within-parent crossover operator defined by [PERSON], [PERSON], and [PERSON] uses a crossover point after the decimal point, resulting in small changes to the genes [2]. Since both the blending and mutation operator either already accomplish this goal or can easily be modified in later generations to do so, we use a more drastic version of this operator to explore our much larger parameter space. Crossover occurs independently for each gene within each chromosome with probability \(p_{c}\), with all values not fixed at zero randomly reshuffled within the gene, preserving the sum-to-one constraint and any fixed values. Since exploring the parameter space is desirable during early generations, but drastic changes to chromosomes are not helpful in later generations, we begin with a higher value of \(p_{c}\) which decreases over time. **Mutation:** While the mutation operator is also used to make slight changes to genes for later generations, the primary purpose of this operator is to explore the boundaries of the parameter space: solutions where a gene contains a weight where \(w_{ij}=1\) and all others are zero (or with \(w_{ij}=1-w_{fixed}\) where \(w_{fixed}\) is the sum of all fixed weights within the row).