Uninformed Search technique

Post on 07-Feb-2017

97 views 0 download

transcript

Uninformed Search Technique

Presented By: Kapil Dahalkapil.dahal@kcc.edu.np

Breadth First Search• The breadth first search algorithm visits the nodes of the tree along

its breadth, starting from the level with depth 0 to the maximum depth.

• Here, the nodes in the tree are traversed following their ascending ordered labels.

Algorithm

Contd….

How the algorithm works?• If the current node is not the goal add the offspring of thecurrent in any order to the rear end of the queue and redefine the frontelement of the queue as the current.

• The algorithm terminates, when the goal is found.

Time Complexity

Expanding….

Time and Memory requirement : Example

Uniform Cost• Breadth first search is optimal when all step costs are equal.

• Uniform Cost search is optimal when step costs varies.

• Uniform-cost search expands the node n with lowest path cost.

Uniform Cost Search:example

Depth First Search• The depth first search generates nodes and compares them with the

goal along the largest depth of the tree and moves up to the parent of the last visited node, only when no further node can be generated below the last visited node.

• After moving up to the parent, the algorithm attempts to generate a new offspring of the parent node.

• Uses Stack as data structure.

Algorithm

Example tree

Contd…• In the above algorithm, a starting node is placed in the stack, the top

of which is pointed to by the stack-top. For examining the node, it is popped out from the stack.

• If it is the goal, the algorithm terminates, else its children are pushed into the stack in any order.

• The process is continued until the stack is empty.

example:DFS

Properties: Depth first search

Depth Limited Search• Depth-limited search avoids the pitfalls of depth-first search by

imposing a cutoff on the maximum depth of a path.

• This cutoff can be implemented with a special depth-limited search algorithm, or by using the general search algorithm with operators that keep track of the depth.

• To avoid the infinite depth problem of DFS, we can decide to only search until depth L, i.e. we don’t expand beyond depth L.

Iterative deepening depth-first search• To avoid the infinite depth problem of DFS, we can decide to only

search until depth L, i.e. we don’t expand beyond depth L->Depth first search.

• What of solution is deeper than L? -->Increase L iteratively.->Iterative Deepening Search

Contd…• When the initial depth cut-off is one, it generates only the root node

and examines it.

• If the root node is not the goal, then depth cut-off is set to two and the tree up to depth 2 is generated using typical depth first search.

• Similarly, when the depth cut-off is set to m, the tree is constructed up to depth m by depth first search.

Contd…• Iterative deepening search is a strategy that sidesteps the issue of

choosing the best depth limit by trying all possible depth limits: first depth 0, then depth 1, then depth 2, and so on.

Algorithm: IDS

Example : Iterative deepening

Nodes Generated:IDS• Number of nodes generated in a depth-limited search to depth d with

branching factor b:

• Number of nodes generated in an iterative deepening search to depth d with branching factor b:

Properties: IDS

Bi-Directional Search• Alternate searching from the start state toward the goal and from the

goal state toward the start.• Stop when the frontiers intersect.• Works well only when there are unique start and goal states.• Requires the ability to generate “predecessor” states.•

Bidirectional search: figure

Comparing Search Strategies