Trait bnb::IterativeAlgorithm
source · 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§
Required Methods§
sourcefn execute_step(&mut self)
fn execute_step(&mut self)
Executes the next step in the computation.
Might panic if self.is_completed() yields true.
sourcefn is_completed(&self) -> bool
fn is_completed(&self) -> bool
Returns true if the execution is finished and the best solution was found.
sourcefn best_known_solution(&self) -> Option<&Self::Solution>
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).
sourcefn num_iterations(&self) -> usize
fn num_iterations(&self) -> usize
Returns the current number of iterations performed by the algorithm.
Provided Methods§
sourcefn run_to_completion(&mut self)
fn run_to_completion(&mut self)
Runs the algorithm until it is completed, i.e. when self.is_completed() yields true.