radiate-selectors 1.3.0

Selection strategies for the Radiate genetic algorithm library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use radiate_core::{Chromosome, Objective, Phenotype, Select};

#[derive(Debug, Default)]
pub struct EliteSelector;

impl EliteSelector {
    pub fn new() -> Self {
        EliteSelector
    }
}

impl<C: Chromosome> Select<C> for EliteSelector {
    fn select(&self, population: &[Phenotype<C>], _: &Objective, count: usize) -> Vec<usize> {
        (0..count.min(population.len())).collect()
    }
}