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§
Required Methods§
Sourcefn neighbours(&self) -> T
fn neighbours(&self) -> T
Returns an iterator over neighbours.
Sourcefn apply_neighbour(&mut self, _: Self::Neighbour)
fn apply_neighbour(&mut self, _: Self::Neighbour)
Modifies the solution.
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".