19
Optimised Search Techniques

Optimised Search Techniques

Embed Size (px)

DESCRIPTION

Optimised Search Techniques. Basic Idea. BFS brances out to all surrounding nodes No discrimination based on direction of target node. BFS example. S. E. BFS example. S. E. BFS example. S. E. BFS example. S. E. BFS example. S. Large area needlessly explored. E. Alternatives. - PowerPoint PPT Presentation

Citation preview

Page 1: Optimised Search Techniques

Optimised Search Techniques

Page 2: Optimised Search Techniques

Basic Idea

BFS brances out to all surrounding nodesNo discrimination based on direction of

target node

Page 3: Optimised Search Techniques

BFS example

S

E

Page 4: Optimised Search Techniques

BFS example

S

E

Page 5: Optimised Search Techniques

BFS example

S

E

Page 6: Optimised Search Techniques

BFS example

S

E

Page 7: Optimised Search Techniques

BFS example

S

E

Large area needlessly explored

Page 8: Optimised Search Techniques

Alternatives

Best-First Search:Branch out to nodes which intuitively seem to be the closest to the destinationUse heuristics to estimate distances to destination nodeGreedy algorithm

However, a better solution exists

Page 9: Optimised Search Techniques

A* algorithm

A* is an improvement over Best-First SearchNodes are given weights based on:

Cost to reach the nodeEstimated cost to reach the end node

Page 10: Optimised Search Techniques

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

Page 11: Optimised Search Techniques

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

Page 12: Optimised Search Techniques

A* example

S

E

Page 13: Optimised Search Techniques

A* example

S

E

9

7

Page 14: Optimised Search Techniques

A* example

S

E

9

7

7

9

Page 15: Optimised Search Techniques

A* example

S

E

9

7

7

9

7

Page 16: Optimised Search Techniques

A* example

S

E

9

7

7

9

77

7

Page 17: Optimised Search Techniques

A* example

S

E

9

7

7

9

77

77

9

9

9

9

9

11

11

11

11

Page 18: Optimised Search Techniques

Comparison: BFS vs A*

S

E

S

E

BFS A*

Page 19: Optimised Search Techniques

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