pub struct MoveTabuAcceptor { /* private fields */ }Expand description
Move tabu acceptor - maintains a tabu list based on move identifiers.
Unlike entity tabu (which forbids recently moved entities) or value tabu (which forbids recently assigned values), move tabu forbids the exact move combination (entity + value). This provides finer-grained control.
A move is identified by its hash, typically combining entity index and assigned value information.
§Example
use solverforge_solver::phase::localsearch::MoveTabuAcceptor;
let acceptor = MoveTabuAcceptor::new(7);
assert!(!acceptor.is_move_tabu(42));Implementations§
Source§impl MoveTabuAcceptor
impl MoveTabuAcceptor
Sourcepub fn new(move_tabu_size: usize) -> Self
pub fn new(move_tabu_size: usize) -> Self
Creates a new move tabu acceptor with aspiration enabled.
§Arguments
move_tabu_size- Maximum number of moves to remember as tabu
Sourcepub fn without_aspiration(move_tabu_size: usize) -> Self
pub fn without_aspiration(move_tabu_size: usize) -> Self
Creates a move tabu acceptor without aspiration.
Without aspiration, tabu moves are never accepted even if they would lead to a new best solution.
Sourcepub fn record_move(&mut self, move_hash: u64)
pub fn record_move(&mut self, move_hash: u64)
Records that a move was executed in the current step.
Call this with the hash of the executed move.
Sourcepub fn is_move_tabu(&self, move_hash: u64) -> bool
pub fn is_move_tabu(&self, move_hash: u64) -> bool
Returns true if the given move hash is in the tabu list.
Sourcepub fn aspiration_enabled(&self) -> bool
pub fn aspiration_enabled(&self) -> bool
Returns true if aspiration is enabled.
Trait Implementations§
Source§impl<S: PlanningSolution> Acceptor<S> for MoveTabuAcceptor
impl<S: PlanningSolution> Acceptor<S> for MoveTabuAcceptor
Source§fn is_accepted(&self, last_step_score: &S::Score, move_score: &S::Score) -> bool
fn is_accepted(&self, last_step_score: &S::Score, move_score: &S::Score) -> bool
move_score should be accepted,
given the previous step’s score.Source§fn phase_started(&mut self, initial_score: &S::Score)
fn phase_started(&mut self, initial_score: &S::Score)
Source§fn phase_ended(&mut self)
fn phase_ended(&mut self)
Source§fn step_started(&mut self)
fn step_started(&mut self)
Source§fn step_ended(&mut self, step_score: &S::Score)
fn step_ended(&mut self, step_score: &S::Score)
Source§impl Clone for MoveTabuAcceptor
impl Clone for MoveTabuAcceptor
Source§impl Debug for MoveTabuAcceptor
impl Debug for MoveTabuAcceptor
Auto Trait Implementations§
impl Freeze for MoveTabuAcceptor
impl RefUnwindSafe for MoveTabuAcceptor
impl Send for MoveTabuAcceptor
impl Sync for MoveTabuAcceptor
impl Unpin for MoveTabuAcceptor
impl UnwindSafe for MoveTabuAcceptor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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