MCPcopy Create free account
hub / github.com/PyVRP/PyVRP / DurationSegment

Class DurationSegment

pyvrp/cpp/DurationSegment.h:50–185  ·  view source on GitHub ↗

* DurationSegment( * duration: int = 0, * time_warp: int = 0, * start_early: int = 0, * start_late: int = np.iinfo(np.int64).max, * release_time: int = 0, * cum_duration: int = 0, * cum_time_warp: int = 0, * prev_end_late: int = np.iinfo(np.int64).max, * ) * * Creates a duration segment. * * Duration segments can be efficiently concatenated, and track s

Source from the content-addressed store, hash-verified

48 * Latest end time of the previous trip, if any. Default unconstrained.
49 */
50class DurationSegment
51{
52 Duration duration_ = 0; // of current trip
53 Duration timeWarp_ = 0; // of current trip
54 Duration startEarly_ = 0; // of current trip
55 Duration startLate_
56 = std::numeric_limits<Duration>::max(); // of current trip
57 Duration releaseTime_ = 0; // of current trip
58 Duration cumDuration_ = 0; // cumulative, excl. current trip
59 Duration cumTimeWarp_ = 0; // cumulative, excl. current trip
60 Duration prevEndLate_
61 = std::numeric_limits<Duration>::max(); // of prev trip
62
63public:
64 [[nodiscard]] static inline DurationSegment
65 merge(Duration const edgeDuration,
66 DurationSegment const &first,
67 DurationSegment const &second);
68
69 [[nodiscard]] static inline DurationSegment // convenient helper
70 merge(DurationSegment const &first, DurationSegment const &second);
71
72 /**
73 * Finalises this segment towards the back (at the end of the segment),
74 * and returns a new segment where release times have been reset, and all
75 * other statistics have been suitably adjusted. This is useful with
76 * multiple trips because the finalised segment can be concatenated with
77 * segments of later trips.
78 */
79 [[nodiscard]] inline DurationSegment finaliseBack() const;
80
81 /**
82 * Finalises this segment towards the front (at the start of the segment),
83 * and returns a new segment where release times have been reset, and all
84 * other statistics have been suitably adjusted. This is useful with
85 * multiple trips because the finalised segment can be concatenated with
86 * segments of earlier trips.
87 */
88 [[nodiscard]] inline DurationSegment finaliseFront() const;
89
90 /**
91 * The total duration of the whole segment.
92 */
93 [[nodiscard]] inline Duration duration() const;
94
95 /**
96 * Returns the time warp on this whole segment. Additionally, any time warp
97 * incurred by violating the maximum duration argument is also counted.
98 *
99 * Parameters
100 * ----------
101 * max_duration
102 * Maximum allowed duration, if provided. If the segment's duration
103 * exceeds this value, any excess duration is counted as time warp.
104 * Default unconstrained.
105 *
106 * Returns
107 * -------

Calls

no outgoing calls