pub trait IterativeAlgorithm {
    type Solution;

    // Required methods
    fn execute_step(&mut self);
    fn is_completed(&self) -> bool;
    fn best_known_solution(&self) -> Option<&Self::Solution>;
    fn num_iterations(&self) -> usize;

    // Provided method
    fn run_to_completion(&mut self) { ... }
}
Expand description

Trait defining an iterative algorithm to allow step for step execution of the BranchAndBound algorithm.

Required Associated Types§

source

type Solution

The type of solution, the algorithm will return.

Required Methods§

source

fn execute_step(&mut self)

Executes the next step in the computation.

Might panic if self.is_completed() yields true.

source

fn is_completed(&self) -> bool

Returns true if the execution is finished and the best solution was found.

source

fn best_known_solution(&self) -> Option<&Self::Solution>

Returns the currently best known solution at any point in the computation (might be None if there was no found yet).

source

fn num_iterations(&self) -> usize

Returns the current number of iterations performed by the algorithm.

Provided Methods§

source

fn run_to_completion(&mut self)

Runs the algorithm until it is completed, i.e. when self.is_completed() yields true.

Implementors§