A Star
A Star
Hctor Muoz-Avila
5
25
33
15
18
Shortest Path
Consider the following weighted undirected graph:
We want:
10
2
16
6
10
22
8
20
18
20
20
24
6
66
A path 5 v1 v2 20
Djikstra Algorithm
Greedy algorithm: from the candidate nodes select the one
that has a path with minimum cost from the starting node
20
10
15
20
5
25
33
15
18
Djikstra Algorithm
Djikstras algorithm
pick the edge v in
Fringe(T) that has
minimum distance to
the starting node
g(v) is minimum
Example
7
10
2
16
6
10
22
8
20
18
20
20
24
6
66
Properties
x
20
15
VT
20
6
Example
Complexity
Is this good?
Actually it is bad for very large graphs!
Branching
factor: b
The A* Search
Difficulty: we want to still be able to generate the path
with minimum cost
A* is an algorithm that:
Uses heuristic to guide search
While ensuring that it will compute a path with
minimum cost
A* computes the function f(n) = g(n) + h(n)
estimated cost
actual cost
A*
Example
Properties of A*
h(n)
Admissible Heuristics
Using A* in Planning
A
C
B
B
C
A
C
A B
C
A B
C
A
B
A
B C
C
B
A
B
A C
A B C
A
B C
A
B
C
B
C
B
A
C
A* in Games
Path finding (duh!)
We will have several presentations on the topic
We will see that sometimes even A* speed
improvements are not sufficient
Additional improvements are required
A* can be used for planning moves computer-controlled
player (e.g., chess)
F.E.A.R. uses A* to plan its search