Expand description
Variation operators: the genome-agnostic traits (Initializer, Mutation,
Crossover, Repair, Selection), closure adapters, combinators, and ready-made
operators per representation in the submodules.
Every trait method is generic over the generator, which keeps the hot path monomorphised;
closures are accepted through *_fn adapters that receive &mut dyn Rng.
| Module | Genome |
|---|---|
real | Vec<f64> within Bounds |
discrete | bit strings Vec<bool> and integer strings Vec<u32> |
permutation | permutations Vec<usize> of 0..n |
sequence | any Vec<T>: fixed-length crossovers |
chain | GLEAM action chains: variable-length Vec<T> and parameterised actions |
selection | parent selection over a cost slice |
Re-exports§
pub use selection::Selection;
Modules§
- chain
- GLEAM action chains (Blume and Jakob; Jakob 2021): variable-length chromosomes of typed, parameterised actions, with gene-level and chain-level mutations and crossovers that accept parents of different lengths.
- discrete
- Operators for bit strings
Vec<bool>and integer stringsVec<u32>with per-gene domains: random initialisation, bit flips, random reset and creep mutation. Crossovers for both live insequence. - permutation
- Operators for permutations
Vec<usize>of0..n: swap, insertion, inversion and scramble mutation; partially mapped (PMX), order (OX), cycle (CX) and edge recombination (ERX) crossover. Every operator maps permutations to permutations (property-tested). - real
- Operators for real vectors
Vec<f64>: boxBounds, uniform and Latin hypercube initialisation, Gaussian, polynomial and uniform-reset mutation, SBX, BLX-α and arithmetic crossover, and clamping or reflecting repair. - selection
- Parent selection over a slice of costs (smaller is better): tournament, truncation, fitness-proportional, linear ranking, stochastic universal sampling and uniform.
- sequence
- Positional crossovers for any
Vec<T>: one-point, two-point and uniform. They also accept parents of different lengths: cut points lie within the shorter parent and tails are exchanged whole, so lengths are swapped, never invented.
Structs§
- Crossover
Fn - A closure used as a
Crossover; created bycrossover_fn. - Initializer
Fn - A closure used as an
Initializer; created byinitializer_fn. - Mix
- Applies
awith probabilityweight_a / (weight_a + weight_b), otherwiseb; the building block of GLEAM-style operator mixes. Nest it for more than two operators, or usemix. - Mutation
Fn - A closure used as a
Mutation; created bymutation_fn. - NoCrossover
- The crossover that returns copies of the parents, for mutation-only runs.
- NoMutation
- The mutation that changes nothing, for crossover-only or selection-only runs.
- NoRepair
- The repair that changes nothing.
- Repair
Fn - A closure used as a
Repair; created byrepair_fn. - Seeded
- An initialiser that yields caller-supplied seed genomes first (for example previous plans
or heuristic solutions), then falls back to
inner. - Sometimes
- Applies
innerwith probabilityprobability, otherwise leaves the genome unchanged. - Then
- Applies
first, thensecond. - Variation
- The variation operators of algorithms that bring their own selection (NSGA-II, NSGA-III, MOEA/D, MAP-Elites): initialisation, crossover, mutation and repair.
Traits§
- Crossover
- Produces two children from two parents.
- Initializer
- Creates random genomes for an initial population.
- Mutation
- Changes one genome in place.
- Repair
- Makes a genome valid again after variation (genotypic repair).
Functions§
- crossover_
fn - Turns a closure
FnMut(&G, &G, &mut dyn Rng) -> [G; 2]into aCrossover. - initializer_
fn - Turns a closure
FnMut(&mut dyn Rng) -> Ginto anInitializer. - mix
- Creates a
Mixchoosingaandbin proportion to their (non-negative) weights. - mutation_
fn - Turns a closure
FnMut(&mut G, &mut dyn Rng)into aMutation. - repair_
fn - Turns a closure
FnMut(&mut G, &mut dyn Rng)into aRepair.