LocalSearchForager

Trait LocalSearchForager 

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

Trait for collecting and selecting moves in local search.

Foragers are responsible for:

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

§Type Parameters

  • S - The planning solution type
  • M - The move type (for trait bounds only, moves are never stored)

Required Methods§

Source

fn step_started(&mut self)

Called at the start of each step to reset state.

Source

fn add_move_index(&mut self, index: usize, score: S::Score)

Adds an accepted move index to the forager.

The index refers to a position in the MoveArena.

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_index(&mut self) -> Option<(usize, S::Score)>

Picks the best move index from those collected.

Returns None if no moves were accepted.

Implementors§