1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
use pheno::Phenotype; /// Contains a sequential `Simulator` implementation. pub mod seq; /// Contains private information. mod shared; /// A `Simulation` is an execution of a genetic algorithm. pub trait Simulation<T: Phenotype> : shared::Selector<T> { /// Run the simulation. fn run(&mut self); /// Get the best performing result of the simulation when it has ended. fn get(&self) -> Box<T>; } /// The type of parent selection. pub enum SelectionType { /// Select only the `count * 2` best performing parents in terms of fitness. Maximize { /// Should be larger than 0. count: u32, }, /// Perform tournament selection with tournament size `count`, running `num` tournaments. /// This yields `num * 2` parents. Tournament { /// Indicates the number of tournaments. Should be larger than 0. num: u32, /// Should be larger than 0. count: u32, }, /// Perform Stochastic Universal Sampling to do the selection. /// Selects `count * 2` parents. Stochastic { /// Should be larger than 0. count: u32, }, } /// Whether to maximize or to minimize the fitness value pub enum FitnessType { Maximize, Minimize, }