Struct darwin_rs::simulation_builder::SimulationBuilder
[−]
[src]
pub struct SimulationBuilder<T: Individual + Send + Sync> { // some fields omitted }
This is a helper struct in order to build (configure) a valid simulation. See builder pattern: https://en.wikipedia.org/wiki/Builder_pattern
Methods
impl<T: Individual + Send + Sync> SimulationBuilder<T>
[src]
This implementation contains all the helper method to build (configure) a valid simulation
fn new() -> SimulationBuilder<T>
Start with this method, it must always be called as the first one. It creates a default simulation with some dummy (but invalid) values.
fn iterations(self, iterations: u32) -> SimulationBuilder<T>
Set the total number of iterations for the simulation and thus sets the simulation
type to EndIteration
. (Only usefull in combination with EndIteration
).
fn factor(self, factor: f64) -> SimulationBuilder<T>
Set the improvement factor stop criteria for the simulation and thus sets the simulation
type to EndFactor
. (Only usefull in combination with EndFactor
).
fn fitness(self, fitness: f64) -> SimulationBuilder<T>
Set the minimum fitness stop criteria for the simulation and thus sets the simulation
type to EndFitness
. (Only usefull in combination with EndFactor
).
fn threads(self, threads: usize) -> SimulationBuilder<T>
Sets the number of threads in order to speed up the simulation.
fn add_population(self, population: Population<T>) -> SimulationBuilder<T>
Add a population to the simulation.
fn finalize(self) -> Result<T>
This checks the configuration of the simulation and returns an error or Ok if no errors where found.