Skip to main content

SelectionOperator

Trait SelectionOperator 

Source
pub trait SelectionOperator<G: EvolutionaryGenome>: Send + Sync {
    // Required method
    fn select<R: Rng>(&self, population: &[(G, f64)], rng: &mut R) -> usize;

    // Provided method
    fn select_many<R: Rng>(
        &self,
        population: &[(G, f64)],
        count: usize,
        rng: &mut R,
    ) -> Vec<usize> { ... }
}
Expand description

Selection operator trait

Selects individuals from a population for reproduction.

Required Methods§

Source

fn select<R: Rng>(&self, population: &[(G, f64)], rng: &mut R) -> usize

Select a single individual from the population

Returns the index of the selected individual.

Provided Methods§

Source

fn select_many<R: Rng>( &self, population: &[(G, f64)], count: usize, rng: &mut R, ) -> Vec<usize>

Select multiple individuals from the population

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§