pub struct LocalSearchPhase<S, M, MS, A, Fo>where
S: PlanningSolution,
M: Move<S>,
MS: MoveSelector<S, M>,
A: Acceptor<S>,
Fo: LocalSearchForager<S, M>,{ /* private fields */ }Expand description
Local search phase that improves an existing solution.
This phase iteratively:
- Generates candidate moves into an arena
- Evaluates each move by index
- Accepts/rejects based on the acceptor
- Takes ownership of the best accepted move from arena
§Type Parameters
S- The planning solution typeM- The move typeMS- The move selector typeA- The acceptor typeFo- The forager type
§Zero-Clone Design
Uses index-based foraging. The forager stores (usize, Score) pairs.
When a move is selected, ownership transfers via arena.take(index).
Moves are NEVER cloned.
Implementations§
Source§impl<S, M, MS, A, Fo> LocalSearchPhase<S, M, MS, A, Fo>where
S: PlanningSolution,
M: Move<S> + 'static,
MS: MoveSelector<S, M>,
A: Acceptor<S>,
Fo: LocalSearchForager<S, M>,
impl<S, M, MS, A, Fo> LocalSearchPhase<S, M, MS, A, Fo>where
S: PlanningSolution,
M: Move<S> + 'static,
MS: MoveSelector<S, M>,
A: Acceptor<S>,
Fo: LocalSearchForager<S, M>,
Trait Implementations§
Source§impl<S, M, MS, A, Fo> Debug for LocalSearchPhase<S, M, MS, A, Fo>where
S: PlanningSolution,
M: Move<S>,
MS: MoveSelector<S, M> + Debug,
A: Acceptor<S> + Debug,
Fo: LocalSearchForager<S, M> + Debug,
impl<S, M, MS, A, Fo> Debug for LocalSearchPhase<S, M, MS, A, Fo>where
S: PlanningSolution,
M: Move<S>,
MS: MoveSelector<S, M> + Debug,
A: Acceptor<S> + Debug,
Fo: LocalSearchForager<S, M> + Debug,
Source§impl<S, D, M, MS, A, Fo> Phase<S, D> for LocalSearchPhase<S, M, MS, A, Fo>where
S: PlanningSolution,
D: ScoreDirector<S>,
M: Move<S>,
MS: MoveSelector<S, M>,
A: Acceptor<S>,
Fo: LocalSearchForager<S, M>,
impl<S, D, M, MS, A, Fo> Phase<S, D> for LocalSearchPhase<S, M, MS, A, Fo>where
S: PlanningSolution,
D: ScoreDirector<S>,
M: Move<S>,
MS: MoveSelector<S, M>,
A: Acceptor<S>,
Fo: LocalSearchForager<S, M>,
Source§fn solve(&mut self, solver_scope: &mut SolverScope<'_, S, D>)
fn solve(&mut self, solver_scope: &mut SolverScope<'_, S, D>)
Executes this phase. Read more
Source§fn phase_type_name(&self) -> &'static str
fn phase_type_name(&self) -> &'static str
Returns the name of this phase type.
Auto Trait Implementations§
impl<S, M, MS, A, Fo> Freeze for LocalSearchPhase<S, M, MS, A, Fo>
impl<S, M, MS, A, Fo> RefUnwindSafe for LocalSearchPhase<S, M, MS, A, Fo>
impl<S, M, MS, A, Fo> Send for LocalSearchPhase<S, M, MS, A, Fo>
impl<S, M, MS, A, Fo> Sync for LocalSearchPhase<S, M, MS, A, Fo>
impl<S, M, MS, A, Fo> Unpin for LocalSearchPhase<S, M, MS, A, Fo>
impl<S, M, MS, A, Fo> UnwindSafe for LocalSearchPhase<S, M, MS, A, Fo>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more