Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

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 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

2 A* Algorithm THE BeFS algorithm is a simplification of an algorithm called A* It is presented by Hart et al in 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

3 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

4 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

5 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

6 A * search example

7

8

9

10

11

12 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: h SLD (n) (never overestimates the actual road distance) Theorem: If h(n) is admissible, A * using TREE- SEARCH is optimal S.SRIVATHSAN

13 ALGORITHM 1. Put the starting node on open 2. If open is empty stop and return failure 3. 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

14 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

15 THANK U - S. SRIVATHSAN II MCA


Download ppt "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."

Similar presentations


Ads by Google