Trait rsgenetic::pheno::Phenotype [−][src]
pub trait Phenotype<F>: Clone where
F: Fitness, { fn fitness(&self) -> F; fn crossover(&self, other: &Self) -> Self; fn mutate(&self) -> Self; }
Defines what a Phenotype is. A Phenotype can breed with other Phenotypes, resulting in a single child. A Phenotype can also be mutated. Finally, a Phenotype has a certain fitness value associated with it.
If reasonable, it is recommended to have your implementation derive Copy
.
Required Methods
fn fitness(&self) -> F
Calculate the fitness of this Phenotype.
fn crossover(&self, other: &Self) -> Self
Perform crossover on this Phenotype, returning a new Phenotype.
fn mutate(&self) -> Self
Perform mutation on this Phenotype, returning a new Phenotype.