Download presentation
Presentation is loading. Please wait.
1
Optimised Search Techniques
2
Basic Idea BFS brances out to all surrounding nodes
No discrimination based on direction of target node
3
BFS example S E
4
BFS example S E
5
BFS example S E
6
BFS example S E
7
BFS example S Large area needlessly explored E
8
Alternatives Best-First Search:
Branch out to nodes which intuitively seem to be the closest to the destination Use heuristics to estimate distances to destination node Greedy algorithm However, a better solution exists
9
A* algorithm A* is an improvement over Best-First Search
Nodes are given weights based on: Cost to reach the node Estimated cost to reach the end node
10
Manhattan Distance Manhattan distance - sum of the absolute distances between coordinates M(x1,y1,x2,y2) = |x1-x2| + |y1-y2| Reflection of distance between points if travel only parallel to axes
11
Implementation of A* Using Manhattan distance as an heuristic to estimate distance to end point w(x,y) = c(x,y) + M(x,y,xE,yE) Item in priority queue with lowest weight popped off Surrounding nodes added with calculated weights
12
A* example S E
13
A* example S 9 7 E
14
A* example S 9 7 9 7 E
15
A* example S 9 7 9 7 7 E
16
A* example S 9 7 9 7 7 7 7 E
17
A* example 11 S 9 11 11 9 7 9 11 9 7 7 7 9 7 7 9 9 E
18
Comparison: BFS vs A* BFS A* S S E E
19
Special cases of A* Dijkstra's Algorithm is a case of A* with the weighting based solely on cost: w(x,y) = c(x,y) Breadth-First Search is just A* with all nodes have a weight of 0: w(x,y) = 0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.