31.10.2014 Views

Dynamic Vehicle Routing in MATSim (Michał Maciejewski)

Dynamic Vehicle Routing in MATSim (Michał Maciejewski)

Dynamic Vehicle Routing in MATSim (Michał Maciejewski)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Poznan University of Technology<br />

Department of Motor <strong>Vehicle</strong>s and Road Transport<br />

ZPSiTD<br />

<strong>Dynamic</strong> <strong>Vehicle</strong> <strong>Rout<strong>in</strong>g</strong> <strong>in</strong> <strong>MATSim</strong><br />

Simulation and Optimization<br />

Michal <strong>Maciejewski</strong><br />

michal.maciejewski@put.poznan.pl<br />

www.michal-maciejewski.pl


Agenda<br />

• <strong>Dynamic</strong> <strong>Vehicle</strong> <strong>Rout<strong>in</strong>g</strong> Problem<br />

– Static VRP<br />

– <strong>Dynamic</strong> VRP<br />

• DVRP Optimizer<br />

– Models<br />

– Algorithms<br />

• <strong>MATSim</strong> + DVRP Optmizer<br />

– Recent results<br />

– Future plans<br />

2


CVRP<br />

• CVRP = Capacitated <strong>Vehicle</strong> <strong>Rout<strong>in</strong>g</strong> Problem<br />

• Input data<br />

– 1 depot (node 0)<br />

– n customers (nodes 1…n)<br />

– k vehicles<br />

– c ij travel cost for l<strong>in</strong>k i→j<br />

– d i demand of node i<br />

– C vehicle capacity<br />

• Goal: m<strong>in</strong>imal-cost routes<br />

d 2<br />

2<br />

d 1 5 d 5 d 8<br />

1<br />

8<br />

d 4<br />

d 7<br />

4<br />

7<br />

6<br />

d 6<br />

0<br />

9<br />

d 9<br />

3<br />

d 3<br />

• Constra<strong>in</strong>ts:<br />

– each route starts and ends at the depot<br />

– each customer visited exactly once<br />

– capacity of vehicles is never exceeded<br />

3


CVRP<br />

• CVRP = Capacitated <strong>Vehicle</strong> <strong>Rout<strong>in</strong>g</strong> Problem<br />

• Input data<br />

– 1 depot (node 0)<br />

– n customers (nodes 1…n)<br />

– k vehicles<br />

– c ij travel cost for l<strong>in</strong>k i→j<br />

– d i demand of node i<br />

– C vehicle capacity<br />

c 12 2 c 25<br />

d 1 5 d 5 d 8<br />

1<br />

c 50 8<br />

c 01 c 08<br />

c 83<br />

d 4<br />

d 2<br />

d 7<br />

4<br />

c 40<br />

c 74 c 06 c 90 c 39<br />

6<br />

9<br />

7 c 67 d 6<br />

d 9<br />

0<br />

3<br />

d 3<br />

• Goal: m<strong>in</strong>imal-cost routes<br />

• Constra<strong>in</strong>ts:<br />

– each route starts and ends at the depot<br />

– each customer visited exactly once<br />

– capacity of vehicles is never exceeded<br />

R 1 = {1, 2, 5}<br />

R 2 = {8, 3, 9}<br />

R 3 = {6, 7, 4}<br />

d 1 + d 2 + d 5 ≤ C<br />

d 8 + d 3 + d 9 ≤ C<br />

d 6 + d 7 + d 4 ≤ C<br />

total cost = c 01 + c 12 + c 25 + c 50 +<br />

+ c 08 + c 83 + c 39 + c 90 +<br />

+ c 06 + c 67 + c 74 + c 40<br />

4


VRP types<br />

• Most popular types (Toth, Vigo)<br />

• DCVRP = Distance-Constra<strong>in</strong>ed VRP<br />

• VRPB = VRP with Backhauls<br />

• VRPTW = VRP with Time W<strong>in</strong>dows<br />

• VRPPD = VRP with Pickup and Delivery<br />

• VRPBTW = VRP with Backhauls and TW<br />

• VRPPDTW = VRP with P&D and TW<br />

5


<strong>Dynamic</strong> VRP<br />

• DVRP properties (Larsen et al., 2007)<br />

– Not all <strong>in</strong>formation relevant to the plann<strong>in</strong>g of the routes is known by the<br />

