Time Dependent Contraction Hierarchies -- Basic Algorithmic Ideas
Contraction hierarchies are a simple hierarchical routing technique that has proved extremely efficient for static road networks. We explain how to generalize them to networks with time-dependent edge weights. This is the first hierarchical speedup t…
Authors: ** Veit Batz, Robert Geisberger, Peter S
Time Dep enden t Con traction Hierarc hies — B asic Algorithmic Ideas ∗ V eit Batz, Rob er t Geisb erger and Peter Sanders Univ ersit¨ at Karlsruhe (TH), 7612 8 Kar lsruhe, Germany { batz,robert .geisberger,sanders } @ira.uka.de Octob er 22 , 20 18 Abstract Con traction hierarc hies are a simple hierarc hical r outing tec hnique that has pro v ed extremely efficien t for static road net works. W e explain how to generalize them to net w orks with time-dep endent edge we ight s. This is the first hierarchical sp eedup tec hnique for time-dep end en t routing that allo ws bidirectional qu er y algorithms. 1 In tro duction This tec hnic al not e explains ho w con traction hierarc hies (CHs) can b e g eneralized to a llo w time-dep enden t edge w eigh ts. W e assume familiar ity with CHs [1, 2]. Like many of the most success ful sp eedup tec hniques for routing in road net w orks, the CH query-algorithm uses bidir e ctional searc h. This is a c hallenge since bidirectional searc hing in a time-dep enden t net w ork requires kno wing the ar r iv al time 1 whic h is what w e w an t to compute in the first place. Due to the difficult y of bidirectional routing , the first promising approa ches to fast rout- ing used goal directed rather than hierarc hical routing and accepted subo ptimal routes [3]. SHAR C routing [4] w as sp ecifically dev elop ed to enco de hierarchic al informatio n in to a goal-directed f ramew ork allowing unidirectional searc h and recen tly w as generalized to ex- act time-dep enden t routing [5]. Sc h ultes [6] giv es a w ay t o make queries in static net w orks unidirectional but this a pproac h do es not directly yield a time-dep enden t approach. 2 Preliminaries There are classical results on time-dep enden t route planning [7 ] that sho w that a simple generalization of Dijkstra’s unidirectional algorithm works for time-dep enden t net w orks G = ∗ Partially supp orted by DFG gra n t SA 933/ 4-1 and a Go ogle Research Aw ard 1 Wlog we assume that a query sp ecifies source, destination and departure time. 1 ( V , E ) if the ob jectiv e function is trav el time and a cost function f : R → R has the FIFO- pr op erty : ∀ τ < τ ′ : τ + f ( τ ) ≤ τ ′ + f ( τ ′ ), i.e., there is no ov e rtaking. W e fo cus on this case and further assume that the tra v el time functions are represen table by a piece-wise linear function. Ho w ev er, all our alg orithms view tra v el-time functions (TTFs) as an abstract data t yp e with a small n um b er of op erations, basically ev aluation, c haining (op eration ∗ computes a time-dep enden t function fo r a sequence of edges) a nd minim um computations. Also note, that the format used in public t r a nsp ortation with lists o f departure times and arriv al times can also b e represen ted in this w a y . The basic primitive s can b e implemen ted in suc h a w a y that ev aluation at a p oin t in time ta kes logarithmic time 2 and the other op erations ta ke time linear in the num ber of line segmen ts represen ting the inputs. It seems that any exact t ime-dep enden t prepro cessing tec hnique needs a basic ingredi- en t that computes trav el times not only for a p oint in time a tra v el time pr ofile but for an en tire time-interval . An easy wa y to implemen t this profile queury a generalization of Dijkstra’s a lg orithm to profiles [8]. T en tativ e distances then b ecome TTFs. Adding edge w eigh ts is replaced by chaining TT Fs and t a king the minim um tak es the minim um of TTFs. Unfortunately , the algorithm lo oses its lab el-setting prop ert y . How ev er, the p erformance a s a lab el-correcting algorithm seems to b e go o d in imp orta nt practical cases. 3 Constr u ction The most exp ensiv e prepro cessing phase of static CHs orders the no des by imp ortance. F or a first v ersion w e prop ose to adopt the static algorithm for the time-dep enden t CHs (TCHs). This is based on the assumption t hat av eraged ov er the pla nning p erio d, the imp orta nce of a no de is not hea vily a ff ected b y its exact traffic pattern. The second stage of CH-preprocessing – contraction – is in principle easy to adapt to time-dep endence: we c ontr act the no des o f the graph in the o rder computed previously . When con tracting no de v ∈ V ′ , w e are giv en a current (time-dep enden t) o v erla y graph G ′ = ( V ′ , E ′ ). F or ev ery com bina t ion of incoming edge ( u, v ) ∈ E ′ and outgoing edge ( v , w ) ∈ E ′ w e hav e to decide whether the path h u, v , w i ma y b e a shortest path at an y p oin t in time. If so, w e ha v e to insert the shortcut ( u , w ) into t he next ov erlay gra ph G ′′ = ( V ′ \ { v } , E ′′ ). The w eight function of this shortcut can b e computed b y c haining the w eight functions of its constituen ts. Later, w e o nly need to consider shortcuts during time interv als when they may represen t a shortest path. 3 The required information can b e computed b y running profile-Dijkstra from eac h no de u with ( u, v ) ∈ E ′ . T he shortcut is needed for w if c (( u, v ) ∗ ( v , w )) < d ( u, w ) at a ny p oin t in time. 2 Actually our implemen ta tion uses a buck eting heuristics that takes cons tant time o n average. 3 Although this can b e viewed as a violation o f the FIFO-prop erty , we do not get a problem when appliying time-dep e ndent Dijkstra – it never makes sense to w ait for a shortcut to beco me v alid since this would no t result in a shortest connection. 2 4 Query The basic static query algorithm for CHs consists of a forward search in an up w ard graph G ↑ = ( V , E ↑ ) and a bac kw ard searc h in a do wn w ard graph G ↓ . Wherev er, these searche s meet, w e hav e a candidate for a shortest path. The shortest suc h candidate is a shortest path. Since the departure time is know n, the forw ard searc h is easy to generalize. In particular, the only ov erhead compared to the static case is that w e ha v e to ev aluate eac h relaxed edge for one p oin t in time. In our experience with a plain time-dep enden t Dijkstra, this means a small constan t factor o v erhead in practice. The most easy w a y to adapt the back w ard search is to explore al l no des that can r e a c h t in G ↓ . Experimen ts for static CHs [2] indicate tha t t his searc h space is only a small constan t fa cto r larger t han the searc h space that takes edge w eigh ts in to accoun t . During this exploration w e mark all edges connecting no des that can reac h t . Let E marke d denote the set of mark ed edges. No w, w e can p erform an s – t -query b y a forward searc h from s in ( V , E ↑ ∪ E marke d ). Theorem 1 The ab ove a lgorithm is c orr e ct. Pro of:(Outline) This immediately follow s fro m the prop erties of TCHs. The detailed pro of is a na logous to the pro of in [2]. Roug hly , the prop erties of TCHs imply that there must b e a shortes t path P in the TCH that consists of t w o segmen ts: One using only eges in G ↑ leading to a p eak no de v p and one connecting v p to t in G ↓ . Since all edges of P are in the searc h space o f our forw ard searc h, this path o r some other shortest pa t h will b e found. 5 Refinemen ts 5.1 No de Ordering Note tha t there ar e many w ays t o adapt t he no de o rdering to tak e time-dep endence in to accoun t without resorting to full-fledged time-dep enden t pro cessing. F or example, w e can tak e the av erage tr av el time of an edge or lo ok at a sample of departure times and base our priorit y fo r no de-ordering on the entire sample. 5.2 Con traction The main difficulty in constructing TCHs is that the the complexities o f t ime-dep enden t edge w eights and ten tativ e distance s gro ws with progressiv e contraction and with the diameter of the profile-Dijkstra searc hes. One w a y to counte r this is to use a pproximations. With some care, this can b e done without compromising the exactness of queries. In particular, w e prop o se to compute piece-wise linear approximations that are alw ays within a facto r 1 + ǫ from the true trav el time. First, during a lo cal search , we can replace ten tativ e distances with less complex upp er b ounds o n the ten tativ e distance. The w orst tha t can happ en is that we in tro duce additional 3 shortcuts. The hop e is that for sufficien tly g o o d appro ximations of the true tentativ e dis- tance, the n um b er o f sup erfluous shortcuts will b e small. The in tuition b ehind this is that if traffic c hanges the shortest path at all, it is unlik ely that the tra v el time difference is tin y . F or shortcuts that are a ctually introduced, w e compute b oth upp er and low er b ounds. F or comparing a shortcut a with a witness b , we compare a low er bo und for a with an upp er b ound fo r b . Once the (a ppro ximate) TCH is computed, we ha v e a choice whether we w ant to condense it in to an exact TCH (i.e., for all shortcuts in tro duced, w e compute there exact edge cost functions) or w e later mo dify the query to compute exact shortest paths using appro ximate TCHs (A TCH). Note that the complexit y of the functions affects the space requiremen ts but has little influence on the cost of ev aluation and th us on the query time. 5.3 Query W e can prune the forw ard searc h by mar king all no des v in the bac kward searc h space with a lo w er b ound ℓ ( v ) on the trav el time to t . Note that this info rmation can b e gathered with a static Dijkstra algorithm that is like ly to be f aster than time-dependent Dijkstra. F urthermore, w e compute a n upp er b o und U for the trav el time fr om s to t using an y static routing tec hnique, unpac king o f the statically optimal path P , and time-dep enden t ev a lua tion of P . No w, during forw ard searc h, if d ( s, v ) + ℓ ( v ) > U we do not need to con tinue the searc h. There are v arious w a ys to compute b etter upper and lo w er b ounds. Assume w e hav e computed a lo wer b ound L on the total trav el time using searc h in a static graph. Using U , L and the departure time, w e kno w a time window W for the arriv al time. F or computing the lo w er b o unds ℓ ( v ) w e can then p erform a v a riation of Dijkstras algorit hm that computes minim um trav el times o v er a time interv al. If the time inte rv al is small, this mig ht b e fast. Exact Routing in A TCHs (Outline) W e mo dify our query algorithm to compute a graph that contains all edges that might b e in the shortest pat h tree using upp er and lo w er b ounds in a conserv ative wa y . Then, using t he pruning tec hniques from ab o v e, w e remo v e all parts of t his g raph that cannot be part of a shortest path from s to t at a g iven departure time. Then , w e unpack all surviving edges. Hop efully , the resulting gra ph will mostly consist of a small nu mber of partially ov erlapping paths from s to t . Finally , w e p erform an exact forw ard search from s in the unpack ed graph. 6 Conclus ions W e ha ve dev elop ed algorithmic ideas f o r time dep enden t ro uting using CHs. Now exper- imen ts hav e to sho w whether alr eady the most basic approac h or some of its refinemen ts yields a go o d exact query algo r ithm for road net w orks or public tra nsp ortation. If problems sho w up, it is lik ely that the densit y of the graph or the complexit y of shortcuts gets out of hands in the la ter stages of con traction. F rom the exp erience with static r o uting [9], it is lik ely tha t suc h problems could b e mitigated using a com bination with goal directed tec hniques, e.g., a rc-flags. Again from [9] it could be exp ected tha t at least this com bination will outp erfor m SHAR C [5 ]. 4 F or commercial applications, appro ximate queries are not a big problem. In this case, man y simplifications suggest themselv es where we can simply use approximations of time dep enden t functions that ar e neither upp er no r lo w er b ounds a nd where w e o nly in tro duce shortcuts that bring significant impro v emen ts. References [1] G eisb erg er, R., Sanders, P ., Sch ultes, D.: Con traction hierarc hies: F aster and simpler hierarc hical routing in road net w orks. In: 7th W orkshop on Experimen tal Algorithms. (2008) to app ear. [2] G eisb erg er, R.: Con traction hierarchies : F aster and simpler hierarchic al routing in road net w o rks (20 0 8) Diploma Thesis, Univ ersit¨ at Kar lsruhe. [3] Nannicini, G., Delling, D ., Lib erti, L., Sc hulte s, D.: Bidirectionsl A* searc h for time- dep enden t f ast paths. In: 7th W orkshop on Experimen tal Algorithms. (2008) to app ear. [4] Ba uer, R., Delling, D.: SHAR C: F ast and robust unidirectional routing. In: W orkshop on Algorithm Engineering and Exp erimen ts (ALENEX). (20 0 8) [5] D elling, D.: Time dep enden t SHAR C-routing. submitted fo r publication (2008) [6] Sch ultes, D.: Route Planning in Road Net works. PhD thesis (2008) [7] Co ok e, K., Halsey , E.: The shortest route through a net w ork with time-dep enden t in termo dal transit times. Journal of Mathematical Analysis and Applications 14 (1 9 66) 493–498 [8] K a ufman, D.E., Smith, R.L.: F astest pa t hs in time-dep endent netw orks for intelligen t v ehicle-highw a y systems application. Journal of Intelligen t T ra nsp o rtation Systems 1 (1993) 1–11 [9] Ba uer, R., Delling, D., Sanders, P ., Schieferde c k er, D., Sc h ultes, D., W agner, D.: Com- bining hierarc hical and goal-directed sp eed-up tec hniques for Dijkstra’s algor it hm. In: 7th W orkshop o n Exp erimental Algo rithms (WEA). (2 0 08) 5
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment