Trait vrp_core::solver::population::Population[][src]

pub trait Population: Display {
    fn add_all(&mut self, individuals: Vec<Individual>) -> bool;
fn add(&mut self, individual: Individual) -> bool;
fn on_generation(&mut self, statistics: &Statistics);
fn cmp(&self, a: &Individual, b: &Individual) -> Ordering;
fn select<'a>(&'a self) -> Box<dyn Iterator<Item = &Individual> + 'a>;
fn ranked<'a>(
        &'a self
    ) -> Box<dyn Iterator<Item = (&Individual, usize)> + 'a>;
fn size(&self) -> usize;
fn selection_phase(&self) -> SelectionPhase; }

A trait which models a population with individuals (solutions).

Required methods

fn add_all(&mut self, individuals: Vec<Individual>) -> bool[src]

Adds all individuals into the population, then sorts and shrinks population if necessary. Returns true if any of newly added individuals is considered as best known.

fn add(&mut self, individual: Individual) -> bool[src]

Adds an individual into the population. Returns true if newly added individual is considered as best known.

fn on_generation(&mut self, statistics: &Statistics)[src]

Informs population about new generation event. This is time for the population to decide whether selection phase has to be changed.

fn cmp(&self, a: &Individual, b: &Individual) -> Ordering[src]

Compares two solutions the same way as population does.

fn select<'a>(&'a self) -> Box<dyn Iterator<Item = &Individual> + 'a>[src]

Selects parents from the population based on current selection phase.

fn ranked<'a>(&'a self) -> Box<dyn Iterator<Item = (&Individual, usize)> + 'a>[src]

Returns subset of individuals within their rank sorted according their quality.

fn size(&self) -> usize[src]

Returns population size.

fn selection_phase(&self) -> SelectionPhase[src]

Returns a current selection phase.

Loading content...

Implementors

impl Population for Elitism[src]

impl Population for Greedy[src]

impl Population for Rosomaxa[src]

Loading content...