Duration segments for tracking route timing during optimization.
Duration segments can be efficiently concatenated, and track statistics about route and trip duration and time warp resulting from visiting clients in the concatenated order.
This is a core data structure used by the local search operators to efficiently evaluate moves.
Example
ds1 = ExVrp.DurationSegment.new(5, 0, 0, 5, 0)
ds2 = ExVrp.DurationSegment.new(0, 5, 3, 6, 0)
merged = ExVrp.DurationSegment.merge(4, ds1, ds2)
ExVrp.DurationSegment.time_warp(merged)
Summary
Functions
Returns the total duration of the whole segment.
Returns the earliest end time of the current trip.
Returns the latest end time of the current trip.
Finalises this segment at the back (end of segment).
Finalises this segment at the front (start of segment).
Merges two duration segments with an edge duration.
Creates a new duration segment.
Returns the latest end time of the previous trip.
Returns the release time of clients on the current trip.
Returns the slack in the route schedule.
Returns the earliest start time for the current trip.
Returns the latest start time for the current trip.
Returns the time warp on this whole segment.
Types
@type t() :: reference()
Functions
Returns the total duration of the whole segment.
Returns the earliest end time of the current trip.
Returns the latest end time of the current trip.
Finalises this segment at the back (end of segment).
Returns a new segment where release times have been reset, and all other statistics have been suitably adjusted. This is useful with multiple trips because the finalised segment can be concatenated with segments of later trips.
Finalises this segment at the front (start of segment).
Returns a new segment where release times have been reset, and all other statistics have been suitably adjusted. This is useful with multiple trips because the finalised segment can be concatenated with segments of earlier trips.
Merges two duration segments with an edge duration.
Parameters
edge_duration- Duration to travel between the segmentsfirst- First duration segmentsecond- Second duration segment
Returns
A new merged duration segment.
@spec new( integer(), integer(), integer(), integer(), integer(), integer(), integer(), integer() ) :: t()
Creates a new duration segment.
Parameters
duration- Total duration of current triptime_warp- Total time warp on current tripstart_early- Earliest start time of current tripstart_late- Latest start time of current triprelease_time- Earliest moment to start this trip segmentcum_duration- Cumulative duration of other trips (default 0)cum_time_warp- Cumulative time warp of other trips (default 0)prev_end_late- Latest end time of previous trip (default INT_MAX)
Returns the latest end time of the previous trip.
Returns the release time of clients on the current trip.
Returns the slack in the route schedule.
This is the amount of time by which the start of the current trip can be delayed without increasing the overall route duration.
Returns the earliest start time for the current trip.
Returns the latest start time for the current trip.
Returns the time warp on this whole segment.
If max_duration is provided, any excess duration beyond it is also
counted as time warp.