Expand description
The crossover phase where every two parent chromosomes create two children chromosomes. The selection phase determines the order and the amount of the parent pairing (overall with fitter first).
If the selection dropped some chromosomes due to the selection_rate, the crossover will restore the population towards the target_population_size by keeping the best parents alive. Excess parents are dropped.
Structs§
- Crossover
Clone - Children are clones of the parents. The population is restored towards the target_population_size by keeping the best parents alive. Excess parents are dropped.
- Crossover
Multi Gene - Crossover multiple genes between the parents. The gene positions are chosen with uniform probability. Choose between allowing duplicate crossovers of the same gene or not (~2x slower). The population is restored towards the target_population_size by keeping the best parents alive. Excess parents are dropped.
- Crossover
Multi Point - Crossover multiple gene positions from which on the rest of the genes are taken from the other parent. This goes back and forth. The gene positions are chosen with uniform probability. Choose between allowing duplicate crossovers on the same point or not (not much slower, as crossover itself is relatively expensive). The population is restored towards the target_population_size by keeping the best parents alive. Excess parents are dropped.
- Crossover
Single Gene - Crossover a single gene between the parents. The gene position is chosen with uniform probability. The population is restored towards the target_population_size by keeping the best parents alive. Excess parents are dropped.
- Crossover
Single Point - Crossover a single gene position from which on the rest of the genes are taken from the other parent. The gene position is chosen with uniform probability. The population is restored towards the target_population_size by keeping the best parents alive. Excess parents are dropped.
- Crossover
Uniform - Crossover with 50% probability for each gene to come from one of the two parents.
Actually implemented as
CrossoverMultiGene::new(<genes_size> / 2, allow_duplicates=true)