Skip to main content

Module mutation

Module mutation 

Source
Expand description

Mutation operators for real-valued genomes.

Every mutation is an in-place-ish tensor transform: it consumes a population tensor and returns a new one with noise added per gene. The noise is sampled from a caller-supplied host rng and materialised 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.

Functions§

bit_flip_mutation
Bit-flip mutation on a binary Tensor<B, 2, Int> population.
gaussian_mutation
Isotropic Gaussian mutation with a scalar step-size σ.
gaussian_mutation_per_row
Per-individual anisotropic Gaussian mutation.
uniform_reset
Uniform-reset mutation: replace each gene with a fresh sample from U(lo, hi) with probability p.