Diagnostic results

The pyvrp.diagnostics module contains methods that help compute statistics from solutions.

class RouteStatistics(distance: int, start_time: int, end_time: int, duration: int, timewarp: int, wait_time: int, service_time: int, num_stops: int, total_demand: int, fillrate: float, is_feasible: bool, is_empty: bool)

Object storing various route statistics.

Attributes:
distance

Total distance travelled over this route.

start_time

Earliest starting time on this route, that is, the earliest time this route can leave the depot.

end_time

Time at which the truck returns to the depot.

duration

Total route duration, including waiting time.

timewarp

Any time warp incurred along the route.

wait_time

Time spent waiting on the route.

service_time

Total service time on the route.

num_stops

Number of clients visits along the route.

total_demand

Total client demand on this route.

fillrate

Capacity used by total client demand.

is_feasible

Whether the route is load and time feasible.

is_empty

Whether the route is empty.

get_all_route_statistics(solution: Individual, data: ProblemData) List[RouteStatistics]

Returns route statistics for a set of routes. Empty routes are skipped.

Parameters:
solution

The solution individual for which to get all route statistics.

data

Data instance corresponding to the route.

Returns:
List[RouteStatistics]

List of RouteStatistic objects with statistics for each route.

get_route_statistics(data: ProblemData, route: List[int]) RouteStatistics

Returns statistics for a route.

Parameters:
data

Data instance corresponding to the route.

route

Route (list of indices) to compute statistics for.

Returns:
RouteStatistics

Object with statistics for the route.