Trait rsgenetic::pheno::Phenotype [] [src]

pub trait Phenotype: Clone {
    fn fitness(&self) -> f64;
    fn crossover(&self, &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.

Required Methods

fn fitness(&self) -> f64

Calculate the fitness of this Phenotype.

fn crossover(&self, &Self) -> Self

Perform crossover on this Phenotype, returning a new Phenotype.

fn mutate(&self) -> Self

Perform mutation on this Phenotype, returning a new Phenotype.

Implementors