Trait genevo::genetic::FitnessFunction
source · [−]pub trait FitnessFunction<G, F>: Clone where
G: Genotype,
F: Fitness, {
fn fitness_of(&self, a: &G) -> F;
fn average(&self, a: &[F]) -> F;
fn highest_possible_fitness(&self) -> F;
fn lowest_possible_fitness(&self) -> F;
}
Expand description
Defines the evaluation function to calculate the Fitness
value of a
Genotype
based on its properties.
Required methods
fn fitness_of(&self, a: &G) -> F
fn fitness_of(&self, a: &G) -> F
Calculates the Fitness
value of the given Genotype
.
Calculates the average Fitness
value of the given Fitness
values.
fn highest_possible_fitness(&self) -> F
fn highest_possible_fitness(&self) -> F
Returns the very best of all theoretically possible Fitness
values.
fn lowest_possible_fitness(&self) -> F
fn lowest_possible_fitness(&self) -> F
Returns the worst of all theoretically possible Fitness
values.
This is usually a value equivalent to zero.