Trait ga::traits::Genome [] [src]

pub trait Genome {
    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

Create an entirely random Genome

Arguments

  • rng: Random number generator to pull randomness from

Randomly mutate the Genome

Argument

  • rate: probability (0.0, 1.0) of each codon mutating
  • rng: Random number generator to pull randomness from

Return

New mutated genome

Cross this genome with another

Arguments

  • other: the "mate" of this organism that will cross genomes
  • rng: Random number generator to pull randomness from

Return

A randomly crossed genome

Get the fitness of the organism

Implementors