Approx Ch Slides

Embed Size (px)

Citation preview

  • 8/21/2019 Approx Ch Slides

    1/39

    1 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    2

    1 2

    2

    6

    1

    4

    3

    5

    3

    35

    8

    s

    t2

    Institute for Theoretical Informatics, Algorithms II

    Heuristic Contraction Hierarchies withApproximation GuaranteeRobert Geisberger [email protected]

    Dennis Schieferdecker [email protected]

    KIT University of the State of Baden-Wrttemberg and

    National Large-scale Research Center of the Helmholtz Association www.kit.edu

  • 8/21/2019 Approx Ch Slides

    2/39

    Motivation

    2 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    My domain: Route planning inroad networks.

    Input:GraphG= (V, E)with edge weight function c :E R+.

    Task: Compute theshortest path distance d(s, t).

    Previous work:

    Perform apreprocessingstep.

    Several algorithms with different tradeoffs ofpreprocessing time,preprocessing space, andquery speedup.

    algorithm space preproc. speedup

    [B/n] [min]Dijkstra 0 0 1contraction hierarchies -4 32 41 041transit nodes + edge flags 320 229 3 327 372

  • 8/21/2019 Approx Ch Slides

    3/39

    Motivation

    3 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    Arising Question:Can we transfer these results toother graph classes?

    Problems:

    We justobserve good performance.

    Wemiss hard theoryexplaining the good performance.Some of our algorithms have in the worst case aruntime worse thanDijkstraon arbitrary graphs.

    Our contribution:

    We applied our algorithms on other promising graph classes,observed their performance, and looked for potential optimizations.

    The result is an approximate version of contraction hierarchies thatimproves the performance on certain graph classes.

  • 8/21/2019 Approx Ch Slides

    4/39

    4 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    Contraction Hierarchies (CH)

    21 2

    2

    6

    1

    4

    3

    5

    3

    35

    8

    2

  • 8/21/2019 Approx Ch Slides

    5/39

    Related Work

    5 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    Contraction Hierarchies (CH) [WEA 2008]CH is based on the concept ofnode contraction: removing a nodeand adding shortcuts topreserveshortest paths distances.

    in more detail:

    Ordernodes by importance,V ={1, 2,. . . , n}.

    Contractnodes in this order, nodev is contracted by

    foreachpair(u, v)and(v, w)of edgesdoifu, v, wis a unique shortest paththen

    addshortcut(u,

    w)with weightc

    (u,

    v,

    w)

    Queryrelaxes only edges to more important nodes.valid due to shortcuts

  • 8/21/2019 Approx Ch Slides

    6/39

    Example: Construction

    6 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    2 3 2 1 22 6 1 3 54

  • 8/21/2019 Approx Ch Slides

    7/39

    Example: Construction

    6 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    2

    3 2

    1 22 6

    1

    4 3 55

  • 8/21/2019 Approx Ch Slides

    8/39

    Example: Construction

    6 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    2

    1 2

    2

    6

    1

    4 3 55

    3 2

  • 8/21/2019 Approx Ch Slides

    9/39

    Example: Construction

    6 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    2

    1 2

    2

    6

    1

    4

    3

    55

    3 2

    3

  • 8/21/2019 Approx Ch Slides

    10/39

    Example: Construction

    6 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    2

    2

    2

    6

    1

    4

    3

    5

    3

    2

    3

    8

    1

    5

  • 8/21/2019 Approx Ch Slides

    11/39

    Example: Construction

    6 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    2 1 2

    2

    6

    1

    4

    3

    5

    3

    35

    8

    2

  • 8/21/2019 Approx Ch Slides

    12/39

    Construction

    7 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    To identify necessary shortcuts,

    performlocal witness searchfrom nodeuwith incoming edge(u, v),

    ignorenodevat search,

    andadd shortcut(u, w)iff no witness is found orc(witness) > c(u, v) +c(v, w).

    1

    1

    1

    1

    1

    v

  • 8/21/2019 Approx Ch Slides

    13/39

    Construction

    7 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    To identify necessary shortcuts,

    performlocal witness searchfrom nodeuwith incoming edge(u, v),

    ignorenodevat search,

    andadd shortcut(u, w)iff no witness is found orc(witness) > c(u, v) +c(v, w).

    2

    2

    1

    1

    1

    1

    1

    v

  • 8/21/2019 Approx Ch Slides

    14/39

    Query

    8 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    The query is a modifiedbidirectionalDijkstra algorithm.

    upward graph G := (V, E)withE :={(u, v) E |u< v}downward graph G := (V, E)withE :={(u, v) E |u> v}

    We perform a forward search in G and a backward search inG.

    21 2

    2

    6

    1

    4

    3

    5

    3

    35

    8

    s

    tnode

    order

    2

  • 8/21/2019 Approx Ch Slides

    15/39

    Query

    8 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    The query is a modifiedbidirectionalDijkstra algorithm.

    upward graph G := (V, E)withE :={(u, v) E |u< v}downward graph G := (V, E)withE :={(u, v) E |u> v}

    We perform a forward search in G and a backward search inG.

    21 2

    2

    6

    1

    4

    3

    5

    3

    35

    8

    s

    tnode

    order

    2

  • 8/21/2019 Approx Ch Slides

    16/39

    Query

    8 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    The query is a modifiedbidirectionalDijkstra algorithm.

    upward graph G := (V, E)withE :={(u, v) E |u< v}downward graph G := (V, E)withE :={(u, v) E |u> v}

    We perform a forward search in G and a backward search inG.

    21 2

    2

    6

    1

    4

    3

    5

    3

    35

    8

    s

    tnode

    order

    2

  • 8/21/2019 Approx Ch Slides

    17/39

    Query

    8 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    The query is a modifiedbidirectionalDijkstra algorithm.

    upward graph G := (V, E)withE :={(u, v) E |u< v}downward graph G := (V, E)withE :={(u, v) E |u> v}

    We perform a forward search in G and a backward search inG.

    21 2

    2

    6

    1

    4

    3

    5

    3

    35

    8

    s

    tnode

    order

    2

    S b k K l h

  • 8/21/2019 Approx Ch Slides

    18/39

    9 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    Saarbrcken to Karlsruhe299 edges compressed to 13 shortcuts.

    S b k K l h

  • 8/21/2019 Approx Ch Slides

    19/39

    10 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    Saarbrcken to Karlsruhe

    316 settled nodes and 951 relaxed edges

  • 8/21/2019 Approx Ch Slides

    20/39

    Our Contribution

    11 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    Approximate Contraction Hierachies (apxCH)Path found by query algorithm has a maximumstretch of(1 + ).

    Improves performanceon certain instances.

    (a) input (b) CH (c) apxCH-10%

  • 8/21/2019 Approx Ch Slides

    21/39

    Approximate Contraction HierarchiesBasic idea

    12 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    Avoid a shortcut, even when a witness is (1 + )times longer.

    s tn

    odeorder

    u

    v

    5 5

    5 6

  • 8/21/2019 Approx Ch Slides

    22/39

    Approximate Contraction HierarchiesBasic idea

    12 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee

    Institute for Theoretical InformaticsAlgorithms II

    Avoid a shortcut, even when a witness is (1 + )times longer.

    s tn

    odeorder

    u

    v

    5 5

    5 6

    no shortcut

  • 8/21/2019 Approx Ch Slides

    23/39

    Approximate Contraction HierarchiesBasic idea

    12 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation GuaranteeInstitute for Theoretical Informatics

    Algorithms II

    Avoid a shortcut, even when a witness is (1 + )times longer.

    But:straightforward implementation can causeerrors to stack.

    s t

    n

    odeorder

    u

    v

    w

    5 5

    5 6

    8 4

  • 8/21/2019 Approx Ch Slides

    24/39

    Approximate Contraction HierarchiesBasic idea

    12 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation GuaranteeInstitute for Theoretical Informatics

    Algorithms II

    Avoid a shortcut, even when a witness is (1 + )times longer.

    But:straightforward implementation can causeerrors to stack.

    s t

    n

    odeorder

    u

    v

    w

    5 5

    5 6

    8 4

    no shortcut

    A i C i Hi hi

  • 8/21/2019 Approx Ch Slides

    25/39

    Approximate Contraction HierarchiesBasic idea

    12 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    Avoid a shortcut, even when a witness is (1 + )times longer.

    But:straightforward implementation can causeerrors to stack.

    s t

    n

    odeorder

    u

    v

    w

    5 5

    5 6

    8 4

    no shortcut

    A i t C t ti Hi hi

  • 8/21/2019 Approx Ch Slides

    26/39

    Approximate Contraction HierarchiesBasic idea

    12 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    Avoid a shortcut, even when a witness is (1 + )times longer.

    But:straightforward implementation can causeerrors to stack.

    s t

    n

    odeorder

    u

    v

    w

    5 5

    5 6

    8 4

    missing shortcut

    A i t C t ti Hi hi

  • 8/21/2019 Approx Ch Slides

    27/39

    Approximate Contraction HierarchiesDetails

    13 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    Store asecond edge weight cwith each edge (initially c := c).

    Add shortcut iff c(witness) > (1 + )c(shortcut).

    Update c(x, y) :=min

    c(x, y),c(shortcut) c(x,y)c(witness)

    for all edges

    (x, y)on the witness path that prevented the shortcut. c(witness) c(shortcut)

    s t

    nod

    eorder

    u

    v

    w

    5 5

    5 6

    8 4

    (5)

    (5)

    (5) (6)

    (8)(4)

    A i t C t ti Hi hi

  • 8/21/2019 Approx Ch Slides

    28/39

    Approximate Contraction HierarchiesDetails

    13 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    Store asecond edge weight cwith each edge (initially c := c).

    Add shortcut iff c(witness) > (1 + )c(shortcut).

    Update c(x, y) :=min

    c(x, y),c(shortcut) c(x,y)c(witness)

    for all edges

    (x, y)on the witness path that prevented the shortcut. c(witness) c(shortcut)

    s t

    nod

    eorder

    u

    v

    w

    5 5

    8 4

    no shortcut

    (5)

    (5)

    5 6(5) (6)

    (8)(4)

    Approximate Contraction Hierarchies

  • 8/21/2019 Approx Ch Slides

    29/39

    Approximate Contraction HierarchiesDetails

    13 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    Store asecond edge weight cwith each edge (initially c := c).

    Add shortcut iff c(witness) > (1 + )c(shortcut).

    Update c(x, y) :=min

    c(x, y),c(shortcut) c(x,y)c(witness)

    for all edges

    (x, y)on the witness path that prevented the shortcut. c(witness) c(shortcut)

    s t

    nod

    eorder

    u

    v

    w

    5 5

    5 6

    8 4

    no shortcut

    (5)

    (5)

    (4 611 ) (5 511 )

    (8)(4)

    Approximate Contraction Hierarchies

  • 8/21/2019 Approx Ch Slides

    30/39

    Approximate Contraction HierarchiesDetails

    13 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    Store asecond edge weight cwith each edge (initially c := c).

    Add shortcut iff c(witness) > (1 + )c(shortcut).

    Update c(x, y) :=min

    c(x, y),c(shortcut) c(x,y)c(witness)

    for all edges

    (x, y)on the witness path that prevented the shortcut. c(witness) c(shortcut)

    s t

    nod

    eorder

    u

    v

    w

    5 5

    5 6

    8 4

    (5)

    (5)

    (4 611 ) (5 511 )

    (8)(4)

    Approximate Contraction Hierarchies

  • 8/21/2019 Approx Ch Slides

    31/39

    Approximate Contraction HierarchiesDetails

    13 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    Store asecond edge weight cwith each edge (initially c := c).

    Add shortcut iff c(witness) > (1 + )c(shortcut).

    Update c(x, y) :=min

    c(x, y),c(shortcut) c(x,y)c(witness)

    for all edges

    (x, y)on the witness path that prevented the shortcut. c(witness) c(shortcut)

    s t

    nod

    eorder

    u

    v

    w

    5 5

    5 6

    shortcut 11

    8 4

    (5)

    (5)

    (4 611 ) (5 511 )

    (8)(4)

    Combination with Goal directed

  • 8/21/2019 Approx Ch Slides

    32/39

    Combination with Goal-directedTechniques

    14 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    Techniques: A*, ALT, Arc flags.

    Goal-direction only on thecore of 5% highest ordered nodes.

    Previous algorithms[Bauer et al. 2008] work almost directlywithapproximate node contraction.

    A* and ALT can beweighted with(1 + )[Pohl 1970].

    s t

    Experimental Results

  • 8/21/2019 Approx Ch Slides

    33/39

    Experimental Results

    15 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    sensor network, 1 000 000 nodes, average degree 10

    preproc. query[s] [B/n] #settled [ms] error

    bidir. Dijkstra 0 0 326 597 127.1 -bidir. ALT-a64 194 512 3 173 2.8 -

    unidir. A* 0 16 57 385 36.6 -unidir. WA*-10% 0 16 1 234 1.0 1.25%unidir. WA*-21% 0 16 724 0.7 2.87%

    CH 1 887 0 2 969 4.0 -apxCH-1% 993 -4 2 742 2.7 0.16%

    apxCH-10% 474 -18 2 584 1.9 2.17%apxCHALT-10% 489 7 215 0.3 2.16%apxCHALT-10% W-10% 489 7 102 0.2 3.56%

    Experimental Results

  • 8/21/2019 Approx Ch Slides

    34/39

    Experimental Results

    15 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    sensor network, 1 000 000 nodes, average degree 10

    preproc. query[s] [B/n] #settled [ms] error

    bidir. Dijkstra 0 0 326 597 127.1 -bidir. ALT-a64 194 512 3 173 2.8 -

    unidir. A* 0 16 57 385 36.6 -unidir. WA*-10% 0 16 1 234 1.0 1.25%unidir. WA*-21% 0 16 724 0.7 2.87%

    CH 1 887 0 2 969 4.0 -apxCH-1% 993 -4 2 742 2.7 0.16%

    apxCH-10% 474 -18 2 584 1.9 2.17%apxCHALT-10% 489 7 215 0.3 2.16%apxCHALT-10% W-10% 489 7 102 0.2 3.56%

    Experimental Results

  • 8/21/2019 Approx Ch Slides

    35/39

    Experimental Results

    15 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    sensor network, 1 000 000 nodes, average degree 10

    preproc. query[s] [B/n] #settled [ms] error

    bidir. Dijkstra 0 0 326 597 127.1 -bidir. ALT-a64 194 512 3 173 2.8 -

    unidir. A* 0 16 57 385 36.6 -unidir. WA*-10% 0 16 1 234 1.0 1.25%unidir. WA*-21% 0 16 724 0.7 2.87%

    CH 1 887 0 2 969 4.0 -apxCH-1% 993 -4 2 742 2.7 0.16%

    apxCH-10% 474 -18 2 584 1.9 2.17%apxCHALT-10% 489 7 215 0.3 2.16%apxCHALT-10% W-10% 489 7 102 0.2 3.56%

    Experimental Results

  • 8/21/2019 Approx Ch Slides

    36/39

    Experimental Results

    16 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    road network of Western Europe, 18 million nodes, 42.2 million edges

    preproc. query[s] [B/n] #settled [ms] error

    TRAVE

    L

    TIME

    CH 1 050 -1 430 0.206 -

    apxCH-10% 1 099 -2 430 0.199 0.40%CHASE 13 421 7 42 0.028 -apxCHASE-10% 11 977 5 42 0.026 0.40%

    DISTANCE CH 1 258 0 1 333 1.198 -

    apxCH-10% 950 0 1 248 0.873 1.32%

    CHASE 84 759 15 59 0.058 -apxCHASE-10% 33 147 10 62 0.048 1.32%

    Experimental Results

  • 8/21/2019 Approx Ch Slides

    37/39

    Experimental Results

    16 Robert Geisberger:Heuristic Contraction Hierarchies with Approximation Guarantee Institute for Theoretical InformaticsAlgorithms II

    road network of Western Europe, 18 million nodes, 42.2 million edges

    preproc. query[s] [B/n] #settled [ms] error

    TRAVE

    L

    TIME

    CH 1 050 -1 430 0.206 -

    apxCH-10% 1 099 -2 430 0.199 0.40%CHASE 13 421 7 42 0.028 -apxCHASE-10% 11 977 5 42 0.026 0.40%

    DISTANCE CH 1 258 0 1 333 1.198 -

    apxCH-10% 950 0 1 248 0.873 1.32%

    CHASE 84 759 15 59 0.058 -apxCHASE-10% 33 147 10 62 0.048 1.32%

    Conclusion

  • 8/21/2019 Approx Ch Slides

    38/39

    Conclusion

    17 Robert Geisberger:

    Heuristic Contraction Hierarchies with Approximation GuaranteeInstitute for Theoretical Informatics

    Algorithms II

    Approximationextends the application rangeof contraction

    hierarchies beyond road networks.Further speed-up achieved withgoal-direction.

  • 8/21/2019 Approx Ch Slides

    39/39

    18 Robert Geisberger:

    Heuristic Contraction Hierarchies with Approximation GuaranteeInstitute for Theoretical Informatics

    Algorithms II

    Thanksfor your attention.

    Anyquestion?