[][src]Trait vrp_core::algorithms::nsga2::Objective

pub trait Objective {
    type Solution;
    fn total_order(&self, a: &Self::Solution, b: &Self::Solution) -> Ordering;
fn distance(&self, a: &Self::Solution, b: &Self::Solution) -> f64;
fn fitness(&self, solution: &Self::Solution) -> f64; }

An objective defines a total ordering relation and a distance metric on a set of solutions. Given any two solutions, an objective answers the following two questions:

  • "which solution is the better one" (total order)
  • "how similar are the two solutions" (distance metric)

Associated Types

type Solution

The solution value type that we define the objective on.

Loading content...

Required methods

fn total_order(&self, a: &Self::Solution, b: &Self::Solution) -> Ordering

An objective defines a total ordering between any two solution values.

This answers the question, is solution a better, equal or worse than solution b, according to the objective.

fn distance(&self, a: &Self::Solution, b: &Self::Solution) -> f64

An objective defines a distance metric between any two solution values.

The distance metric answer the question, how similar the solutions a and b are, according to the objective. A zero value would mean, that both solutions are in fact the same, according to the objective. Larger magnitudes would mean "less similar".

fn fitness(&self, solution: &Self::Solution) -> f64

An objective fitness value for given solution.

Loading content...

Implementors

impl Objective for ObjectiveCost[src]

type Solution = InsertionContext

impl Objective for TotalRoutes[src]

type Solution = InsertionContext

impl Objective for TotalTransportCost[src]

type Solution = InsertionContext

impl Objective for TotalUnassignedJobs[src]

type Solution = InsertionContext

Loading content...