15
BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search is good because it does not get trapped on dead-end paths. One way of combining the two is to follow a single path at a time, but switch paths whenever some competing path looks more promising than the current one does. BeFS = DFS + BFS S.SRIVATHSAN

BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

Embed Size (px)

Citation preview

Page 1: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

BEST FIRST SEARCH - BeFS

DFS is good becoz it allows a solution to be found without all competing branches having to be expanded.

Breadth First Search is good because it does not get trapped on dead-end paths.

One way of combining the two is to follow a single path at a time, but switch paths whenever some competing path looks more promising than the current one does.

BeFS = DFS + BFS

S.SRIVATHSAN

Page 2: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

A* Algorithm THE BeFS algorithm is a simplification of

an algorithm called A* It is presented by Hart et al in 1968-1972 This algorithm uses the same f(n), g(n),

h(n) functions, as well as the lists OPEN and CLOSED as like in BeFS.

S.SRIVATHSAN

Page 3: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

LISTS & FUNCTIONS – a short description OPEN – nodes that have been generated and

have had the heuristic function applied to them but which have not yet been examined (i.e., had their successors generated). OPEN is actually a priority queue in which the elements with the highest priority are those with the most promising value of the heuristic function.

CLOSED – nodes that have already been examined. We need to keep these nodes in memory if we want to search a graph rather than a tree, since whenever a new node is generated, we need to check whether it has been generated before.

S.SRIVATHSAN

Page 4: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

FUNCTIONS The function g(n) is a measure of the cost of getting

from the initial state to the current node. It must be non –ve.

The function h(n) is an estimate of the additional cost of getting from the current node to a goal state. – the place where the problem domain knowledge is exploited.

The combined function f(n), represents an estimate of the cost of getting from the initial state to the goal state along the path that generated the current node.

S.SRIVATHSAN

Page 5: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

A* search Idea: avoid expanding paths that are

already expensive Evaluation function f(n) = g(n) + h(n) g(n) = cost so far to reach n h(n) = estimated cost from n to goal f(n) = estimated total cost of path through n

to goal

S.SRIVATHSAN

Page 6: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

A* search example

Page 7: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

A* search example

Page 8: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

A* search example

Page 9: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

A* search example

Page 10: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

A* search example

Page 11: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

A* search example

Page 12: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

Admissible heuristics A heuristic h(n) is admissible if for every node n,

h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal state from n.

An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic

Example: hSLD(n) (never overestimates the actual road distance)

Theorem: If h(n) is admissible, A* using TREE-SEARCH is optimal

S.SRIVATHSAN

Page 13: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

ALGORITHM1. Put the starting node on open2. If open is empty stop and return failure3. Take from open node the node n that has the smallest value of

f(n).4. If the node is a goal node, return success and stop. Otherwise,5. Expand n, generating all of its successors n’ and put n on closed.

For every successor n’, if n’ is not already on open or closed; attach a back pointer to n.

6. Compute f(n’) and put it on open.7. Each n’ that is already on open or closed should be attached to

back pointers which reflect the lowest g(n’) path. If n’ was on closed and its pointer was changed, remove it and put it on open.

8. Go back to step2. ~~~ EXPLAIN THE 8 – PUZZLE PROBLEM. ~~~~

S.SRIVATHSAN

Page 14: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

Properties of A* Complete? Yes (unless there are infinitely

many nodes with f ≤ f(G); G- Sub optimal goal ).

Time? Exponential Space? Keeps all nodes in memory Optimal? Yes

Page 15: BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing branches having to be expanded. Breadth First Search

THANK U

- S. SRIVATHSAN

II MCA