pub struct Solution {
pub routes: Vec<Route>,
}Expand description
Represents a complete CVRP solution comprising multiple vehicle routes.
Fields§
§routes: Vec<Route>Collection of active vehicle routes.
Implementations§
Source§impl Solution
impl Solution
Sourcepub fn total_distance(&self, instance: &SolomonInstance) -> f32
pub fn total_distance(&self, instance: &SolomonInstance) -> f32
Calculates the total distance across all routes in the solution.
Sourcepub fn total_customers_visited(&self) -> usize
pub fn total_customers_visited(&self) -> usize
Returns the total number of customers visited across all routes.
Sourcepub fn is_feasible(&self, instance: &SolomonInstance) -> bool
pub fn is_feasible(&self, instance: &SolomonInstance) -> bool
Validates full solution feasibility:
- Number of active non-empty routes <=
instance.vehicle.num_vehicles. - Each route respects vehicle capacity constraints (
total_demand <= capacity). - Every customer node
1..instance.num_nodesis visited exactly once.
Trait Implementations§
impl StructuralPartialEq for Solution
Auto Trait Implementations§
impl Freeze for Solution
impl RefUnwindSafe for Solution
impl Send for Solution
impl Sync for Solution
impl Unpin for Solution
impl UnsafeUnpin for Solution
impl UnwindSafe for Solution
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