Function ge::genetic_algorithm [] [src]

pub fn genetic_algorithm<G, R, O>(
    pop_size: usize,
    n_iter: usize,
    replace_rate: f32,
    mutate_rate: f32,
    rng: R
) -> Vec<(G, O)> where
    G: Genome + Clone,
    R: Rng,
    O: Ord

Genetic algorithm

Arguments

  • pop_size: number of individuals in the population
  • n_iter: number of iterations to run algorithm
  • replace_rate: rate at which individuals will be repleaced with results of crossover
  • mut_rate: rate of mutation in individuals
  • rng: Random number generator that will be used to get randomness

Return

The final generation of n_iter iterations, zipped with its fitness, sorted by fitness