Trait ge::Genome
[−]
[src]
pub trait Genome { fn genesis<R>(rng: &mut R) -> Self
where
R: Rng; fn mutate<R>(&self, rate: f32, rng: &mut R) -> Self
where
R: Rng; fn cross<R>(&self, other: &Self, rng: &mut R) -> Self
where
R: Rng; fn fitness<T>(&self) -> T
where
T: Ord; }
Interface for randomly mutating, crossing over, and creating a genome used in genetic algorithms
Required Methods
fn genesis<R>(rng: &mut R) -> Self where
R: Rng,
R: Rng,
Create an entirely random Genome
fn mutate<R>(&self, rate: f32, rng: &mut R) -> Self where
R: Rng,
R: Rng,
Randomly mutate a single "gene" in the genome
fn cross<R>(&self, other: &Self, rng: &mut R) -> Self where
R: Rng,
R: Rng,
Cross this orgnanism with another
Arguments
other
: the "mate" of this organism that will cross genomes
fn fitness<T>(&self) -> T where
T: Ord,
T: Ord,
Get the fitness of the organism