Struct darwin_rs::simulation::Simulation
[−]
[src]
pub struct Simulation<T: Individual + Send + Sync> { pub type_of_simulation: SimulationType, pub num_of_threads: usize, pub habitat: Vec<Population<T>>, pub total_time_in_ms: f64, pub simulation_result: SimulationResult<T>, }
The Simulation
type. Contains all the information / configuration for the simulation to run.
Use the SimulationBuilder
in order to create a simulation.
Fields
type_of_simulation | How should the simulation stop ? |
num_of_threads | The number of threads to use to speed up calculation. |
habitat | All the populations for the simulation. Contains all individuals for the simulation. |
total_time_in_ms | The total run time for the simulation. This will be calculated once the stimulation has finished. |
simulation_result | The result of the simulation: |
Methods
impl<T: Individual + Send + Sync + Clone> Simulation<T>
[src]
This implements the two functions run
and print_fitness
for the struct Simulation
.
fn run(&mut self)
This actually runs the simulation.
Depending on the type of simulation (EndIteration
, EndFactor
or EndFitness
)
the iteration loop will check for the stop condition accordingly.
fn print_fitness(&self)
This is a helper function that the user can call after the simulation stops in order to see all the fitness values for all the individuals that participated to the overall improvement.