Skip to main content

SelectionHook

Trait SelectionHook 

Source
pub trait SelectionHook: Send + Sync {
    // Required methods
    fn before_selection(&self, population_size: usize, generation: usize);
    fn after_selection(&self, record: &SelectionRecord);

    // Provided method
    fn modify_probabilities(&self, probabilities: Vec<f64>) -> Vec<f64> { ... }
}
Expand description

Operation hook for a selection operator.

NOTE: a plain before/after callback, not a [fugue::Handler].

Required Methods§

Source

fn before_selection(&self, population_size: usize, generation: usize)

Called before selection

Source

fn after_selection(&self, record: &SelectionRecord)

Called after selection

Provided Methods§

Source

fn modify_probabilities(&self, probabilities: Vec<f64>) -> Vec<f64>

Optionally modify selection probabilities

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§