Skip to main content

vrp_pragmatic/format/solution/
extensions.rs

1use crate::format::solution::{Statistic, Timing};
2use std::ops::Add;
3
4impl Add for Statistic {
5    type Output = Statistic;
6
7    fn add(self, rhs: Self) -> Self::Output {
8        Statistic {
9            cost: self.cost + rhs.cost,
10            distance: self.distance + rhs.distance,
11            duration: self.duration + rhs.duration,
12            times: Timing {
13                driving: self.times.driving + rhs.times.driving,
14                serving: self.times.serving + rhs.times.serving,
15                waiting: self.times.waiting + rhs.times.waiting,
16                break_time: self.times.break_time + rhs.times.break_time,
17                commuting: self.times.commuting + rhs.times.commuting,
18                parking: self.times.parking + rhs.times.parking,
19            },
20        }
21    }
22}