planner before the rout<strong>in</strong>g process beg<strong>in</strong>s<br />

– Information can change after the <strong>in</strong>itial routes have been constructed<br />

• Types of requests<br />

– advance requests (static; known <strong>in</strong> advance)<br />

– immediate requests (dynamic; dynamically appear<strong>in</strong>g)<br />

6


<strong>Dynamic</strong> VRP<br />

• DVRP properties (Larsen et al., 2007)<br />

– Not all <strong>in</strong>formation relevant to the plann<strong>in</strong>g of the routes is known by the<br />

planner before the rout<strong>in</strong>g process beg<strong>in</strong>s<br />

– Information can change after the <strong>in</strong>itial routes have been constructed<br />

• Types of requests<br />

– advance requests (static; known <strong>in</strong> advance)<br />

– immediate requests (dynamic; dynamically appear<strong>in</strong>g)<br />

diversion from<br />

the current dest<strong>in</strong>ation<br />

7


Framework for DVRP<br />

• General scheme<br />

INITIAL DATA<br />

OPTIMIZER<br />

events<br />

routes<br />

CONCURRENT ON-LINE PROCESSES<br />

CUSTOMER<br />

SERVICE<br />

TRAFFIC<br />

MONITORING<br />

FLEET<br />

MANAGEMENT<br />

9


Classification of DVRP<br />

• Degree of dynamism vs. objective (Larsen et al., 2007)<br />

10


Why DVRP + <strong>MATSim</strong>?<br />

• Plann<strong>in</strong>g Demand Responsive Transport services<br />

– service topology and pr<strong>in</strong>ciples<br />

– demand modell<strong>in</strong>g (market prediction)<br />

– pric<strong>in</strong>g<br />

– algorithms<br />

– costs<br />

– <strong>in</strong>ter-modal dependencies and susta<strong>in</strong>ability<br />

• Other services, e.g.<br />

– taxi<br />

– courier (demand from external data)<br />

• Benchmark<strong>in</strong>g DVRP algorithms on more realistic test cases<br />

– real network + travel times<br />

– demand (for transport services)<br />

11


Agenda<br />

• <strong>Dynamic</strong> <strong>Vehicle</strong> <strong>Rout<strong>in</strong>g</strong> Problem<br />

– Static VRP<br />

– <strong>Dynamic</strong> VRP<br />

• DVRP Optimizer<br />

– Models<br />

– Algorithms<br />

• <strong>MATSim</strong> + DVRP Optimizer<br />

– Recent results<br />

– Future plans<br />

12


Current status for DVRP Optimizer<br />

• MDDVRPTW = Multi-Depot <strong>Dynamic</strong> VRP with Time W<strong>in</strong>dows and<br />

<strong>Dynamic</strong> Travel Times/Costs<br />

– m depots<br />

– n customers<br />

– k vehicles<br />

– c ij (t d ) dynamic travel cost for l<strong>in</strong>k i→j<br />

– t ij (t d ) dynamic travel time for l<strong>in</strong>k i→j<br />

– d i demand of node i<br />

i<br />

– C k vehicle capacity<br />

– [E k , L k ] time w<strong>in</strong>dow of vehicle k<br />

– [a i , b i ] time w<strong>in</strong>dow of request i<br />

• Miss<strong>in</strong>g:<br />

– pickup & delivery (for shared many-to-many services)<br />

– soft time w<strong>in</strong>dows<br />

13


Current status for DVRP Optimizer<br />

• Supported problems (fully/partially)<br />

14


Request - state diagram<br />

16


Route - state diagram<br />

17


VRP process<br />

Route - plan<br />

Route - status<br />

Request 1 - status<br />

Request 2 - status<br />

Request 3 - status<br />

20


Wait<strong>in</strong>g strategies<br />

immediate<br />

request<br />

• Wait<strong>in</strong>g strategies<br />

– earliest departure/arrival<br />

– latest departure/arrival<br />

21


Routes<br />

24


Routes<br />

25


Routes<br />

26


Routes<br />

27


Routes (f<strong>in</strong>al results)<br />

28


Agenda<br />

• <strong>Dynamic</strong> <strong>Vehicle</strong> <strong>Rout<strong>in</strong>g</strong> Problem<br />

– Static VRP<br />

– <strong>Dynamic</strong> VRP<br />

• DVRP Optimizer<br />

– Models<br />

– Algorithms<br />

