Skip to main content

CrossEntityDistanceMeter

Trait CrossEntityDistanceMeter 

Source
pub trait CrossEntityDistanceMeter<S>: Send + Sync {
    // Required method
    fn distance(
        &self,
        solution: &S,
        src_entity: usize,
        src_pos: usize,
        dst_entity: usize,
        dst_pos: usize,
    ) -> f64;
}
Expand description

Measures distance between two list positions, potentially across different entities.

Used by NearbyListChangeMoveSelector to rank candidate destination positions by proximity to the source element being relocated.

§Notes

  • Implementing this for VRP: use the Euclidean (or road-network) distance between the visit at (src_entity, src_pos) and the visit at (dst_entity, dst_pos).
  • The distance can be asymmetric (e.g., directed graphs).
  • Returning f64::INFINITY for a pair excludes it from nearby candidates.

Required Methods§

Source

fn distance( &self, solution: &S, src_entity: usize, src_pos: usize, dst_entity: usize, dst_pos: usize, ) -> f64

Returns the distance from the element at (src_entity, src_pos) to the element at (dst_entity, dst_pos) in the current solution.

Implementors§