## 2 Materials and Methods
### Methods
```
1 Input: stopCondition, nominalConv, populationSize, chromosomeSize Output: bestChromosome, resultTest1
21\(P\leftarrow\) RandomPopulation()
2 for\(h\gets 1\) to stopConditiondo
3 serial\(\gets 0\)
4 fori\(\leftarrow\) 1 to nominalConvdo
5.rfrag\(\leftarrow\) random[0, 5]
6.fragment\(\leftarrow\) (24 \(\times\)rfrag)
7.ifmodule(h+1) = 0 do
8.serial\(\gets\) 6 + i
9.elseserial\(\gets\) 23 - i
10.endif
11.RandomSeed()
12.FitnessEval(\(P\))
13.CrossPop\(\leftarrow\) Cross(\(P\))
14.SortedPop\(\leftarrow\) FitnessEval2(CrossPop)
15.NewPop\(\leftarrow\) SelfRegulation(SortedPop)
16.forj\(\leftarrow\) 1 to populationSizedo
17.fork\(\leftarrow\) 1 to chromosomeSizedo
18.P[j][k]\(\leftarrow\)NewPop[j][k]
19.endfor
20.endfor
21.endfor
22.RandomBinary(sizeChromosome, \(P\)[1])
23.RandomBinary(sizeChromosome, \(P\)[2])
24.RandomBinary(sizeChromosome, \(P\)[3])
25.inputFile\(\leftarrow\) openFile(\"resultsTest1.txt\", \"r\")
26.set\(g\gets 0\)
27.whileinputFile\(\
eq\) EOFdo
28.inputData\(\leftarrow\) readChar(inputFile)
29.Auxlgl\(\leftarrow\)inputData
30.\(g\gets g+1\)
31.endwhile
32.closeFile(inputFile)
33.outputFile\(\leftarrow\) openFile(\"resultsTest1.txt\", \"w\")
34.set\(e\gets 0\)
35.while\(e\)\(<\)\(g\)do
36.outputFile\(\leftarrow\) Aux[e]
37.\(e\gets e+1\)
38.endwhile
39.outputFile\(\leftarrow\) bestFitness
40.closeFile(outputFile)
41.bestFile\(\leftarrow\) openFile(\"bestChromosome.txt\",\"w\")
42.fori\(\leftarrow\) 1 to chromosomeSizedo
43.bestFile\(\leftarrow\)_P[populationSize-1][ i]
44.endfor
45.closeFile(bestFile)
46.endfor
```  
**Algorithm 3** Main algorithm  
We set the seed that generates the numbers pseudo-randomly as a function of time at the beginning of each inner cycle (line 11). In line 12, _FitnessEval_ function evaluates the initial population fitness and orders them from highest to lowest. Subsequently, in line 13, we use the function _Cross_, which receives the initial population already evaluated and sorted and creates ten more chromosomes that, together with the initial population, will form the cross-population (_CrossPop_). In line 14 of the main algorithm, we use _FitnessEval_2, which evaluates the cross-population and sorts it from highest to lowest fitness (_SortedPop_). Then, in line 15, we use the _SelfRegulation_ function, which selects the two best chromosomes from the sorted population (_SortedPop_) and randomly selects three different chromosomes, forming the new population (_NewPop_) of five chromosomes. From lines 16 to 20, the new population (_NewPop_) is stored in the initial population (_P_), closing the internal cycle in line 21 of the main algorithm. Once this cycle is finished, the _RandomBinary_ function is used to create three chromosomes in the last positions of the initial population (lines 22, 23, and 24). Note that the first two positions contain the two best chromosomes from the previous cycle. In the following lines (25 to 32), we open the file named _resultsTest1_, save its content in an auxiliary array, add the best distance achieved in this iteration, and overwrite this file (lines 33 to 40). This action saves the progress of the algorithm over the generations. Finally, we overwrite the file _bestChromosome_, where we store the binary string of the best chromosome of this iteration (lines 41 to 45). We close the outer loop at line 46, and the main algorithm concludes once the stop condition is reached. In the function _FitnessEval_, in Algorithm 4, we go through the input population (line 2) and evaluate each of its chromosomes using the function _Fitness_ (line 3), saving the result in another array (line 4), as well as saving the position of the corresponding chromosome (line 5). Subsequently, we use bubble sorting from lines 7-18 for the second array from highest to lowest fitness. Once sorted, we obtained the numbers of the corresponding chromosomes sorted and saved the chromosome in an auxiliary array (lines 19 to 24). Then, it is stored in the original array (lines 25 to 30).