[][src]Struct optlib::genetic::GeneticOptimizer

pub struct GeneticOptimizer<'a, T> { /* fields omitted */ }

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]

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]

fn find_min(&mut self) -> Option<(T, f64)>[src]

Run genetic algorithm

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

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]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]