pub trait LocalSearchForager<S, M>: Send + Debugwhere
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 typeM- The move type (for trait bounds only, moves are never stored)
Required Methods§
Sourcefn step_started(&mut self)
fn step_started(&mut self)
Called at the start of each step to reset state.
Sourcefn add_move_index(&mut self, index: usize, score: S::Score)
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.
Sourcefn is_quit_early(&self) -> bool
fn is_quit_early(&self) -> bool
Returns true if the forager has collected enough moves and wants to stop evaluating more.
Sourcefn pick_move_index(&mut self) -> Option<(usize, S::Score)>
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.