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

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

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.

Provided methods

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.

Implementors