Expand description
The crossover phase where two parent chromosomes create two children chromosomes. The selection phase determines the order the parent pairing (overall with fitter first).
The selection_rate is the fraction of parents which are selected for reproduction. This selection adds offspring to the population, the other parents do not. The population now grows by the added offspring, as the parents are not replaced yet. Value should typically be between 0.4 and 0.8. High values risk of premature convergence. Low values reduce diversity if overused.
The crossover_rate (or recombination-rate) is the fraction of selected parents to crossover, the remaining parents just clone as offspring. Value should typically be between 0.5 and 0.8. High values converge faster, but risk losing good solutions. Low values have poor exploration and risk of premature convergence
Normally the crossover adds children to the popluation, thus increasing the population_size above the target_population_size. Selection will reduce this again in the next generation
Structs§
- Crossover
Clone - Children are clones of the parents. Allowed for unique genotypes.
- 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).
- 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).
- Crossover
Rejuvenate - Drop non-selected parents, then clone top parents to repopulate up to target_population_size, then rejuvenate selected parents to children in place. No copying of chromosomes for creating the offspring itself, only for repopulating the dropped non-selected parents (smaller fraction) Allowed for unique genotypes.
- Crossover
Single Gene - Crossover a single gene between the parents. The gene position is chosen with uniform probability.
- 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.
- 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)