Skip to main content

Module crossover

Module crossover 

Source
Expand description

Recombination / crossover operators for real-valued genomes.

Operators in this module consume two parent tensors of shape (N, D) and produce an offspring tensor of the same shape. Seeding the per-generation RNG via B::seed(device, ...) is the caller’s responsibility — see crate::strategy for the canonical pattern.

§BLX-α

For each gene, child ∈ U(min(a,b) − α·|a−b|, max(a,b) + α·|a−b|). A common default is α = 0.5.

§Uniform

For each gene, child takes parent A’s value with probability p and parent B’s otherwise. Pure swap crossover — no blending — so the distribution is exactly preserved. A binary-genome variant (binary_uniform_crossover) operates on Tensor<B, 2, Int> with values in {0, 1}.

Functions§

binary_uniform_crossover
Binary uniform crossover on Tensor<B, 2, Int> populations.
blx_alpha
BLX-α crossover between two parent populations.
uniform_crossover
Uniform crossover: per-gene Bernoulli swap between parents.