[][src]Trait genevo::termination::Termination

pub trait Termination<A> where
    A: Algorithm
{ fn evaluate(&mut self, state: &State<A>) -> StopFlag; fn reset(&mut self) { ... } }

A Termination defines a condition when the Simulation shall stop.

One implementation of the trait Termination should only handle one single termination condition. In the simulation multiple termination conditions can be combined through combinators.

Required methods

fn evaluate(&mut self, state: &State<A>) -> StopFlag

Evaluates the termination condition and returns a StopFlag depending on the result. The StopFlag indicates whether the simulation shall stop or continue.

In case the simulation shall be stopped, i.e. a StopFlag::StopNow is returned also a the reason why the simulation shall be stopped is returned. This reason should explain to the user of the simulation, why the simulation has been stopped.

Loading content...

Provided methods

fn reset(&mut self)

Resets the state of this Termination condition. This function is called on each Termination instance when the simulation is reset.

This function only needs to be implemented by an implementation of Termination if it has its own state, e.g. for counting or tracking of progress.

The default implementation does nothing.

Loading content...

Implementors

impl<A> Termination<A> for GenerationLimit where
    A: Algorithm
[src]

fn reset(&mut self)[src]

impl<A> Termination<A> for TimeLimit where
    A: Algorithm
[src]

fn reset(&mut self)[src]

impl<G, F, E, S, C, M, R> Termination<GeneticAlgorithm<G, F, E, S, C, M, R>> for FitnessLimit<G, F> where
    G: Genotype,
    F: Fitness + Send + Sync,
    E: FitnessFunction<G, F>,
    E: FitnessFunction<G, F> + Sync,
    S: SelectionOp<G, F>,
    C: CrossoverOp<G> + Sync,
    M: MutationOp<G> + Sync,
    R: ReinsertionOp<G, F>, 
[src]

fn reset(&mut self)[src]

impl<T1, T2, A> Termination<A> for And<T1, T2, A> where
    T1: Termination<A>,
    T2: Termination<A>,
    A: Algorithm
[src]

fn reset(&mut self)[src]

impl<T1, T2, A> Termination<A> for Or<T1, T2, A> where
    T1: Termination<A>,
    T2: Termination<A>,
    A: Algorithm
[src]

fn reset(&mut self)[src]

Loading content...