The Vehicle Routing Problem with Time Windows and Scheduled Departure. Ho-Chi-Minh City, March-2010 Cristian Oliva San Martín. Universidad Católica de la Santísima Concepción. Chile. INTRODUCTION Algorithms Remarks VRPTW VRP VRPTWSL Create and Implement an algorithm for solving the VRPTWSL. Methods of Solution Exact Methods Approximation Methods Heuristics •Construction. •Local search. Metaheuristics •Simulated Annealing •Genetic algorithms •Ant Colony Optimization •Tabu-Search The vehicle is loaded in the depot, This time is calculated as: load time = load factor * service time. Arrival Time: Load time + Travel time + departure time. Departure time: Arrival time + Service time. Distances [0,20] [20,24] [24,25] [25,0] [0,5] [5,7] [7,0] [0,3] [3,18] [18,19] [19,15] [15,16] [16,0] Customer 0 20 24 25 5 7 3 18 19 15 16 X coord. 40 30 25 25 42 40 42 15 15 20 20 Y coord. 50 50 50 52 65 66 66 75 80 80 85 Demand 0 10 10 40 10 20 10 20 10 40 40 10 5 2 17 17 3 16 18 36 5 5 5 55 Ready Time 0 10 65 169 15 170 65 179 278 384 475 Arrival time Wait time 37 0 132 0 224 0 331 0 62 0 155 15 276 0 108 0 234 0 329 0 424 0 519 0 664 0 Due Date 1236 73 144 224 67 225 146 254 345 429 528 Service Time 0 90 90 90 90 90 90 90 90 90 90 24 2 5 25 20 10 3 18 36 17 5 55 16 18 16 5 3 5 7 15 5 19 24 2 5 25 20 10 [0,27] 3 18 36 17 5 55 16 18 16 5 3 5 7 15 5 19 24 2 5 25 [37,127] 20 10 [0,27] 3 18 36 17 5 [27,45] 16 55 18 16 5 3 5 7 15 5 19 [132,222] 24 2 5 25 [37,127] 20 10 [0,27] 3 18 36 [45,90] 17 [27,45] 55 18 [62,152] 5 16 16 5 3 5 7 15 5 19 [132,222] 24 2 [224,314] 5 25 [37,127] [108,198] 20 10 [0,27] 3 18 36 [45,90] 17 [27,45] 55 18 [62,152] 5 16 16 5 3 5 7 [170,260] 15 5 19 [132,222] Route 2: [276,1236] 24 Route 1: [331,1236] 2 [224,314] 5 25 [37,127] [108,198] 20 10 [0,27] 3 18 36 [45,90] 17 [27,45] [234,324] 55 18 [62,152] 5 16 16 5 3 5 7 15 5 19 [132,222] Route 2: [276,1236] 24 Route 1: [331,1236] 2 [224,314] 5 25 [37,127] [108,198] 20 10 [0,27] 3 18 36 [45,90] 17 [234,324] [27,45] 55 18 [62,152] 5 16 16 5 3 5 7 [170,260] 15 5 19 [329,419] [132,222] Route 2: [276,1236] 24 Route 1: [331,1236] 2 [224,314] 5 25 [37,127] [108,198] 20 10 [0,27] 3 18 36 [45,90] 17 [27,45] [234,324] 55 18 [62,152] 5 16 16 5 3 5 7 [170,260] 15 [424,514] 5 19 [329,419] [132,222] Route 2: [276,1236] 24 Route 1: [331,1236] 2 [224,314] 5 25 [37,127] [108,198] 20 10 [0,27] 3 18 36 [45,90] 17 [234,324] [27,45] 55 18 [62,152] 5 16 16 [519,609] 5 3 5 7 [170,260] 15 [424,514] 5 19 [329,419] [132,222] Route 2: [276,1236] 24 Route 1: [331,1236] 2 [224,314] 5 Route 3: [664,1236] 25 [37,127] [108,198] 20 10 [0,27] 3 18 36 [45,90] 17 [234,324] [27,45] 55 18 [62,152] 5 16 16 [519,609] 5 3 5 7 [170,260] 15 [424,514] 5 19 [329,419] VRPTW SL Simple Heuristics for VRPTWSL 1. Nearest Neighbor (NN) [for TSP] (By Rosenkrantz, Sterns, Lewis, SIAM J. Computing 6(1977) 563-581) Step 1. Start with node 0 as the beginning of the TSP tour Step 2. - Find the node closest to the last node added to the tour satisfying all the constraints. - Add this node to the tour Step 3. - Repeat Step 2 until all nodes are added to the tour - Then join the first and the last nodes READY DUE SERVICE CLIENT XCOORD YCOORD DEMAND TIME DATE TIME 0 40 50 0 0 1236 0 1 42 66 10 65 146 90 2 18 75 20 99 148 90 3 45 68 10 912 967 90 4 38 68 20 255 324 90 0 LOAD TIME 0 9 9 9 9 DISTANCES 0 18 47 20 23 READY DUE SERVICE CLIENTE XCOORD YCOORD DEMANDA TIME DATE TIME 0 40 50 0 0 1236 0 1 42 66 10 65 146 90 2 18 75 20 99 148 90 3 38 68 20 255 324 90 4 45 68 10 912 967 90 departure= 65+90=155 1 Arrival= 9+18=27 pi= 9 0 Arrival= 155+18=173 LOAD TIME 0 9 9 9 9 DISTANCES 0 18 47 20 23 READY DUE SERVICE CLIENT XCOORD YCOORD DEMAND TIME DATE TIME 0 40 50 0 0 1236 0 1 42 66 10 65 146 90 2 18 75 20 99 148 90 3 38 68 20 255 324 90 4 45 68 10 912 967 90 departure= 65+90=155 1 Arrival = 18+18=36 arrival= 155+6=161 3 departure= 255+90=345 pi= 18 0 arrival =345+20= 371 LOAD TIME 0 9 9 9 9 DISTANCES 0 18 47 20 23 READY DUE SERVICE CLIENT XCOORD YCOORD DEMAND TIME DATE TIME 0 40 50 0 0 1236 0 1 42 66 10 65 146 90 2 18 75 20 99 148 90 3 38 68 20 255 324 90 4 45 68 10 912 967 90 departure= 65+90=155 1 arrival = 27+18=45 arrival= 155+6=161 pi= 27 3 departure= 255+90=345 arrival=1002+23=1025 arrival= 345+7=352 4 departure= 912+90=1002 0 LOAD TIME 0 9 9 9 9 DISTANCES 0 18 47 20 23 READY DUE SERVICE CLIENT XCOORD YCOORD DEMAND TIME DATE TIME 0 40 50 0 0 1236 0 1 42 66 10 65 146 90 2 18 75 20 99 148 90 3 38 68 20 255 324 90 4 45 68 10 912 967 90 departure= 65+90=155 1 arrival = 27+18=45 2 pi= 27 departure= 255+90=345 arrival=1002+23=1025 arrival= 345+2=347 4 departure= 912+90=1002 DISTANCES 0 18 47 20 23 arrival=36+47=83 arrival= 155+2=157 3 LOAD TIME 0 9 9 9 9 0 departure=99+90=189 pi= 36 arrival=189+57=246 Instances v/s Total Costs Heurística basada en Distancias Heurística basada en Ventanas de Tiempo 50000 45000 35000 30000 25000 20000 15000 10000 5000 C208 C207 C206 C205 C204 C203 C202 C201 C208 C207 C206 C205 C204 C203 C202 C201 C109 C108 C107 C106 C105 C104 C103 C208 C207 C206 C205 C204 C203 C202 C201 C109 C108 C107 C106 C105 C104 C103 C102 0 C101 Total Costs 40000 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50100100100100100100100100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 Instance Instances v/s Number of vehicles Nº Veh.Heurística basada en Distancias Nº Veh.Heurística basada Ventanas de Tiempo 30 20 15 10 5 C208 C207 C206 C205 C204 C203 C202 C201 C208 C207 C206 C205 C204 C203 C202 C201 C109 C108 C107 C106 C105 C104 C103 C208 C207 C206 C205 C204 C203 C202 C201 C109 C108 C107 C106 C105 C104 C103 C102 0 C101 Nº of Vehicles 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50100100100100100100100100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 Instance Results Instances v/s Nº of loaders Nº Carg.Heurística basada en Distancias Nº Carg. Heurística basada en Ventanas de Tiempo 3.5 2.5 2 1.5 1 0.5 C208 C207 C206 C205 C204 C203 C202 C201 C208 C207 C206 C205 C204 C203 C202 C201 C109 C108 C107 C106 C105 C104 C103 C208 C207 C206 C205 C204 C203 C202 C201 C109 C108 C107 C106 C105 C104 C103 C102 0 C101 Nº of loaders 3 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50100100100100100100100100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 Instances Local Search Heuristics (LSH) • Simple heuristics: - generates one solution only • Local search heuristics: - generates many solutions - choose the best one Definition: Given a solution S, its neighborhood N(S) is defined as the set of all solutions than can be obtained through a well-defined modification of S Basic idea of Local Search Heuristics • Start with a solution (initial solution obtained by a simple heuristic) S1 S2 N(S2) • Search its neighborhood • Select a solution from the neighborhood • Either reject or accept the new solution N(S1) S3 S4 Three components of a LSH 1. Neighborhood design 2. Search process in the neighborhood 3. Acceptance-rejection criterion N(S3) K-Opt heuristic • Lin, Bell Systems Technical J. 44(1965) 2245-2269 • Lin & Kernigham, Operations Research 21(1973) 498-516 Definition: K-exchange is a procedure that replaces K arcs in a given TSP tour by K new arcs so that the resulting tour is still a TSP tour. K-Opt heuristic B C A B A C E D B A “2-exchange” D E Replace (A, B) & (C, D) by (A, C) & (B, D) Replace (A, B), (C, D) & (D, E) by (B, D), (A, D) & (C, E) “3-exchange” C E D B C A E D 8 8 4 4 1 1 7 7 6 6 5 2 3 5 2 Initial Solution X Solution X’ Total cost: 42 Total cost: 36 Waiting time: 25 Waiting time: 24 3 (1 , 2) 42 36 0.005(24 25) (1 , 2) 6.005 2. Simulated Annealing (SA) Step 1: Find an initial solution using any heuristic, S. Let the incumbent solution S*=S. Select the cooling parameter T > 0. Step 2: Select a candidate solution Sc from N(S). If F(Sc)<F(S*), update the incumbent, S*=Sc. If F(Sc)<F(S), accept Sc, i.e. let S = Sc. If F(Sc)>F(S), accept Sc with probability exp((F(S)-F(S c))/T), if Sc is accepted, then let S = Sc, o/w, S is not updated. Step 3: - Update b such that it becomes smaller. - Repeat Step 2 until a certain stopping rule is satisfied (e.g. stop after 1000 iterations). Note: Three things may affect effectiveness of SA - neighborhood design - the way a candidate solution is selected - cooling parameter 3. Tabu Search (TS) (1 of 3) • Similar to SA with a different acceptance-rejection criterion • Tabu list of mutations (prohibited moves) Step 1: - Find an initial solution using any heuristic, S. - Let the incumbent solution S*=S. - Set tabu list length L. Initially the tabu list is empty. 3. Tabu Search (TS) (2 of 3) . Step 2: (1) Select a candidate solution Sc from N(S) such that the move from S to Sc is not a mutation on the tabu list. (2) Enter the reverse mutation of the move at the top of the tabu list, push all other entries in the list one position down, & delete the entry at the bottom of list if the list length exceeds L. (3) Accept Sc, i.e. let S = Sc. (4) If F(Sc)<F(S*), update the incumbent, S*=Sc. 3. Tabu Search (TS) (3 of 3) Step 3: Repeat Step 2 until some stopping rule is satisfied (e.g. stop after 1000 iterations). Three things may affect effectiveness of TS - neighborhood design - the way a candidate solution is selected - Length parameter