Represents a scheduled visit in a route.
A ScheduledVisit contains timing information about when a location is visited, including service start/end times, waiting time, and any time warp (lateness).
Fields
location- The location index (depot or client) in ProblemDatatrip- The trip index within the route (for multi-trip routes)start_service- Time when service begins at this locationend_service- Time when service ends at this locationwait_duration- Time spent waiting before service can begintime_warp- Amount of "time travel" needed (indicates infeasibility if > 0)
Computed Properties
service_duration- Duration of service (end_service - start_service)
Example
# Get schedule for route 0
schedule = Solution.route_schedule(solution, 0)
# Iterate through visits
Enum.each(schedule, fn visit ->
IO.puts("Location #{visit.location}: service #{visit.start_service}-#{visit.end_service}")
if visit.time_warp > 0 do
IO.puts(" WARNING: #{visit.time_warp} time warp (late arrival)")
end
end)
Summary
Functions
Creates a ScheduledVisit from a tuple returned by the NIF.
Returns true if this visit has time warp (late arrival).
Returns true if the vehicle had to wait at this location.
Returns the service duration (end_service - start_service).
Types
@type t() :: %ExVrp.ScheduledVisit{ end_service: non_neg_integer(), location: non_neg_integer(), start_service: non_neg_integer(), time_warp: non_neg_integer(), trip: non_neg_integer(), wait_duration: non_neg_integer() }
Functions
@spec from_tuple( {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()} ) :: t()
Creates a ScheduledVisit from a tuple returned by the NIF.
The tuple format is: {location, trip, start_service, end_service, wait_duration, time_warp}
Returns true if this visit has time warp (late arrival).
A visit with time warp indicates the vehicle arrived after the time window closed, making the route infeasible.
Returns true if the vehicle had to wait at this location.
@spec service_duration(t()) :: non_neg_integer()
Returns the service duration (end_service - start_service).