Sanders/Schultes: Route Planning 1 Accurate High-Performance Route Planning Peter Sanders Dominik Schultes Institut für Theoretische Informatik Algorithmik II Universität Karlsruhe (TH) Eindhoven, March 6, 2005
Sanders/Schultes: Route Planning 2 How do I get there from here? Applications route planning systems in the internet (e.g. www.map24.de) car navigation systems
Sanders/Schultes: Route Planning 3 Goals exact shortest (i.e. fastest) paths in large road networks fast queries fast preprocessing low space consumption? scale-invariant, i.e., optimised not only for long paths
Sanders/Schultes: Route Planning 4 Related Work method query prepr. space scale source basic A ++ ++ + [Hart et al. 68] bidirected ++ ++ + [Pohl 71] heuristic hwy hier. + ++ + + [commercial] separator hierarchies o? [several groups 02] geometric containers ++ + + [Wagner et al. 03] bitvectors ++ o [Lauther... 04] landmarks + ++ [Goldberg et al. 04] landmarks + reaches ++ o o o [Goldberg et al. 06] highway hierarchies ++ + + + here
Sanders/Schultes: Route Planning 5 DIJKSTRA s Algorithm not practicable Dijkstra s t for large road networks (e.g. Western Europe: 18 000 000 nodes) bidirectional Dijkstra s t improves the running time, but still too slow
Sanders/Schultes: Route Planning 6 Naive Route Planning 1. Look for the next reasonable motorway
Sanders/Schultes: Route Planning 7 Naive Route Planning 1. Look for the next reasonable motorway 2. Drive on motorways to a location close to the target
Sanders/Schultes: Route Planning 8 Naive Route Planning 1. Look for the next reasonable motorway 2. Drive on motorways to a location close to the target 3. Search the target starting from the motorway exit
Sanders/Schultes: Route Planning 9 Commercial Systems 1. Search from the source and target node ( bidirectional ) within a certain radius (e.g. 20 km), consider all roads 2. Continue the search within a larger radius (e.g. 100 km), consider only national roads and motorways 3. Continue the search, consider only motorways fast, but not exact
Sanders/Schultes: Route Planning 10 Exact Highway Hierarchies complete search within a local area s t search in a (thinner) highway network = minimal graph that preserves all shortest paths contract network, e.g., iterate highway hierarchy s t
Sanders/Schultes: Route Planning 11 A Meaning of Local choose neighbourhood radius r(s) e.g. distance to the H-closest node for a fixed parameter H define neighbourhood of s: N (s) := {v V d(s,v) r(s)} example for H = 5 9 8 r s = 4 7 1 0 s 3 N 5 (s) 5 2 6
Sanders/Schultes: Route Planning 12 Highway Network N H (s) N H (t) s t Highway Edge (u,v) belongs to highway network iff there are nodes s and t s.t. (u,v) is on the canonical shortest path from s to t and v N (s) and u N (t)
Sanders/Schultes: Route Planning 13 Contraction highway nodes and edges
Sanders/Schultes: Route Planning 14 Contraction bypass node
Sanders/Schultes: Route Planning 15 Contraction shortcuts
Sanders/Schultes: Route Planning 16 Contraction bypass node
Sanders/Schultes: Route Planning 17 Contraction
Sanders/Schultes: Route Planning 18 Contraction enters component component (of bypassed nodes) leaves component
Sanders/Schultes: Route Planning 19 Contraction core
Sanders/Schultes: Route Planning 20 Contraction Which nodes should be bypassed? Use some heuristic taking into account the number of shortcuts that would be created and the degree of the node.
Sanders/Schultes: Route Planning 21 Construction Example: Western Europe, bounding box around Karlsruhe
Sanders/Schultes: Route Planning 22 Complete Road Network
Sanders/Schultes: Route Planning 23 Highway Network
Sanders/Schultes: Route Planning 24 Contracted Network (Core)gy
Sanders/Schultes: Route Planning 25 Highway Hierarchy: Level 1 and Level 2
Sanders/Schultes: Route Planning 26 Fast Construction Phase 1: Construction of Partial Shortest Path Trees For each node s 0, perform an SSSP search from s 0. A node s state is either active or passive. active s 0 is active. passive A node inherits the state of its parent in the shortest path tree. s 0 If the abort condition is fulfilled for a node p, p s state is set to passive. The search is aborted when all queued nodes are passive.
Sanders/Schultes: Route Planning 27 Fast Construction Abort Condition: N H (s 1 ) s 0 s 1 p N H (p) p is set to passive iff N(s 1 ) N(p) 1
Sanders/Schultes: Route Planning 28 Fast Construction, Phase 2 Theorem: The tree roots and leaves encountered in Phase 1 witness all highway edges. The highway edges can be found in time linear in the tree sizes. N H (s 0 ) N H (t 0 ) leaf of partial s 0 t 0 shortest path tree Highway
Sanders/Schultes: Route Planning 29 Fast Construction Problem: very long edges, e.g. ferries
Sanders/Schultes: Route Planning 30 Faster Construction Solution: An active node v is declared to be a maverick if d(s 0,v) > f r(s 0 ). When all active nodes are mavericks, the search from passive nodes is no longer continued. superset of the highway network mavericks active s 0 f d H (s 0 ) passive
Sanders/Schultes: Route Planning 31 Space Consumption Choose neighborhood sizes such that levels shrink geometrically linear space consumption Arbitrarily Small Constant Factor (not implemented): Large H 0 large level-0 radius small higher levels No r( ) needed for level-0 search (under certain assumptions) Mapping to next level by hash table
Sanders/Schultes: Route Planning 32 Query Bidirectional version of Dijkstra s Algorithm Restrictions: level 1 N(v) Do not leave the neighbourhood of the entrance point to the current level. s v level 0 N(s) Instead: switch to the next level. Do not enter a component of bypassed nodes. entrance point to level 0 entrance point to level 1 entrance point to level 2
Sanders/Schultes: Route Planning 33 Query (bidir. Dijkstra I) Operations on two priority queues Q and Q : void insert(nodeid, key) void decreasekey(nodeid, key) nodeid deletemin() node u has key δ(u) (tentative) distance from the respective source node
Sanders/Schultes: Route Planning 34 Query (bidir. Dijkstra II) query(s, t) { Q.insert(s, 0); Q.insert(t, 0); while ( Q Q /0) do { {, }; //select direction u := Q.deleteMin(); relaxedges(, u); } }
Sanders/Schultes: Route Planning 35 Query (bidir. Dijkstra III) relaxedges(, u) { } } foreach e = (u,v) E do { k := δ(u) + w(e); if v Q then Q.decreaseKey(v, k); else Q.insert(v, k);
Sanders/Schultes: Route Planning 36 Query (Hwy I) Operations on two priority queues Q and Q : void insert(nodeid, key) void decreasekey(nodeid, key) nodeid deletemin() node u has key (δ(u), l(u), gap(u)) (tentative) distance from the respective source node search level gap to the next neighbourhood border lexicographical order: <, <, >
Sanders/Schultes: Route Planning 37 Query (Hwy II) query(s, t) { Q.insert(s, (0,0,r 0 (s))); Q.insert(t, (0,0,r 0 (t))); while ( Q Q /0) do { {, }; //select direction u := Q.deleteMin(); relaxedges(, u); } }
Sanders/Schultes: Route Planning 38 Query (Hwy III) relaxedges(, u) { foreach e = (u,v) E do { if e enters a component then continue; // Restriction 2 gap := gap(u); if gap = then gap := r l(u) (u); for (l := l(u); w(e) > gap; l++) do gap := r l (u); // leave component // go upwards if l(e) < l then continue; // Restriction 1 k := (δ(u) + w(e), l, gap w(e)); if v Q then Q.decreaseKey(v, k); else Q.insert(v, k); } }
Sanders/Schultes: Route Planning 39 Query Theorem: We still find the shortest path.
Sanders/Schultes: Route Planning 40 Query Example: from Karlsruhe, Am Fasanengarten 5 to Palma de Mallorca
Sanders/Schultes: Route Planning 41 Bounding Box: 20 km Level 0 Search Space
Sanders/Schultes: Route Planning 42 Bounding Box: 20 km Level 0 Search Space
Sanders/Schultes: Route Planning 43 Bounding Box: 20 km Level 1 Search Space
Sanders/Schultes: Route Planning 44 Bounding Box: 20 km Level 1 Search Space
Sanders/Schultes: Route Planning 45 Bounding Box: 20 km Level 2 Search Space
Sanders/Schultes: Route Planning 46 Bounding Box: 20 km Level 2 Search Space
Sanders/Schultes: Route Planning 47 Bounding Box: 20 km Level 3 Search Space
Sanders/Schultes: Route Planning 48 Bounding Box: 80 km Level 4 Search Space
Sanders/Schultes: Route Planning 49 Bounding Box: 400 km Level 6 Search Space
Sanders/Schultes: Route Planning 50 Level 8 Search Space
Sanders/Schultes: Route Planning 51 Level 10 Search Space
Sanders/Schultes: Route Planning 52 Experiments W. Europe (PTV) USA/CAN (PTV) 18 029 721 #nodes 18 741 705 42 199 587 #directed edges 47 244 849 19 construction [min] 30 2.45 search time [ms] 3.37 4 181 speedup ( DIJKSTRA) 3 316
Sanders/Schultes: Route Planning 53 Shrinking of the Highway Networks 1e+08 1e+07 Europe H = 40 H = 60 H = 80 1e+06 100000 #edges 10000 1000 100 10 1 0 2 4 6 8 10 12 14 16 18 level
Sanders/Schultes: Route Planning 54 Queries Time Query Time [ms] 0 1 2 3 4 5 USA/CAN Europe 0 1 2 3 4 5 2 12 2 14 2 16 2 18 2 20 2 22 2 24 Dijkstra Rank
Sanders/Schultes: Route Planning 55 Queries Speedup Speedup (CPU time) 1 10 100 1000 10000 1 10 100 1000 10000 USA/CAN Europe 2 12 2 14 2 16 2 18 2 20 2 22 2 24 Dijkstra Rank
Sanders/Schultes: Route Planning 56 Conclusion exact shortest (i.e. fastest) paths in large road networks highway network preserves shortest paths fast queries 2.5 ms on average fast preprocessing 19 min reasonable space consumption overhead per node: 32 byte, improvable e.g. Europe 18 000 000 nodes scale-invariant, i.e., optimised not only for long paths multilevel approach
Sanders/Schultes: Route Planning 57 Future Work combination with goal directed approaches fast, local updates on the highway network (e.g. for traffic jams) Implementation for mobile devices (flash access... ) Flexible objective functions...
Sanders/Schultes: Route Planning 58
Sanders/Schultes: Route Planning 59 Road Network of Europe
Sanders/Schultes: Route Planning 60 Road Network USA/Can
Sanders/Schultes: Route Planning 61 Worst Case Costs Europe Frequency (* 1 000 000) 0 0.5 1 1.5 2 2.5 1612 2000 2500 3000 3500 4000 4500 5163 #settled nodes
Sanders/Schultes: Route Planning 62 Unidirectional Search Histogram USA Frequency (* 1 000 000) 0 0.5 1 1.5 2 2.5 3 1595 2000 2500 3000 3500 4000 4339 #settled nodes
Sanders/Schultes: Route Planning 63 Unidirectional Search Costs By Region xxx xxx xxx xxx xxx xxx xxx xxx easy... difficult
Sanders/Schultes: Route Planning 64 Canonical Shortest Paths 0 N(s N(s 1 ) N(t 1 ) 0 ) 0 1 N(v ) u 1 2 v 2 1 0 1 s 2 0 s 1 t 2 1 t 1 0 0 1 2 u v 2 1 0 1 0 (a) Construction, started from s 0. N(s 1 ) 0 0 1 u 1 v N(t 0 ) 2 2 N(u ) 1 0 1 s 2 0 s 1 t 2 1 t 1 0 0 1 u v 0 N(v) 2 2 1 1 0 (b) Construction, started from s 1.
Sanders/Schultes: Route Planning 65 0 0 1 u 1 2 v 2 1 0 1 s 2 0 s t 2 1 1 t 1 0 0 1 2 u v 2 1 0 1 0 (c) Result of the construction.