dijkstra’s algorithm keep going!. pre-computing shortest paths how many paths to pre-compute?...

Download Dijkstra’s Algorithm Keep Going!. Pre-Computing Shortest Paths How many paths to pre-compute? Recall: –Using single-source to single-dest find_path: Need

If you can't read please download the document

Post on 15-Dec-2015

222 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

  • Slide 1

Dijkstras Algorithm Keep Going! Slide 2 Pre-Computing Shortest Paths How many paths to pre-compute? Recall: Using single-source to single-dest find_path: Need any delivery location to any other travel time: N * (N-1) 2450 calls for N = 50 Plus any depot to any delivery location M * N 500 calls for N = 50, M = 10 Plus any delivery location to any depot N * M 500 calls Total: 3450 calls to your find_path Slide 3 Pre-Computing Travel Time Paths Using single-source to all destinations Need any delivery location to any other N calls 50 Plus any depot to any delivery location M calls 10 Plus any delivery location to any depot 0 calls Total: 60 calls Is this the minimum? No, with small change can achieve: 51 calls Get from earlier call Slide 4 Is This Fast Enough? Recall: Dijkstras algorithm can search whole graph Especially with multiple destinations O(N) items to put in wavefront Using heap / priority_queue: O (log N) to add / remove 1 item from wavefront Total: N log N Can execute in well under a second OK! Slide 5 Escaping Local Minima Revisited Slide 6 Say Were In This State 0 1 2 3 4 5 6 7 8 9 Local perturbation to improve? deliveryOrder = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Slide 7 Swap Order of Two Deliveries? 0 1 2 3 4 5 6 7 8 9 deliveryOrder = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} deliveryOrder = {0, 1, 3, 2, 4, 5, 6, 7, 8, 9} No swap of two deliveries can improve! Stuck in a local minimum Slide 8 2-Opt? 0 1 2 3 4 5 6 7 8 9 Path cut into 3 pieces deliveryOrder = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Slide 9 2-Opt? 0 1 2 3 4 5 6 7 8 9 Reconnected: worse! deliveryOrder = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}deliveryOrder = {0, 1, 2, 6, 5, 4, 3, 7, 8, 9} Slide 10 2-Opt? 0 1 2 3 4 5 6 7 8 9 Reconnected differently: now better! deliveryOrder = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}deliveryOrder = {0, 1, 2, 7, 8, 9, 6, 5, 4, 3}

Recommended

View more >