BEST FIRST SEARCH - BeFS DFS is good becoz it allows a solution to be found without all competing...

Preview:

Citation preview

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

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

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

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

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

A* search example

A* search example

A* search example

A* search example

A* search example

A* search example

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

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

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

THANK U

- S. SRIVATHSAN

II MCA

Recommended