Trait Gene

Source
pub trait Gene {
    // Required methods
    fn empty(inputs: usize, outputs: usize) -> Self;
    fn is_same_species_as(&self, other: &Self) -> bool;
    fn cross(&self, other: &Self) -> Self;
    fn mutate<T: GlobalNeatCounter>(&mut self, neat: &mut T);
    fn predict(&self, input: &[f64], activate: fn(f64) -> f64) -> Vec<f64>;
}
Expand description

Trait required for a genome to be used by neat

Required Methods§

Source

fn empty(inputs: usize, outputs: usize) -> Self

returns an empty genome with only input and output nodes and no connections

Source

fn is_same_species_as(&self, other: &Self) -> bool

checks if the other genome is same species as self

Source

fn cross(&self, other: &Self) -> Self

method for cross over of two genomes

Source

fn mutate<T: GlobalNeatCounter>(&mut self, neat: &mut T)

method for mutation of the genome

Source

fn predict(&self, input: &[f64], activate: fn(f64) -> f64) -> Vec<f64>

constructs the neural network and returns the output as a vec of floats

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§