mod elitism;
pub use self::elitism::{Elitism, Shuffled};
mod greedy;
pub use self::greedy::Greedy;
mod rosomaxa;
pub use self::rosomaxa::{Rosomaxa, RosomaxaConfig, RosomaxaWeighted};
use crate::prelude::*;
use std::cmp::Ordering;
use std::fmt::Display;
#[derive(Debug, PartialEq, Eq, Hash)]
pub enum SelectionPhase {
Initial,
Exploration,
Exploitation,
}
pub trait HeuristicPopulation: Send + Sync {
type Objective: HeuristicObjective;
type Individual: HeuristicSolution;
fn add_all(&mut self, individuals: Vec<Self::Individual>) -> bool;
fn add(&mut self, individual: Self::Individual) -> bool;
fn on_generation(&mut self, statistics: &HeuristicStatistics);
fn cmp(&self, a: &Self::Individual, b: &Self::Individual) -> Ordering;
fn select<'a>(&'a self) -> Box<dyn Iterator<Item = &Self::Individual> + 'a>;
fn ranked<'a>(&'a self) -> Box<dyn Iterator<Item = &Self::Individual> + 'a>;
fn all<'a>(&'a self) -> Box<dyn Iterator<Item = &Self::Individual> + 'a>;
fn size(&self) -> usize;
fn selection_phase(&self) -> SelectionPhase;
}