LocalSearchForager

Trait LocalSearchForager 

Source
pub trait LocalSearchForager<S: PlanningSolution, M: Move<S>>: Send + Debug {
    // Required methods
    fn step_started(&mut self);
    fn add_move(&mut self, m: M, score: S::Score);
    fn is_quit_early(&self) -> bool;
    fn pick_move(&mut self) -> Option<(M, S::Score)>;
}
Expand description

Trait for collecting and selecting moves in local search.

Foragers are responsible for:

  • Collecting accepted moves during move evaluation
  • Deciding when to quit evaluating early
  • Selecting the best move to apply

§Type Parameters

  • S - The planning solution type
  • M - The move type

Required Methods§

Source

fn step_started(&mut self)

Called at the start of each step to reset state.

Source

fn add_move(&mut self, m: M, score: S::Score)

Adds an accepted move to the forager.

Source

fn is_quit_early(&self) -> bool

Returns true if the forager has collected enough moves and wants to stop evaluating more.

Source

fn pick_move(&mut self) -> Option<(M, S::Score)>

Picks the best move from those collected.

Returns None if no moves were accepted.

Implementors§