Skip to main content

Neighbours

Trait Neighbours 

Source
pub trait Neighbours<T: Iterator<Item = Self::Neighbour>> {
    type Neighbour;

    // Required methods
    fn neighbours(&self) -> T;
    fn apply_neighbour(&mut self, _: Self::Neighbour);
    fn neighbour_fitness(&self, _: &Self::Neighbour) -> f32;
}
Expand description

Type T is your iterator of neigbours. Fitness of the neighbour is checked with another fitness function allowing optimization.

For example your neighbour_fitness can return a heuristic answer.

Required Associated Types§

Source

type Neighbour

This is a neighbour. A type that when applied to the solution, modifies the solution in some way.

Required Methods§

Source

fn neighbours(&self) -> T

Returns an iterator over neighbours.

Source

fn apply_neighbour(&mut self, _: Self::Neighbour)

Modifies the solution.

Source

fn neighbour_fitness(&self, _: &Self::Neighbour) -> f32

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§