• <strong>MATSim</strong> + DVRP Optimizer<br />

– Recent results<br />

– Future plans<br />

30


Architecture<br />

• Data flows<br />

• Allows for offl<strong>in</strong>e optimization<br />

1. Run <strong>MATSim</strong> simulation scenario<br />

2. Process traffic data<br />

3. Run VRP Optimizer with external request data<br />

31


Road network to graph mapp<strong>in</strong>g<br />

• Input:<br />

– road network<br />

– locations (depots, customers…)<br />

• Output<br />

dynamic<br />

– graph G=<br />

– least-cost arcs<br />

• travel distances/costs<br />

• travel times<br />

• sequence of visited nodes/l<strong>in</strong>ks<br />

(Path <strong>in</strong> <strong>MATSim</strong>)<br />

• 100 customers + 1 depot<br />

10,100 arcs<br />

• 1000 customers + 10 depots<br />

1,019,090 arcs<br />

32


Arc (shortest path) estimation<br />

• Data source<br />

– LeastCostPathCalculator TravelTimeCalculator ... TravelTimeData<br />

– TravelTimeData – conta<strong>in</strong>s travel times for a s<strong>in</strong>gle l<strong>in</strong>k for each time slice<br />

with<strong>in</strong> the simulation<br />

– Default precision is 15 m<strong>in</strong> (the length of a time slice)<br />

• Calculation (trivial)<br />

– for each arc f<strong>in</strong>d the “shortest” path for each (15-m<strong>in</strong>) time slice, i.e. (travel<br />

time, travel distance, sequence of nodes/l<strong>in</strong>ks)<br />

– 100 customers + 1 depot, 24-hour simulation, 15-m<strong>in</strong>ute time slices<br />

10,100 arcs * 96 s-path/arc = 969,600 shortest paths<br />

– 1000 customers + 10 depots,...<br />

97,832,640 shortest paths<br />

• Calculation (more sophisticated)<br />

– for each arc f<strong>in</strong>d the “shortest” path for each SENSIBLE time slice<br />

– SENSIBLE because consider<strong>in</strong>g constra<strong>in</strong>ts (mostly time-related) of vehicles,<br />

depots, customers and requests<br />

33


Wait<strong>in</strong>g strategies<br />

• Earliest Departure/Arrival<br />

– A vehicle departures at 9:00 (earliest possible departure time)<br />

– TT_D(t): getTravelTimeOnDeparture(<strong>in</strong>t departureTime)<br />

(if (mod(t, b<strong>in</strong>Size) != 0) – l<strong>in</strong>ear <strong>in</strong>terpolation)<br />

– The vehicle will arrive at a dest<strong>in</strong>ation at 9:00 + TT_D(9:00)<br />

• Latest Departure/Arrival<br />

– A vehicle must arrive at the next stop by 10:00 (latest possible arrival time)<br />

– TT_A(t): getTravelTimeOnArrival(<strong>in</strong>t arrivalTime)<br />

(if (mod(t, b<strong>in</strong>Size) != 0) – l<strong>in</strong>ear <strong>in</strong>terpolation)<br />

– The vehicle must start out at 10:00 - TT_A(10:00)<br />

• Instead of “Backward Dijkstra-like algorithms” a calculation of TT_A(t)<br />

based on TT_D(t)<br />

– TT_A(t+TT_D(t)) = TT_D(t)<br />

– TT_A are not calculated with a constant time gaps have to be “normalized”<br />

34


Network<br />

36


Route 1<br />

37


Route 1<br />

38


Route 1<br />

39


Route 1<br />

40


Architecture<br />

• Data flows<br />

• Bi-directional mapp<strong>in</strong>gs<br />

– Person (<strong>Vehicle</strong>/Agent?) <strong>Vehicle</strong><br />

– Plan Schedule (Route)<br />

– Activity/Leg Request/Trip<br />

– ...<br />

41


Onl<strong>in</strong>e optimization<br />

• Full <strong>in</strong>tegration of <strong>MATSim</strong> and VRP Optimizer<br />

INITIAL DATA<br />

OPTIMIZER<br />

events<br />

routes<br />

CONCURRENT ON-LINE PROCESSES<br />

CUSTOMER<br />

SERVICE<br />

TRAFFIC<br />

MONITORING<br />

FLEET<br />

MANAGEMENT<br />

42


Thank you…<br />

43

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!