Trait ga::traits::Individual
[−]
[src]
pub trait Individual { fn genesis(rng: &mut Rng) -> Self; fn mutate(&self, rate: f32, rng: &mut Rng) -> Self; fn cross(&self, other: &Self, rng: &mut Rng) -> Self; fn fitness<O>(&self) -> O
where
O: Ord; }
Interface for randomly mutating, crossing over, and creating a genome used in genetic algorithms
Required Methods
fn genesis(rng: &mut Rng) -> Self
fn mutate(&self, rate: f32, rng: &mut Rng) -> Self
Randomly mutate the Genome
Argument
rate
: probability (0.0, 1.0) of each codon mutatingrng
: Random number generator to pull randomness from
Return
New mutated genome
fn cross(&self, other: &Self, rng: &mut Rng) -> Self
Cross this genome with another
Arguments
other
: the "mate" of this organism that will cross genomesrng
: Random number generator to pull randomness from
Return
TODO
fn fitness<O>(&self) -> O where
O: Ord,
O: Ord,
Get the fitness of the organism