pub struct HaversineMatrix { /* private fields */ }Expand description
Straight-line (great-circle) cost matrix.
Distance is the Haversine distance between coordinates; time is that distance divided by a configurable average speed (km/h).
Implementations§
Source§impl HaversineMatrix
impl HaversineMatrix
Sourcepub fn new(coords: Vec<Coord>, speed_kmh: f64) -> Self
pub fn new(coords: Vec<Coord>, speed_kmh: f64) -> Self
Build a matrix over coords, indexed by LocationId.
speed_kmh is the average travel speed used to turn distance into time.
Sourcepub fn from_problem(problem: &Problem, speed_kmh: f64) -> Self
pub fn from_problem(problem: &Problem, speed_kmh: f64) -> Self
Build a matrix matching a Problem’s location layout: depot at
LocationId::DEPOT, then stops in order.
Trait Implementations§
Source§impl Clone for HaversineMatrix
impl Clone for HaversineMatrix
Source§fn clone(&self) -> HaversineMatrix
fn clone(&self) -> HaversineMatrix
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CostMatrix for HaversineMatrix
impl CostMatrix for HaversineMatrix
Source§fn distance(&self, a: LocationId, b: LocationId) -> f64
fn distance(&self, a: LocationId, b: LocationId) -> f64
Great-circle / road distance between
a and b, in kilometres.Source§fn time(&self, a: LocationId, b: LocationId) -> f64
fn time(&self, a: LocationId, b: LocationId) -> f64
Travel time between
a and b, in hours.Auto Trait Implementations§
impl Freeze for HaversineMatrix
impl RefUnwindSafe for HaversineMatrix
impl Send for HaversineMatrix
impl Sync for HaversineMatrix
impl Unpin for HaversineMatrix
impl UnsafeUnpin for HaversineMatrix
impl UnwindSafe for HaversineMatrix
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