[−][src]Struct optlib::genetic::GeneticOptimizer
The main struct for an user. GeneticOptimizer
implements Optimizer
trait and keep all parts
of genetic algorithm as trait objects: Creator
, Pairing
, Cross
, Mutation
, Selection
,
StopChecker
and, if needed, Logger
.
The trait run genetic algorithm.
T
- type of a point in the search space for goal function (chromosomes).
Methods
impl<T: Clone> GeneticOptimizer<T>
[src]
pub fn new(
goal: Box<dyn Goal<T>>,
stop_checker: Box<dyn StopChecker<T>>,
creator: Box<dyn Creator<T>>,
pairing: Box<dyn Pairing<T>>,
cross: Box<dyn Cross<T>>,
mutation: Box<dyn Mutation<T>>,
selections: Vec<Box<dyn Selection<T>>>,
pre_births: Vec<Box<dyn PreBirth<T>>>,
loggers: Vec<Box<dyn Logger<T>>>
) -> GeneticOptimizer<T>
[src]
goal: Box<dyn Goal<T>>,
stop_checker: Box<dyn StopChecker<T>>,
creator: Box<dyn Creator<T>>,
pairing: Box<dyn Pairing<T>>,
cross: Box<dyn Cross<T>>,
mutation: Box<dyn Mutation<T>>,
selections: Vec<Box<dyn Selection<T>>>,
pre_births: Vec<Box<dyn PreBirth<T>>>,
loggers: Vec<Box<dyn Logger<T>>>
) -> GeneticOptimizer<T>
Create a new GeneticOptimizer
.
pub fn replace_pairing(&mut self, pairing: Box<dyn Pairing<T>>)
[src]
Replace the trait object of pairing algorithm.
pub fn replace_cross(&mut self, cross: Box<dyn Cross<T>>)
[src]
Replace the trait object of cross algorithm.
pub fn replace_mutation(&mut self, mutation: Box<dyn Mutation<T>>)
[src]
Replace the trait object of mutation algorithm.
pub fn replace_selection(&mut self, selections: Vec<Box<dyn Selection<T>>>)
[src]
Replace the trait object of selection algorithm.
pub fn replace_pre_birth(&mut self, pre_births: Vec<Box<dyn PreBirth<T>>>)
[src]
Replace the trait object of selection algorithm.
pub fn replace_stop_checker(&mut self, stop_checker: Box<dyn StopChecker<T>>)
[src]
Replace the trait object of stop checker algorithm.
pub fn next_iterations(&mut self) -> Option<(&T, f64)>
[src]
Do new iterations of genetic algorithm.
Trait Implementations
impl<T: Clone> Optimizer<T> for GeneticOptimizer<T>
[src]
impl<T: Clone> AlgorithmWithAgents<T> for GeneticOptimizer<T>
[src]
type Agent = Individual<T>
fn get_agents(&self) -> Vec<&Self::Agent>
[src]
Auto Trait Implementations
impl<T> !Send for GeneticOptimizer<T>
impl<T> !Sync for GeneticOptimizer<T>
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,