Selection

Trait Selection 

Source
pub trait Selection<S, const N: usize> {
    // Required method
    fn select(&self, solution: &S, scores: &Scores<N>) -> bool;
}
Expand description

An operator that decides whether a solution will be selected as a parent for the next generation of solutions or not. Selected solutions’ references are passed into Recombinator.

Can be applied in parallel to each solution or to batches of solutions by converting it into a parallelized operator with par_each() or par_batch() methods.

§Examples

let s = |_: &f32, _: &[f32; 3]| true; // simply selects each solution
let s = s.par_each();

Note that you always can implement this trait instead of using closures.

Required Methods§

Source

fn select(&self, solution: &S, scores: &Scores<N>) -> bool

If returns true, then given solution will be selected as a parent for next population.

Implementors§

Source§

impl<S, const N: usize, F> Selection<S, N> for F
where F: Fn(&S, &Scores<N>) -> bool,