Load segments for tracking capacity during optimization.
Load segments track delivery and pickup loads, and can be efficiently concatenated to track capacity violations 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
ls1 = ExVrp.LoadSegment.new(10, 0, 10, 0)
ls2 = ExVrp.LoadSegment.new(0, 5, 5, 0)
merged = ExVrp.LoadSegment.merge(ls1, ls2)
ExVrp.LoadSegment.excess_load(merged, 12)
Summary
Functions
Returns the delivery amount, that is, the total amount of load delivered to clients on this segment.
Returns the load violation on this segment.
Finalises the load on this segment.
Returns the maximum load encountered on this segment.
Merges two load segments.
Creates a new load segment.
Returns the amount picked up from clients on this segment.
Types
@type t() :: reference()
Functions
Returns the delivery amount, that is, the total amount of load delivered to clients on this segment.
Returns the load violation on this segment.
Parameters
segment- The load segmentcapacity- Segment capacity
Finalises the load on this segment.
Returns a new segment where any excess load has been moved to the cumulative excess load field. This is useful with reloading, because the finalised segment can be concatenated with load segments of subsequent trips.
Parameters
segment- The load segment to finalisecapacity- The capacity constraint
Returns the maximum load encountered on this segment.
Merges two load segments.
Parameters
first- First load segmentsecond- Second load segment
Returns
A new merged load segment.
Creates a new load segment.
Parameters
delivery- Total delivery amount on this segmentpickup- Total pickup amount on this segmentload- Maximum load on this segmentexcess_load- Cumulative excess load on this segment (default 0)
Returns the amount picked up from clients on this segment.