pub struct KOptMove<S, V> { /* private fields */ }Expand description
A k-opt move that removes k edges and reconnects segments.
This is the generalized k-opt move supporting k=2,3,4,5. For k=2, this is equivalent to a 2-opt (segment reversal).
§Zero-Erasure Design
- Fixed array
[CutPoint; 5]for up to 5 cuts (5-opt) KOptReconnectionstored by value (Copytype, no heap allocation)- Typed function pointers for list operations
§Type Parameters
S- The planning solution typeV- The list element value type
Implementations§
Source§impl<S, V> KOptMove<S, V>
impl<S, V> KOptMove<S, V>
pub fn new( cuts: &[CutPoint], reconnection: &KOptReconnection, 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
pub fn k(&self) -> usize
pub fn cuts(&self) -> &[CutPoint]
pub fn is_intra_route(&self) -> bool
Trait Implementations§
Source§impl<S, V, ES> MoveSelector<S, KOptMove<S, V>> for KOptMoveSelector<S, V, ES>
impl<S, V, ES> MoveSelector<S, KOptMove<S, V>> for KOptMoveSelector<S, V, 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> Freeze for KOptMove<S, V>
impl<S, V> RefUnwindSafe for KOptMove<S, V>
impl<S, V> Send for KOptMove<S, V>
impl<S, V> Sync for KOptMove<S, V>
impl<S, V> Unpin for KOptMove<S, V>
impl<S, V> UnsafeUnpin for KOptMove<S, V>
impl<S, V> UnwindSafe for KOptMove<S, V>
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> 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>
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