[−][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<'a, T: Clone> GeneticOptimizer<'a, T>
[src]
pub fn new(
goal: Box<dyn Goal<T>>,
stop_checker: Box<dyn StopChecker<T> + 'a>,
creator: Box<dyn Creator<T> + 'a>,
pairing: Box<dyn Pairing<T> + 'a>,
cross: Box<dyn Cross<T> + 'a>,
mutation: Box<dyn Mutation<T> + 'a>,
selections: Vec<Box<dyn Selection<T> + 'a>>,
pre_births: Vec<Box<dyn PreBirth<T> + 'a>>,
loggers: Vec<Box<dyn Logger<T> + 'a>>
) -> GeneticOptimizer<'a, T>
[src]
goal: Box<dyn Goal<T>>,
stop_checker: Box<dyn StopChecker<T> + 'a>,
creator: Box<dyn Creator<T> + 'a>,
pairing: Box<dyn Pairing<T> + 'a>,
cross: Box<dyn Cross<T> + 'a>,
mutation: Box<dyn Mutation<T> + 'a>,
selections: Vec<Box<dyn Selection<T> + 'a>>,
pre_births: Vec<Box<dyn PreBirth<T> + 'a>>,
loggers: Vec<Box<dyn Logger<T> + 'a>>
) -> GeneticOptimizer<'a, 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<'a, T: Clone> Optimizer<T> for GeneticOptimizer<'a, T>
[src]
Auto Trait Implementations
impl<'a, T> !Send for GeneticOptimizer<'a, T>
impl<'a, T> !Sync for GeneticOptimizer<'a, T>
impl<'a, T> Unpin for GeneticOptimizer<'a, T> where
T: Unpin,
T: Unpin,
impl<'a, T> !UnwindSafe for GeneticOptimizer<'a, T>
impl<'a, T> !RefUnwindSafe for GeneticOptimizer<'a, T>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> 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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,