Poznan University of Technology Department of Motor Vehicles and Road Transport ZPSiTD Dynamic Vehicle Routing in MATSim Simulation and Optimization Michal Maciejewski michal.maciejewski@put.poznan.pl www.michal-maciejewski.pl
Agenda Dynamic Vehicle Routing Problem Static VRP Dynamic VRP DVRP Optimizer Models Algorithms MATSim + DVRP Optmizer Recent results Future plans 2
CVRP CVRP = Capacitated Vehicle Routing Problem Input data 1 depot (node 0) n customers (nodes 1 n) k vehicles c ij travel cost for link i j d i demand of node i C vehicle capacity Goal: minimal-cost routes 2 d 1 5 d 5 d 8 1 8 d 4 d 7 4 7 d 2 6 d 6 0 9 d 9 3 d 3 Constraints: each route starts and ends at the depot each customer visited exactly once capacity of vehicles is never exceeded 3
CVRP CVRP = Capacitated Vehicle Routing Problem Input data 1 depot (node 0) n customers (nodes 1 n) k vehicles c ij travel cost for link i j d i demand of node i C vehicle capacity 2 d 1 5 d 5 d 8 1 c 50 c 01 c 08 8 d 4 d 7 4 c 12 7 c 74 c 40 d 2 c 25 0 c 06 c 90 c 39 c 67 6 d 6 9 d 9 3 d 3 c 83 Goal: minimal-cost routes Constraints: each route starts and ends at the depot each customer visited exactly once capacity of vehicles is never exceeded R 1 = {1, 2, 5} R 2 = {8, 3, 9} R 3 = {6, 7, 4} d 1 + d 2 + d 5 C d 8 + d 3 + d 9 C d 6 + d 7 + d 4 C total cost = c 01 + c 12 + c 25 + c 50 + + c 08 + c 83 + c 39 + c 90 + + c 06 + c 67 + c 74 + c 40 4
VRP types Most popular types (Toth, Vigo) DCVRP = Distance-Constrained VRP VRPB = VRP with Backhauls VRPTW = VRP with Time Windows VRPPD = VRP with Pickup and Delivery VRPBTW = VRP with Backhauls and TW VRPPDTW = VRP with P&D and TW 5
Dynamic VRP DVRP properties (Larsen et al., 2007) Not all information relevant to the planning of the routes is known by the planner before the routing process begins Information can change after the initial routes have been constructed Types of requests advance requests (static; known in advance) immediate requests (dynamic; dynamically appearing) 6
Dynamic VRP DVRP properties (Larsen et al., 2007) Not all information relevant to the planning of the routes is known by the planner before the routing process begins Information can change after the initial routes have been constructed Types of requests advance requests (static; known in advance) immediate requests (dynamic; dynamically appearing) diversion from the current destination 7
Framework for DVRP General scheme INITIAL DATA OPTIMIZER events routes CONCURRENT ON-LINE PROCESSES CUSTOMER SERVICE TRAFFIC MONITORING FLEET MANAGEMENT 9
Classification of DVRP Degree of dynamism vs. objective (Larsen et al., 2007) 10
Why DVRP + MATSim? Planning Demand Responsive Transport services service topology and principles demand modelling (market prediction) pricing algorithms costs inter-modal dependencies and sustainability Other services, e.g. taxi courier (demand from external data) Benchmarking DVRP algorithms on more realistic test cases real network + travel times demand (for transport services) 11
Agenda Dynamic Vehicle Routing Problem Static VRP Dynamic VRP DVRP Optimizer Models Algorithms MATSim + DVRP Optimizer Recent results Future plans 12
Current status for DVRP Optimizer MDDVRPTW = Multi-Depot Dynamic VRP with Time Windows and Dynamic Travel Times/Costs m depots n customers k vehicles c ij (t d ) dynamic travel cost for link i j t ij (t d ) dynamic travel time for link i j d i demand of node i i C k vehicle capacity [E k, L k ] time window of vehicle k [a i, b i ] time window of request i Missing: pickup & delivery (for shared many-to-many services) soft time windows 13
Current status for DVRP Optimizer Supported problems (fully/partially) 14
Request - state diagram 16
Route - state diagram 17
VRP process Route - plan Route - status Request 1 - status Request 2 - status Request 3 - status 20
Waiting strategies immediate request Waiting strategies earliest departure/arrival latest departure/arrival 21
Routes 24
Routes 25
Routes 26
Routes 27
Routes (final results) 28
Agenda Dynamic Vehicle Routing Problem Static VRP Dynamic VRP DVRP Optimizer Models Algorithms MATSim + DVRP Optimizer Recent results Future plans 30
Architecture Data flows Allows for offline optimization 1. Run MATSim simulation scenario 2. Process traffic data 3. Run VRP Optimizer with external request data 31
Road network to graph mapping Input: road network locations (depots, customers ) Output dynamic graph G=<V,A> least-cost arcs travel distances/costs travel times sequence of visited nodes/links (Path in MATSim) 100 customers + 1 depot 10,100 arcs 1000 customers + 10 depots 1,019,090 arcs 32
Arc (shortest path) estimation Data source LeastCostPathCalculator TravelTimeCalculator... TravelTimeData TravelTimeData contains travel times for a single link for each time slice within the simulation Default precision is 15 min (the length of a time slice) Calculation (trivial) for each arc find the shortest path for each (15-min) time slice, i.e. (travel time, travel distance, sequence of nodes/links) 100 customers + 1 depot, 24-hour simulation, 15-minute time slices 10,100 arcs * 96 s-path/arc = 969,600 shortest paths 1000 customers + 10 depots,... 97,832,640 shortest paths Calculation (more sophisticated) for each arc find the shortest path for each SENSIBLE time slice SENSIBLE because considering constraints (mostly time-related) of vehicles, depots, customers and requests 33
Waiting strategies Earliest Departure/Arrival A vehicle departures at 9:00 (earliest possible departure time) TT_D(t): gettraveltimeondeparture(int departuretime) (if (mod(t, binsize)!= 0) linear interpolation) The vehicle will arrive at a destination at 9:00 + TT_D(9:00) Latest Departure/Arrival A vehicle must arrive at the next stop by 10:00 (latest possible arrival time) TT_A(t): gettraveltimeonarrival(int arrivaltime) (if (mod(t, binsize)!= 0) linear interpolation) The vehicle must start out at 10:00 - TT_A(10:00) Instead of Backward Dijkstra-like algorithms a calculation of TT_A(t) based on TT_D(t) TT_A(t+TT_D(t)) = TT_D(t) TT_A are not calculated with a constant time gaps have to be normalized 34
Network 36
Route 1 37
Route 1 38
Route 1 39
Route 1 40
Architecture Data flows Bi-directional mappings Person (Vehicle/Agent?) Vehicle Plan Schedule (Route) Activity/Leg Request/Trip... 41
Online optimization Full integration of MATSim and VRP Optimizer INITIAL DATA OPTIMIZER events routes CONCURRENT ON-LINE PROCESSES CUSTOMER SERVICE TRAFFIC MONITORING FLEET MANAGEMENT 42
Thank you 43