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

pub trait Population {
    fn add_all(&mut self, individuals: Vec<Individual>) -> bool;
fn add(&mut self, individual: Individual) -> bool;
fn nth(&self, idx: usize) -> Option<&Individual>;
fn cmp(&self, a: &Individual, b: &Individual) -> Ordering;
fn ranked<'a>(
        &'a self
    ) -> Box<dyn Iterator<Item = (&Individual, usize)> + 'a>;
fn size(&self) -> usize; }

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

Required methods

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

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

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

fn nth(&self, idx: usize) -> Option<&Individual>

Gets nth individual from population.

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

Compares two solutions the same way as population does.

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

Returns individuals within their rank sorted according their quality.

fn size(&self) -> usize

Returns population size.

Loading content...

Implementors

impl Population for DominancePopulation[src]

Loading content...