pub struct NearbyKOptMoveSelector<S, V, D: ListPositionDistanceMeter<S>, ES> { /* private fields */ }Expand description
A k-opt move selector with nearby selection for improved performance.
Instead of enumerating all O(n^k) cut combinations, uses distance-based pruning to reduce to O(n * m^(k-1)) where m = max_nearby_size.
§How It Works
- First cut: all positions in the route
- Second cut: only positions nearby (by element distance) to first cut
- Third cut: only positions nearby to second cut
- etc.
This dramatically reduces the search space for large routes.
Implementations§
Source§impl<S: PlanningSolution, V, D: ListPositionDistanceMeter<S>, ES> NearbyKOptMoveSelector<S, V, D, ES>
impl<S: PlanningSolution, V, D: ListPositionDistanceMeter<S>, ES> NearbyKOptMoveSelector<S, V, D, ES>
pub fn new( entity_selector: ES, distance_meter: D, max_nearby: usize, config: KOptConfig, list_len: fn(&S, usize) -> usize, sublist_remove: fn(&mut S, usize, usize, usize) -> Vec<V>, sublist_insert: fn(&mut S, usize, usize, Vec<V>), variable_name: &'static str, descriptor_index: usize, ) -> Self
Trait Implementations§
Source§impl<S, V: Debug, D: ListPositionDistanceMeter<S>, ES: Debug> Debug for NearbyKOptMoveSelector<S, V, D, ES>
impl<S, V: Debug, D: ListPositionDistanceMeter<S>, ES: Debug> Debug for NearbyKOptMoveSelector<S, V, D, ES>
Source§impl<S, V, DM, ES> MoveSelector<S, KOptMove<S, V>> for NearbyKOptMoveSelector<S, V, DM, ES>where
S: PlanningSolution,
V: Clone + Send + Sync + Debug + 'static,
DM: ListPositionDistanceMeter<S> + 'static,
ES: EntitySelector<S>,
impl<S, V, DM, ES> MoveSelector<S, KOptMove<S, V>> for NearbyKOptMoveSelector<S, V, DM, ES>where
S: PlanningSolution,
V: Clone + Send + Sync + Debug + 'static,
DM: ListPositionDistanceMeter<S> + 'static,
ES: EntitySelector<S>,
Auto Trait Implementations§
impl<S, V, D, ES> Freeze for NearbyKOptMoveSelector<S, V, D, ES>
impl<S, V, D, ES> RefUnwindSafe for NearbyKOptMoveSelector<S, V, D, ES>where
ES: RefUnwindSafe,
D: RefUnwindSafe,
impl<S, V, D, ES> Send for NearbyKOptMoveSelector<S, V, D, ES>where
ES: Send,
impl<S, V, D, ES> Sync for NearbyKOptMoveSelector<S, V, D, ES>where
ES: Sync,
impl<S, V, D, ES> Unpin for NearbyKOptMoveSelector<S, V, D, ES>
impl<S, V, D, ES> UnsafeUnpin for NearbyKOptMoveSelector<S, V, D, ES>where
ES: UnsafeUnpin,
D: UnsafeUnpin,
impl<S, V, D, ES> UnwindSafe for NearbyKOptMoveSelector<S, V, D, ES>where
ES: UnwindSafe,
D: 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