Trait programinduction::GP [] [src]

pub trait GP: Send + Sync + Sized {
    type Expression: Clone + Send + Sync;
    type Params;
    fn genesis<R: Rng>(
        &self,
        params: &Self::Params,
        rng: &mut R,
        pop_size: usize,
        tp: &Type
    ) -> Vec<Self::Expression>;
fn mutate<R: Rng>(
        &self,
        params: &Self::Params,
        rng: &mut R,
        prog: &Self::Expression
    ) -> Self::Expression;
fn crossover<R: Rng>(
        &self,
        params: &Self::Params,
        rng: &mut R,
        parent1: &Self::Expression,
        parent2: &Self::Expression
    ) -> Vec<Self::Expression>; fn tournament<'a, R: Rng>(
        &self,
        rng: &mut R,
        tournament_size: usize,
        population: &'a [(Self::Expression, f64)]
    ) -> &'a Self::Expression { ... }
fn init<R: Rng, O: Sync>(
        &self,
        params: &Self::Params,
        rng: &mut R,
        gpparams: &GPParams,
        task: &Task<Self, Self::Expression, O>
    ) -> Vec<(Self::Expression, f64)> { ... }
fn evolve<R: Rng, O: Sync>(
        &self,
        params: &Self::Params,
        rng: &mut R,
        gpparams: &GPParams,
        task: &Task<Self, Self::Expression, O>,
        population: &mut Vec<(Self::Expression, f64)>
    ) { ... }
fn init_and_evolve<R: Rng, O: Sync>(
        &self,
        params: &Self::Params,
        rng: &mut R,
        gpparams: &GPParams,
        task: &Task<Self, Self::Expression, O>,
        generations: u32
    ) -> Vec<(Self::Expression, f64)> { ... } }

A kind of representation suitable for genetic programming.

Implementors of GP must provide methods for genesis, mutate, crossover. A Task provides a fitness function via its oracle.

Associated Types

An Expression is a sentence in the representation. Tasks are solved by Expressions.

Extra parameters for a representation go here.

Required Methods

Important traits for Vec<u8>

Create an initial population for a particular requesting type.

Mutate a single program.

Important traits for Vec<u8>

Perform crossover between two programs. There must be at least one child.

Provided Methods

Important traits for Vec<u8>

Important traits for Vec<u8>

Implementors