Академический Документы
Профессиональный Документы
Культура Документы
Marcelo Johann
johann@inf.ufrgs.br
www.inf.ufrgs.br/~johann
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 1
Outline
Introduction
Heuristic Search: properties of A*
Bidirectional Search and the quest for Bi-A*
LCS*
principles, the algorithm, and how it performs
Main Conclusions
Pathological cases and open questions
Application in grids and routing (mainly A*)
6 ideas that we find significant…
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 2
Shortest Path Problem
In a locally finite graph G=(V,E), find the
shortest path between two designated nodes
source s and target t - smallest total cost.
v1 v5
v4 v6 t
s v3
v2 v8
v7
v9
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 3
v1 v6
v4 v8 v0
v3
v2 s admissibility
v5 v9 v7 t
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 4
Breadth-First Search (BFS)
Expand first nodes that are closer to the source,
or at the same time nodes that are at the
same distance (FIFO).
Intermediate
search
target
source
Complete
search
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 5
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 6
The Maze Router
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X S X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 7
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 8
The Maze Router
X X X X X X X X X X X X X X X X X X X X
X X
X X
X 4 3 X
X 4 3 2 3 X
X 4 3 2 1 2 3 X
X 4 3 2 3 X
X 4 3 X
X X
X X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 9
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 10
The Maze Router
X X X X X X X X X
X X X X X X X X X X X
X 9 8 7 6 5 6 7 8X 9 10 11 12
X 8 7 6 5 4 5
12 6 7X 8 9 10 11
X 7 6 5 4 3 4
11 12 5 6X 7 8 9 10
X 6 5 4 3 2 3 4
10 11 12 5X 6 7 8 9
X 5 4 3 2 1 2 3
9 10 11 12 4X 5 6 7 8
X 6 5 4 3 2 3 4
10 11 12 5X 6 7 8 9
X 7 6 5 4 3 4
11 12 5 6X 7 8 9 10
X 8 7 6 5 4 5
12 6 7X 8 9 10 11
X 9 8 7 6 5 6 7 8X 9 10 11 12
X 10 9 X X X X X
X X X X XX X X X X
X 11 10 11 12 X
X 12 11 12 T X
X 12 X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 11
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 12
The Maze Router
X X X X X X X X X
X X X X X X X X X X X
X 9 8 7 6 5 6 7 8 X 9 10 11 12 13 14 15 16
X 8 7 6 5 4 5 6 16 7 X 8 9 10 11 12 13 14 15
X 7 6 5 4 3 4 5 6
15 16 X 7 8 9 10 11 12 13 14
X 6 5 4 3 2 3 4 5
14 15 X 6 7 8 9 10 11 12 13
X 5 4 3 2 1 2 3 4
13 14 X 5 6 7 8 9 10 11 12
X 6 5 4 3 2 3 4 5
14 15 X 6 7 8 9 10 11 12 13
X 7 6 5 4 3 4 5 6
15 16 X 7 8 9 10 11 12 13 14
X 8 7 6 5 4 5 6 16 7 X 8 9 10 11 12 13 14 15
X 9 8 7 6 5 6 7 8 X 9 10 11 12 13 14 15 16
X 10 9 X X X X X X X X X X X X X X X
X 11 10 11 12 13 14 15 16 X
X 12 11 12 13 14 15 16 T X
X 13 12 13 14 15 16 X
X 14 13 14 15 16 X
X 15 14 15 16 X
X 16 15 16 X
X 16 X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 13
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 14
Maze Router’s expansion g++
#include <iostream> void print(void);
#include <queue> int bfs(int source, int target)
using namespace std; {
#define SIDE 20 queue<int> q;
#define PLACE(x,y) ((y)*SIDE+(x)) q.push(source);
#define WEST(n) (n-1) while (!q.empty())
#define EAST(n) (n+1) {
#define NORTH(n) (n-SIDE) int n = q.front();
#define SOUTH(n) (n+SIDE) q.pop();
char Space[SIDE*SIDE]; if (n==target)
void init (void) return 1;
{ if (Space[n] != 'X')
for (int i=0; i<SIDE*SIDE; ++i) {
Space[i] = ' '; Space[n] = 'X';
for (int i=0; i<SIDE; ++i) print();
{ getchar();
Space[PLACE(i,0)] = 'X'; q.push(WEST(n));
Space[PLACE(i,SIDE-1)] = 'X'; q.push(EAST(n));
Space[PLACE(0,i)] = 'X'; q.push(NORTH(n));
Space[PLACE(SIDE-1,i)] = 'X'; q.push(SOUTH(n));
} }
for (int i=3; i<SIDE-3; ++i) }
Space[PLACE(i,10)] = 'X'; return 0;
} }
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 15
Outline
Introduction
Heuristic Search: properties of A*
Bidirectional Search and the quest for Bi-A*
LCS*
principles, the algorithm, and how it performs
Main Conclusions
Pathological cases and open questions
Application in grids and routing (mainly A*)
6 ideas that we find significant…
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 16
Heuristic Search (A*) [Hart et al. 1968]
Intermediate
stages
source target
g(n) h(n)
Complete
Search
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 17
Behaviour of f, g and h
1 2 3 4
g= g= g= g=
h= h= h= h=
f= c=1 f= c=2 f= c=2 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g= g=0 g= g= g=
h= h=3 h= h= h=
f= c=1 f =3 c=2 f= c=2 f= c=2 f=
c=1 c=1 c=1 c=1
13 14 15 11
g= g= g= g=
h= h= h= h=
f= c=1 f= c=2 f= c=2 f=
Open List:
7
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 18
Behaviour of f, g and h
1 2 3 4
g=1 g= g= g=
h=4 h= h= h=
f =5 c=1 f= c=2 f= c=2 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g=1 g=0 g=2 g= g=
h=5 h=3 h=2 h= h=
f =5 c=1 f =3 c=2 f =4 c=2 f= c=2 f=
c=1 c=1 c=1 c=1
13 14 15 11
g=1 g= g= g=
h=4 h= h= h=
f =5 c=1 f= c=2 f= c=2 f=
Open List:
8, 1, 13, 6
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 19
Behaviour of f, g and h
1 2 3 4
g=1 g=3 g= g=
h=4 h=3 h= h=
f =5 c=1 f =6 c=2 f= c=2 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g=1 g=0 g=2 g=4 g=
h=4 h=3 h=2 h=1 h=
f =5 c=1 f =3 c=2 f =4 c=2 f =5 c=2 f=
c=1 c=1 c=1 c=1
13 14 15 11
g=1 g=3 g= g=
h=4 h=3 h= h=
f =5 c=1 f =6 c=2 f= c=2 f=
Open List:
1, 13, 6, 9, 2, 14
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 20
Behaviour of f, g and h
1 2 3 4
g=1 g=3 g= g=
h=4 h=3 h= h=
f =5 c=1 f =6 c=2 f= c=2 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g=1 g=0 g=2 g=4 g=
h=4 h=3 h=2 h=1 h=
f =5 c=1 f =3 c=2 f =4 c=2 f =5 c=2 f=
c=1 c=1 c=1 c=1
13 14 15 11
g=1 g=3 g= g=
h=4 h=3 h= h=
f =5 c=1 f =6 c=2 f= c=2 f=
Open List:
1, 13, 6, 9, 2, 14
ties
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 21
Behaviour of f, g and h
1 2 3 4
g=1 g=3 g= g=
h=4 h=3 h= h=
f =5 c=1 f =6 c=2 f= c=2 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g=1 g=0 g=2 g=4 g=
h=4 h=3 h=2 h=1 h=
f =5 c=1 f =3 c=2 f =4 c=2 f =5 c=2 f=
c=1 c=1 c=1 c=1
13 14 15 11
g=1 g=3 g= g=
h=4 h=3 h= h=
f =5 c=1 f =6 c=2 f= c=2 f=
Open List:
1, 13, 6, 9, 2, 14
But not critical as f * = 6
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 22
Quality of the estimator h
1 2 3
g=1 g=3 g=
h=4 h=3 h=
f =5 c=1 f =6 c=2 f=
Effect of the
c=1 c=1 c=1 estimation
6 7 8 9
g=1 g=0 g=2 g=4 efficiency
h=4 h=3 h=2 h=1
f =5 c=1 f =3 c=2 f =4 c=2 f =5
c=1 c=1 c=1
13 14 15
g=1 g=3 g=
h=4 h=3 h=
f =5 c=1 f =6 c=2 f=
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 23
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 X
X X
X X
X
X
7 X
X
X X X X X X X X X X X X X X X X
X X
X T X
X
X
3 X
X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
h = estimation function
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 24
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 X
X 10 X
X 10 X
X X
X X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Min f = g + h Max g
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 25
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 X
X 10 X
X 10 X
X 10 X
X 10 10 X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Min f = g + h Max g
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 26
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 X
X 10 X
X 10 X
X 10 X
X 10 10 10 10 X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 27
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 28
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X 12 12 12 12 X
X 12 10 10 10 10 12 X
X 12 10 10 10 10 12 X
X 12 10 10 10 10 12 X
X 12 10 10 10 10 12 X
X 12 10 10 10 10 12 X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 29
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X 16 16 16 16 X
X 16 14 14 14 14 16 X
X 16 14 12 12 12 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 X X X X X X X X X X X X X X X
X 16 X
X 16 16 16 16 16 16 T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 30
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X 16 16 16 16 X
X 16 14 14 14 14 16 X
X 16 14 12 12 12 12 14 16 Saved
X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 effort
X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 X X X X X X X X X X X X X X X
X 16 X
X 16 16 16 16 16 16 T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 31
Some Notation…
s, t - source and target nodes
k(n1,n2) - estimate to go from n1 to n2
k*(n1,n2) - actual cost of the shortest path from n1 to n2
h(n) = k(n,t)
h*(n) = k*(n,t)
g*(n) = k*(s,n)
Pa-b = path from a to b
Pa-b* = optimal path from a to b
f*(n) = cost of Ps-n* ∪ Pn-t* (going through n)
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 32
Properties of the Heuristic Estimator
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 33
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 34
Outline
Introduction
Heuristic Search: properties of A*
Bidirectional Search and the quest for Bi-A*
LCS*
principles, the algorithm, and how it performs
Main Conclusions
Pathological cases and open questions
Application in grids and routing (mainly A*)
6 ideas that we find significant…
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 35
target
m
source
Meeting node
Unidirectional search
( to compare)
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 36
Bidirectional Search
Two simultaneous search fronts
Meeting node: recognized by both fronts
Terminating condition: f(n) > min[f(m)]
Leads to overlapping
target
m
source
Meeting node
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 37
Bidirectional Search
Two simultaneous search fronts
Meeting node: recognized by both fronts
Terminating condition: f(n) > min[f(m)]
Leads to overlapping
4 5
a b d
6
6 6 6
5 4
c e f
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 38
Bidirectional Search
Two simultaneous search fronts
Meeting node: recognized by both fronts
Terminating condition: f(n) > min[f(m)]
Leads to overlapping
4 5
a b d
g=10 6
6 6 6
5 4
c e f
g=9
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 39
Bidirectional Search
Two simultaneous search fronts
Meeting node: recognized by both fronts
Terminating condition: f(n) > min[f(m)]
Leads to overlapping
4 5
a b d
g=10 6
6 6 6
5 4
c e f
First Meeting
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 40
Heuristic Bidirectional Search
Goal: to combine the advantages of both
The challenge:
Terminating condition
Overlapping [Kwa 1989]
The missing fronts problem
Bi-A*
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 41
Wave-Shapping
One front looks at the other
Calculates distance to each node in the oposite front
f(n) = gs (n) + min[k(n,pi) + gt (pi)]
pi
t
s
gs(n) gt(pi)
n k(n,pi )
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 42
Perimeter Search [Manzini 1995]
First search, up to a
predetermined
perimeter pi
t
Second search with
front-to-front
gt(pi)
estimates
gs(n)
s k(n,pi )
n
Outline
Introduction
Heuristic Search: properties of A*
Bidirectional Search and the quest for Bi-A*
LCS*
principles, the algorithm, and how it performs
Main Conclusions
Pathological cases and open questions
Application in grids and routing (mainly A*)
6 ideas that we find significant…
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 44
The LCS* Algorithm
Lowerbound Cooperative Search [ISA/CI2000]
Cooperation
overall code is like BS* [Kwa 89]
dynamic estimation (resistances e penalties)
Function h of one front will be improved by the
other’s g values
estimated values stored in references
completeness and admissibility proved [SBIA2000]
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 45
Missing fronts?
No, this is not the main problem! [Kaindl 95,97]
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 46
The Pruning Power!
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 47
Dynamic Estimation
Resistence (min idea [Kaindl 96])
pi
Rt = Min[gt(pi) - k(pi,t)] gt(pi)
t
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 48
Dynamic Estimation
Penalty (max idea [Kaindl 96])
Pt = Min[gt*(pi) + k(pi,s)]
pi
F(n) = gs(n) + Pt - ht(n)
gt(pi)
ht(pi) t
k(pi ,s)
ht(n) hs(n)
s
gs(n) n
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 49
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 50
LCS* is Admissible
Admissibility
There are always references to nodes in the
optimal path in both search fronts;
The algorithm terminates only after they meet;
Prunning Power
Less nodes are expanded by increasing f(n) values
Normal values are used in the open lists, but
single quantities Ω (resistance) and P (penalty)
are subtracted from Lmin (best cost so far)
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 51
LCS*’s code :
0.6 nodes
0.4 runtime
0.2
0
0
0
10
14
18
22
26
30
34
38
range of random costs
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 53
maximum
range
Center AC
(mean) costs
minimum
DC
cost
0
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 54
Expanded nodes in 2D grids
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 55
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 56
Testing ε-admissibility
2
100%
1.5
96%
1
0.5
0
15 25 35 45 55 65 75 85 95
range of random costs
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 57
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 58
LCS* wins on random graphs
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 59
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 60
Outline
Introduction
Heuristic Search: properties of A*
Bidirectional Search and the quest for Bi-A*
LCS*
principles, the algorithm, and how it performs
Main Conclusions
Pathological cases and open questions
Application in grids and routing (mainly A*)
6 ideas that we find significant…
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 61
Main Conclusions
A* is way easier to implement. Always the
first choice.
LCS* will usually lose when the area is
empty, as A* expands the smallest number
of nodes. (but it’s on easy instances)
LCS* can get you a small constant
advantage, and can be significantly better
when the heuristic is bad, like in congested
routing, or when one of the pins (A* target)
is blocked.
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 62
Pathological cases
When one of the pins is in a very congested
area, A* starting from this pin has an
advantage, for when the search leaves the
congested area, it goes direct to the target.
LCS* will always duplicate its efforts.
Similar case happens with a barrier in the
middle. A* wins with 50% probability.
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 63
Open question
Direction choosing criteria:
Alternating
Smallest f
Cardinality
Inertial Cardinality
Expanding from the most difficult first
But this contradicts others
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 64
Outline
Introduction
Heuristic Search: properties of A*
Bidirectional Search and the quest for Bi-A*
LCS*
principles, the algorithm, and how it performs
Main Conclusions
Pathological cases and open questions
Application in grids and routing (mainly A*)
6 ideas that we find significant…
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 65
1. Do we need admissibility?
2. Degrees of freedom
3. Cost functions: add some processing
4. Optimizing data structures
5. How to avoid blocking pins
6. Grid properties and some ideas
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 66
1. Admissibility: do we need it?
LCS* is a nice proved admissible algorithm
But who cares?
In most cases we don’t need full admissibility
The advantage of LCS is that it can compute
ε-admissibility in two ways.
The disadvantage is that if you don't need to
guarantee ε, then forget LCS* and make a
simple Bi-A* that terminates in the first
meeting.
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 67
2. Degrees of freedom
During expansion
On ties, use biasing, like in AMAZE
[Hentschke ISPD 2007]
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 68
Uniform costs
1 2 3 4
g= g= g= g=
h= h= h= h=
f= c=1 f= c=1 f= c=1 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g= g= g= g= g=
h= h= h= h= h=
f= c=1 f= c=1 f= c=1 f= c=1 f=
c=1 c=1 c=1 c=1
13 14 15 11
g=0 g= g= g=
h=4 h= h= h=
f =4 c=1 f= c=1 f= c=1 f=
Open List:
13
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 69
Critical Ties
1 2 3 4
g= g= g= g=
h= h= h= h=
f= c=1 f= c=1 f= c=1 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g= g=1 g= g= g=
h= h=3 h= h= h=
f= c=1 f =4 c=1 f= c=1 f= c=1 f=
c=1 c=1 c=1 c=1
13 14 15 11
g=0 g=1 g= g=
h=4 h=3 h= h=
f =4 c=1 f =4 c=1 f= c=1 f=
Open List:
14,7
f(14) = f(7) = f *
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 70
Can choose what you want
1 2 3 4
g= g= g= g=
h= h= h= h=
f= c=1 f= c=1 f= c=1 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g= g=1 g=2 g= g=
h= h=3 h=2 h= h=
f= c=1 f =4 c=1 f =4 c=1 f= c=1 f=
c=1 c=1 c=1 c=1
13 14 15 11
g=0 g=1 g=2 g=
h=4 h=3 h=2 h=
f =4 c=1 f =4 c=1 f =4 c=1 f=
Open List:
15,8,7
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 71
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 72
Nodes close to the target first
1 2 3 4
g= g=3 g= g=
h= h=3 h= h=
f= c=1 f =6 c=1 f= c=1 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g= g=1 g=2 g=3 g=4
h= h=3 h=2 h=1 h=0
f= c=1 f =4 c=1 f =4 c=1 f =4 c=1 f =4
c=1 c=1 c=1 c=1
13 14 15 11
g=0 g=1 g=2 g=3
h=4 h=3 h=2 h=1
f =4 c=1 f =4 c=1 f =4 c=1 f =4
Open List:
15,7,2,3
Only four nodes expanded
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 73
Open List:
15,7,2,3
Degree of freedom
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 74
But pay attention to:
1 2 3 4
g= g=3 g= g=
h= h=3 h= h=
f= c=1 f =6 c=1 f= c=1 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g= g=1 g=2 g=3 g=4
h= h=3 h=2 h=1 h=0
f= c=1 f =4 c=1 f =4 c=1 f =4 c=1 f =4
c=1 c=1 c=1 c=1
13 14 15 11
g=0 g=1 g=2 g=3
h=4 h=3 h=2 h=1
f =4 c=1 f =4 c=1 f =4 c=1 f =4
Open List:
15,7,2,3
Degree of freedom
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 75
Open List:
15,7,2,3
Degree of freedom
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 76
But pay attention to:
1
g=
2
g=3
3
g=
4
g= options
h= h=3 h= h=
f= c=1 f =6 c=1 f= c=1 f=
c=1 c=1 c=1 c=1
6 7 8 9 10
g= g=1 g=2 g=3 g=4
h= h=3 h=2 h=1 h=0
f= c=1 f =4 c=1 f =4 c=1 f =4 c=1 f =4
c=1 c=1 c=1 c=1
13 14 15 11
g=0 g=1 g=2 g=3
h=4 h=3 h=2 h=1
f =4 c=1 f =4 c=1 f =4 c=1 f =4
Open List:
15,7,2,3
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 77
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 X
X X
X X
X
X
7 X
X
X X X X X X X X X X X X X X X X
X X
X T X
X
X
3 X
X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
h = estimation function
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 78
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 X
X 10 X
X 10 X
X X
X X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Min f = g + h Max g
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 79
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 X
X 10 X
X 10 X
X 10 X
X 10 10 X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Min f = g + h Max g
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 80
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 X
X 10 X
X 10 X
X 10 X
X 10 10 10 10 X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 81
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X 16 16 16 16 X
X 16 14 14 14 14 16 X
X 16 14 12 12 12 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 X X X X X X X X X X X X X X X
X 16 X
X 16 16 16 16 16 16 T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 84
The A* Algorithm
X X X X X X X X X X X X X X X X X X X X
X X
X 16 16 16 16 X
X 16 14 14 14 14 16 X
X 16 14 12 12 12 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 14 12 10 10 10 10 12 14 16 X
X 16 X X X X X X X X X X X X X X X
X 16 X
X 16 16 16 16 16 16 T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 85
3. Cost Functions
This is a delicate question for routing, but let's
just consider we may have different scenarios.
So, things we can do:
You can introduce noise (dither) in the cost
function to better randomize the paths. But
then you loose degrees of freedom.
On the contrary, you can round the costs
down to low resolution, as to increase the
number of ties.
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 86
3. Cost Functions
Also, costs represent conflicting factors:
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 87
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 88
A simple visual example…
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 89
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 90
5. To avoid blocking pins
Typically the number of alternate paths is proportional to the
distance from a given pin.
So the probability of getting blocked is higher close to the pins.
We can minimize blocking by reserving some escapes for a pin.
But fixed reservations compromise freedom, and should be used
only when there is a single way out.
For multiple possible accesses, a technique of alternate
reservations was proposed by Johann/Reis in 1995:
Place an alternate reservation in one position for each pin, maintaining a list of
other options to it. When drawing a connection during retrace, if this connection
passes on an alternate reservation, eliminate the reservation and check for the
other options. If there are more than one still available, chose one of then to hold
an alternate reservation. On the other hand, if there is only one way out remaining,
make it a fixed reservation. In both cases, no change is made to the path being
recorded in the current retrace.
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 91
6. Grid Properties
Let us look at this again…
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 X
X 10 X
X 10 X
X 10 X
X 10 10 10 10 X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 92
6. Grid Properties
Its clear that this area could not reach t with cost f=10.
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 93
6. Grid Properties
This is still an open problem…
X X X X X X X X X X X X X X X X X X X X
X X
X X
X X
X X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X 10 10 10 10 X
X X X X X X X X X X X X X X X X
X X
X T X
X X
X X
X X
X X
X X
X X
X X X X X X X X X X X X X X X X X X X X
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 94
Shortest Path Search Algorithms with
Heuristic and Bidirectional Searches
y ou !
h an k
T
Marcelo Johann
johann@inf.ufrgs.br
www.inf.ufrgs.br/~johann
Bidirectional Heuristic Shortest Path Search - Marcelo Johann - 2009 Visit to Intel: Slide 95