Skip to main content

point_mutation

Function point_mutation 

Source
pub fn point_mutation<F: FunctionSet>(
    chromosome: &mut [Symbol],
    head_len: usize,
    alphabet: &Alphabet<F>,
    rate: f32,
    rng: &mut dyn Rng,
)
Expand description

Applies per-gene point mutation in place, respecting locus classes.

Each locus mutates independently with probability rate. A head locus (index < head_len) is replaced by any symbol; a tail locus is replaced by a terminal drawn from Alphabet::terminal_range. The tail invariant is therefore preserved without any repair.