Expand description
The selection phase, where chromosomes are lined up for pairing in the crossover phase, dropping the chromosomes outside of the selection_rate. Ensure the selection_rate >= 0.5 otherwise the population will decline and can’t restore.
For some problem domains, where there is little incremental improvement in fitness, it is better to keep all parents around as a jumping off point for the new generations. Achieve this by setting the selection_rate to 0.5. This way the top 50% will reproduce and also be cloned to restore the population size. All lesser offspring is eliminated by selection, keeping the top 50% around each generation, until actually improved upon.
Structs§
- Select
Elite - Simply sort the chromosomes with fittest first. Then take the selection_rate of the populations best and drop excess chromosomes. This approach has the risk of locking in to a local optimum.
- Select
Tournament - Run tournaments with randomly chosen chromosomes and pick a single winner. Do this untill the selection_rate of the population is reached and drop excess chromosomes. This approach kind of sorts the fitness first, but not very strictly. This preserves a level of diversity, which avoids local optimum lock-in.