Trait revonet::ea::Individual [] [src]

pub trait Individual {
    fn new() -> Self;
fn init<R: Rng>(&mut self, size: usize, _: &mut R);
fn get_fitness(&self) -> f32;
fn set_fitness(&mut self, fitness: f32);
fn to_vec(&self) -> Option<&[f32]>;
fn to_vec_mut(&mut self) -> Option<&mut Vec<f32>>; fn to_net(&mut self) -> Option<&MultilayeredNetwork> { ... }
fn to_net_mut(&mut self) -> Option<&mut MultilayeredNetwork> { ... }
fn set_net(&mut self, net: MultilayeredNetwork) { ... } }

Trait representing functionality required to evolve an individual for optimization and NN tuning tasks.

Contains functions to retrieve genes or neural network from an individual and get/set its fitness.

Required Methods

Creates a new individual with empty set of genes and NAN fitness.

Initializes an individual by allocating random vector of genes using Gaussian distribution.

Arguments

  • size - number of genes.
  • rng - mutable reference to the external RNG.

Return current fitness value.

Update fitness value.

Return vector of genes.

Return mutable vector of genes.

Provided Methods

Return MultilayeredNetwork object with weights assigned according to the genes' values.

Return mutable MultilayeredNetwork object with weights assigned according to the genes' values.

Update individual's MultilayeredNetwork object and update genes according to the network weights.

Arguments:

  • net - neural network to update from.

Implementors