Trait genetic_algorithm::strategy::Strategy

source ·
pub trait Strategy<G: Genotype> {
    // Required methods
    fn call(&mut self);
    fn best_generation(&self) -> usize;
    fn best_fitness_score(&self) -> Option<FitnessValue>;
    fn best_genes(&self) -> Option<G::Genes>;
    fn flush_reporter(&mut self, _output: &mut Vec<u8>);

    // Provided method
    fn best_genes_and_fitness_score(&self) -> Option<(G::Genes, FitnessValue)> { ... }
}

Required Methods§

source

fn call(&mut self)

source

fn best_generation(&self) -> usize

source

fn best_fitness_score(&self) -> Option<FitnessValue>

source

fn best_genes(&self) -> Option<G::Genes>

source

fn flush_reporter(&mut self, _output: &mut Vec<u8>)

strategy can be boxed, need a way to get to the reporter

Provided Methods§

Implementors§

source§

impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select, E: Extension, SR: StrategyReporter<Genotype = G>> Strategy<G> for Evolve<G, M, F, S, C, E, SR>

source§

impl<G: HillClimbGenotype, F: Fitness<Genotype = G>, SR: StrategyReporter<Genotype = G>> Strategy<G> for HillClimb<G, F, SR>

source§

impl<G: PermutateGenotype, F: Fitness<Genotype = G>, SR: StrategyReporter<Genotype = G>> Strategy<G> for Permutate<G, F, SR>