Trait metaheuristics::Metaheuristics[][src]

pub trait Metaheuristics<T> {
    fn clone_candidate(&mut self, candidate: &T) -> T;
fn generate_candidate(&mut self) -> T;
fn rank_candidate(&mut self, candidate: &T) -> f64;
fn tweak_candidate(&mut self, candidate: &T) -> T; }

Implement this simple trait to apply metaheuristics to your optimisation problems

Required Methods

Clone the supplied candidate solution

 let new_candidate = problem.clone_candidate(&old_candidate);

Randomly generate a new candidate solution

 let candidate = problem.generate_candidate();

Rank a candidate solution so that it can be compared with another (higher is better)

 if problem.rank_candidate(&new_candidate) > problem.rank_candidate(&old_candidate) {
     ...
 }

Clone the supplied candidate solution, then make a small (but random) modification

 let new_candidate = problem.tweak_candidate(&old_candidate);

Implementors