2) Multi-Criteria 1) Contraction Hierarchies 3) For Ride Sharing
2) Multi-Criteria 1) Contraction Hierarchies 3) For Ride Sharing
1) Contraction Hierarchies
3) for Ride Sharing
Robert Geisberger
Bad Herrenalb, 4th and 5th December 2008
Robert Geisberger Contraction Hierarchies 1
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Contraction Hierarchies (CH)
2
1
2
2
6
1
4
3
5
3
3
5
8
2
Robert Geisberger Contraction Hierarchies 2
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Motivation
exact shortest paths calculation in large road networks
minimize:
query time
preprocessing time
space consumption
+ simplicity
Robert Geisberger Contraction Hierarchies 3
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Hierarchy
nd the hierarchy
the more hierarchy is available the more you can nd
exploit it to speedup your algorithm
Robert Geisberger Contraction Hierarchies 4
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Main Idea
Contraction Hierarchies (CH)
contract only one node at a time
local and cache-efcient operation
in more detail:
order nodes by importance, V = {1, 2, . . . , n}
contract nodes in this order, node v is contracted by
foreach pair (u, v) and (v, w) of edges do
if u, v, w is a unique shortest path then
add shortcut (u, w) with weight w(u, v, w)
query relaxes only edges to more important nodes
valid due to shortcuts
Robert Geisberger Contraction Hierarchies 5
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Example: Construction
2 3 2 1 2
2 6 1 3 5 4
Robert Geisberger Contraction Hierarchies 6
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Example: Construction
2
3 2
1 2
2 6
1
4 3 5
5
Robert Geisberger Contraction Hierarchies 6
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Example: Construction
2
1 2
2
6
1
4 3 5
5
3 2
Robert Geisberger Contraction Hierarchies 6
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Example: Construction
2
1 2
2
6
1
4
3
5
5
3 2
3
Robert Geisberger Contraction Hierarchies 6
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Example: Construction
2
2
2
6
1
4
3
5
3
2
3
8
1
5
Robert Geisberger Contraction Hierarchies 6
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Example: Construction
2
1
2
2
6
1
4
3
5
3
3
5
8
2
Robert Geisberger Contraction Hierarchies 6
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Construction
to identify necessary shortcuts
local searches from all nodes u with incoming edge (u, v)
ignore node v at search
add shortcut (u, w) iff found distance
d(u, w) > w(u, v) +w(v, w)
1
1
1
1
1
v
Robert Geisberger Contraction Hierarchies 7
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Construction
to identify necessary shortcuts
local searches from all nodes u with incoming edge (u, v)
ignore node v at search
add shortcut (u, w) iff found distance
d(u, w) > w(u, v) +w(v, w)
2
2
1
1
1
1
1
v
Robert Geisberger Contraction Hierarchies 7
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Node Order
use priority queue of nodes, node v is weighted with a linear
combination of:
edge difference #shortcuts #edges incident to v
uniformity e.g. #deleted neighbors
. . .
2
2
1
1
1
1
1
v
2 3 = 1
integrated construction and ordering:
1
remove node v on top of the priority queue
2
contract node v
3
update weights of remaining nodes
Robert Geisberger Contraction Hierarchies 8
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Query
modied bidirectional Dijkstra algorithm
upward graph G
:= (V, E
) with E
:= {(u, v) E : u < v}
downward graph G
:= (V, E
) with E
:= {(u, v) E : u > v}
forward search in G
2
1
2
2
6
1
4
3
5
3
3
5
8
s
t
n
o
d
e
o
r
d
e
r
2
Robert Geisberger Contraction Hierarchies 9
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Query
modied bidirectional Dijkstra algorithm
upward graph G
:= (V, E
) with E
:= {(u, v) E : u < v}
downward graph G
:= (V, E
) with E
:= {(u, v) E : u > v}
forward search in G
2
1
2
2
6
1
4
3
5
3
3
5
8
s
t
n
o
d
e
o
r
d
e
r
2
Robert Geisberger Contraction Hierarchies 9
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Query
modied bidirectional Dijkstra algorithm
upward graph G
:= (V, E
) with E
:= {(u, v) E : u < v}
downward graph G
:= (V, E
) with E
:= {(u, v) E : u > v}
forward search in G
2
1
2
2
6
1
4
3
5
3
3
5
8
s
t
n
o
d
e
o
r
d
e
r
2
Robert Geisberger Contraction Hierarchies 9
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Query
modied bidirectional Dijkstra algorithm
upward graph G
:= (V, E
) with E
:= {(u, v) E : u < v}
downward graph G
:= (V, E
) with E
:= {(u, v) E : u > v}
forward search in G
2
1
2
2
6
1
4
3
5
3
3
5
8
s
t
n
o
d
e
o
r
d
e
r
2
Robert Geisberger Contraction Hierarchies 9
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Outputting Paths
for a shortcut (u, w) of a path u, v, w,
store middle node v with the edge
expand path by recursively replacing a
shortcut with its originating edges
2
3
2
5
1
2
3
8
n
o
d
e
o
r
d
e
r
2
5
s
t
6
1
4
3
s t
u
n
p
a
c
k
p
a
t
h
2 8
2
2
2
5 3
3
3
2
2 1 2
3
2 6 1 3 5 4
2 6 1 5 4
2 6 5 4
2 6 5
Robert Geisberger Contraction Hierarchies 10
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Stall-on-Demand
v can be stalled by u (if d(u) +w(u, v) < d(v))
stalling can propagate to adjacent nodes
search is not continued from stalled nodes
3
6
1
s
n
o
d
e
o
r
d
e
r
v
2
u
w
7
does not invalidate correctness (only suboptimal paths are
stalled)
Robert Geisberger Contraction Hierarchies 11
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Experiments
environment
AMD Opteron Processor 270 at 2.0 GHz
8 GB main memory
GNU C++ compiler 4.2.1
test instance
road network of Western Europe (PTV)
18 029721 nodes
42 199587 directed edges
Robert Geisberger Contraction Hierarchies 12
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Performance
E ED EDL EDSL EDS1235 EOSL EOS1235 EVOSQL
economical aggressive
5
0
0
1
0
0
0
2
0
0
0
4
0
0
0
8
0
0
0
1
6
0
0
0
1
0
0
1
5
0
2
0
0
3
0
0
4
0
0
6
0
0
n
o
d
e
o
r
d
e
r
i
n
g
[
s
]
q
u
e
r
y
[
s
]
method
E
D
L
S
i
V
Q
O
edge difference
deleted neighbors
limit search space on weight calculation
search space size
(digits) hop limits for testing shortcuts
Voronoi region size
upper bound on edges in search path
original edges term
HNR: 594 s / 802 s
Robert Geisberger Contraction Hierarchies 13
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Worst Case Costs
1
1
0
0
1
0
1
2
1
0
1
0
1
0
8
1
0
6
1
0
4
1
0
2
0 200 400 600 800 1000 1200 1400 1600 1800 2000 2200
%
o
f
s
e
a
r
c
h
e
s
settled nodes
CH aggr.
CH eco.
HNR
maximum 847 1322 2148
Robert Geisberger Contraction Hierarchies 14
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Hierarchy is not hierarchy
Many-to-Many Shortest Paths [KSSSW07]
method query [s] settled non-stalled 10 000 10 000
nodes nodes table
EVSQL 159 368 209 10.2 s
EVOSQL 152 356 207 11.0 s
Transit Node Routing [BFSS07]
preprocessing time with method EDOSQ1235 46 min
query time still at 3.3s
s
t
Robert Geisberger Contraction Hierarchies 15
Contraction Hierarchies
Multi-Criteria Contraction Hierarchies
Preprocessing
Experiments
Summary
Contraction Hierarchies are simple and fast
7.5 min preprocessing results in 0.21 ms queries
foundation for other methods
denition of best hierarchy selection depends on
application
Robert Geisberger Contraction Hierarchies 16
Multi-Criteria Contraction Hierarchies
Fahrtennder
Part II
Multi-Criteria Contraction Hierarchies
Robert Geisberger Contraction Hierarchies 17
Multi-Criteria Contraction Hierarchies
Fahrtennder
FYS
Algorithm
Feasibility Study of Young Scientist (FYS)
Do you have a very good master-/diploma-/phd-thesis?
Is there a interesting question left?
Then they may give you money.
Robert Geisberger Contraction Hierarchies 18
Multi-Criteria Contraction Hierarchies
Fahrtennder
FYS
Algorithm
Goals
multiple optimization criterias
e.g.: distance, time, costs
exibility at route calculation time
e.g.: individual vehicle speeds
diversity of results
e.g.: calculate Pareto-optimal results
roundtrips with scenic value
e.g.: for tourists
+
+
Robert Geisberger Contraction Hierarchies 19
Multi-Criteria Contraction Hierarchies
Fahrtennder
FYS
Algorithm
Challenges and New Insight
Every optimization criterion has a specic inuence on the
hierarchy of a road network.
e.g.: Finding the fastest route contains more hierarchy than
nding the shortest route.
Challenge: Multiple criteria interfere with hierarchy, but the
algorithm should work fast on large graphs.
e.g.: Motorways drop in the hierarchy because of road tolls.
New insight: Combinations und weightings of optimization
criteria that preserve hierarchy (and which not).
Robert Geisberger Contraction Hierarchies 20
Multi-Criteria Contraction Hierarchies
Fahrtennder
FYS
Algorithm
Algorithmic Ideas
modiy the contraction so the query stays simple
add all necessary shortcuts during contraction
do this by modifying the local search
linear combination of two: x +ay with a [l , u]
label is now a function of x (see timedependent CH)
linear combination of more: a
1
x
1
+ +a
n
x
n
with a
i
[l
i
, u
i
]
Pareto-optimal (may add too many shortcuts)
let us see what works best ;-)
Robert Geisberger Contraction Hierarchies 21
Multi-Criteria Contraction Hierarchies
Fahrtennder
Part III
Fahrtennder
Robert Geisberger Contraction Hierarchies 22
Multi-Criteria Contraction Hierarchies
Fahrtennder
Algorithm
Experiments
Ride Sharing
Current approaches:
match only ride offers with identical start/destination
(perfect t)
sometimes radial search around start/destination
Our approach:
driver picks passenger up and gives him a ride to his
destination
nd the driver with the minimal detour (reasonable t)
Efcient algorithm:
adaption of the many-to-many algorithm
Robert Geisberger Contraction Hierarchies 23
Multi-Criteria Contraction Hierarchies
Fahrtennder
Algorithm
Experiments
Efcient Algorithm
store forward search space from each start node s
i
in a
bucket
request from s to t needs to calculate all distances d(s
i
, s)
scan buckets of all reached nodes
analogously for distances d(t , t
i
)
s
i s
t
t
i
s
i
, d
d
t
i
, d
. . .
. . .
Robert Geisberger Contraction Hierarchies 24
Multi-Criteria Contraction Hierarchies
Fahrtennder
Algorithm
Experiments
Experiments
matching a request is really fast 25 ms
it can sort by detour and output e.g. the best ten offers
departure windows as selection criterion
online adding/removal of offers supported 0.2 / 2 ms
Robert Geisberger Contraction Hierarchies 25