pub struct RuinMoveSelector<S, V> { /* private fields */ }Expand description
A move selector that generates RuinMove instances for Large Neighborhood Search.
Selects random subsets of entities to “ruin” (unassign), enabling a construction heuristic to reassign them in potentially better configurations.
§Type Parameters
S- The planning solution typeV- The variable value type
§Zero-Erasure
All variable access uses fn pointers:
getter: fn(&S, usize) -> Option<V>- gets current valuesetter: fn(&mut S, usize, Option<V>)- sets valueentity_count: fn(&S) -> usize- counts entities
Implementations§
Source§impl<S, V> RuinMoveSelector<S, V>
impl<S, V> RuinMoveSelector<S, V>
Sourcepub fn new(
min_ruin_count: usize,
max_ruin_count: usize,
entity_count: fn(&S) -> usize,
getter: fn(&S, usize) -> Option<V>,
setter: fn(&mut S, usize, Option<V>),
variable_name: &'static str,
descriptor_index: usize,
) -> Self
pub fn new( min_ruin_count: usize, max_ruin_count: usize, entity_count: fn(&S) -> usize, getter: fn(&S, usize) -> Option<V>, setter: fn(&mut S, usize, Option<V>), variable_name: &'static str, descriptor_index: usize, ) -> Self
Creates a new ruin move selector with typed function pointers.
§Arguments
min_ruin_count- Minimum entities to ruin (at least 1)max_ruin_count- Maximum entities to ruinentity_count- Function to get total entity countgetter- Function to get current valuesetter- Function to set valuevariable_name- Name of the planning variabledescriptor_index- Entity descriptor index
§Panics
Panics if min_ruin_count is 0 or max_ruin_count < min_ruin_count.
Sourcepub fn with_moves_per_step(self, count: usize) -> Self
pub fn with_moves_per_step(self, count: usize) -> Self
Sets the number of ruin moves to generate per iteration.
Default is 10.
Trait Implementations§
Source§impl<S, V: Debug> Debug for RuinMoveSelector<S, V>
impl<S, V: Debug> Debug for RuinMoveSelector<S, V>
Source§impl<S, V> MoveSelector<S, RuinMove<S, V>> for RuinMoveSelector<S, V>
impl<S, V> MoveSelector<S, RuinMove<S, V>> for RuinMoveSelector<S, V>
Source§fn iter_moves<'a, D: ScoreDirector<S>>(
&'a self,
score_director: &'a D,
) -> Box<dyn Iterator<Item = RuinMove<S, V>> + 'a>
fn iter_moves<'a, D: ScoreDirector<S>>( &'a self, score_director: &'a D, ) -> Box<dyn Iterator<Item = RuinMove<S, V>> + 'a>
Returns an iterator over typed moves.
Source§fn size<D: ScoreDirector<S>>(&self, score_director: &D) -> usize
fn size<D: ScoreDirector<S>>(&self, score_director: &D) -> usize
Returns the approximate number of moves.
Source§fn is_never_ending(&self) -> bool
fn is_never_ending(&self) -> bool
Returns true if this selector may return the same move multiple times.
Auto Trait Implementations§
impl<S, V> Freeze for RuinMoveSelector<S, V>
impl<S, V> RefUnwindSafe for RuinMoveSelector<S, V>where
V: RefUnwindSafe,
impl<S, V> Send for RuinMoveSelector<S, V>where
V: Send,
impl<S, V> Sync for RuinMoveSelector<S, V>where
V: Sync,
impl<S, V> Unpin for RuinMoveSelector<S, V>where
V: Unpin,
impl<S, V> UnwindSafe for RuinMoveSelector<S, V>where
V: UnwindSafe,
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