Module genetic_algorithm::compete
source · Expand description
The competition phase, where chromosomes are lined up for pairing in the crossover phase. Excess chromosomes, beyond the target_population_size, are dropped.
Structs§
- Simply sort the chromosomes with fittest first. This approach has the risk of locking in to a local optimum.
- Run tournaments with randomly chosen chromosomes and pick a single winner. Do this target_population_size times until the required population level is reached. This approach kind of sorts the fitness first, but not very strictly. This preserves a level of diversity, which avoids local optimum lock-in.