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 populationn_iter
: number of iterations to run algorithmreplace_rate
: rate at which individuals will be repleaced with results of crossovermut_rate
: rate of mutation in individualsrng
: 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