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. Each operator draws its randomness from a caller-supplied host rng and materialises the draws via Tensor::from_data, rather than seeding the process-wide backend RNG (B::seed + Tensor::random). Host sampling keeps results reproducible across thread schedules: the global Flex RNG mutex would otherwise interleave draws with sibling tests under the parallel runner.

§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-α (Blend Crossover α) between two parent populations.
uniform_crossover
Uniform crossover: per-gene Bernoulli swap between two parents.