0% found this document useful (0 votes)
65 views28 pages

Uninformed Search Methods

Uninformed search methods operate without any domain-specific knowledge to guide the search. The document describes several uninformed search strategies, including breadth-first search (BFS), depth-first search (DFS), uniform cost search, depth-limited search (DLS), and iterative deepening search (IDS). BFS explores the shallowest nodes first using a queue data structure. DFS uses a stack to explore one path fully before backtracking. Uniform cost search prioritizes exploring lower-cost nodes first. DLS limits the depth of the search tree.

Uploaded by

Kalpana Koppolu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views28 pages

Uninformed Search Methods

Uninformed search methods operate without any domain-specific knowledge to guide the search. The document describes several uninformed search strategies, including breadth-first search (BFS), depth-first search (DFS), uniform cost search, depth-limited search (DLS), and iterative deepening search (IDS). BFS explores the shallowest nodes first using a queue data structure. DFS uses a stack to explore one path fully before backtracking. Uniform cost search prioritizes exploring lower-cost nodes first. DLS limits the depth of the search tree.

Uploaded by

Kalpana Koppolu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

UNINFORMED SEARCH

METHODS
Prepared by
K Kalpana
Assistant Professor
ECE Department
BEC BAPATLA
Introduction
• Uninformed search methods work in the absence of any information, they
are also referred to as blind search methods.
• These methods can understood by a very simple example.
• If we would like to search a boy named Ram a school, with the number of
classes from 1 to 10 and each class having two divisions then the search
would involve going to each and every class till the student named Ram we
are looking for, is found. Since no information is available, we need to select
certain strategy and expand the nodes (here, the classes) in some
predefined order.
• Breadth first search and depth first search are the two basic approaches of
expanding and visiting nodes in the absence of any heuristic.
Types of Uninformed search methods
• Breadth First Search (BFS)
• Uniform Cost Search
• Depth First Search (DFS)
• Depth Limited Search (DLS)
• Iterative Deepening Search (IDS)
• Bi-directional Search
Breadth First Search (BFS)
• The search technique in BFS follows the shallow node approach.
• Here, the basic idea is that across the level of the tree, all the nodes are
searched. So, it is a search technique where from the root node, all the
successors are searched across the level and expanded .
• Queue data structure is used to carry out the search, where things happen
on first in first out basis (FIFO). BFS approach is shown in Figure 3.3
• Here, the dotted arrows indicate the search method. With reference
to the diagram, the search proceeds with the processing of all the
nodes at a particular level and then proceeds to the next one.
Let us take an example of BFS for better understanding. Consider that A is the start state and D is the goal state. With the help of a queue, the example is demonstrated.
In BFS, the step-wise working is as follows:

•:
• Queue Check
A ----
Removed A, is it goal? No, add children. So, B and E are added.
BE
E Removed B, is it goal? No, add children.
So, C is added at the end of queue.
EC
C Removed E, is it goal? No, add children.
So, F and G are added.
CFG
FG Removed C, is it goal? No, add children.
So, D is added.
FGD
GD Removed F, is it goal? No, add children.
Cannot be added, leaf node, so remove the next node.
D Removed G, is it goal? No, add children.
Cannot be added, leaf node, so remove the next node.
Empty Removed D, is it goal? YES!
From the example discussed here, it is clear that each time you add a node, its children are
to be added at the end of the queue as it proceeds level-wise. Since in the example, the
goal state lies at the last level, each and every node or state is traversed and added to the
queue.
The breadth first search algorithm is summarised as follows:
1. Create a node-list (queue) that initially contains the first node.
2. Do till a goal state is found
Remove X from node-list.
If node-list is empty, then exit. Check if this is goal state.
If yes, return the state.
If not, get the next level nodes, i.e., nodes reachable from the parent and add to node-list.
• lf for a given problem, there exists a solution, then BFS is guaranteed to find it out.
• Hence, we can say that it has the completeness property.
• It also possesses the proper of optimality for the shortest path.
• Here, the cost of every edge is same, i.e., the cost to reach from one node to another is
same.
• What about the space and time complexities?
• Let us assume that b is a branching factor or rather the number of successors at every
level and d is the depth.
• Then, the time complexity will be O(bd)-exponential in the depth of the solution.
• Let us map it mathematically. We start from the root and proceed towards the next
level, then the nodes generated at each level are as follows: out. b+b 2+b3+……….+bd+
(bd+1-b)
• This equals to O(bd +1)and hence, it comes to O(bd) and the space complexity is O(bd) as
every node is saved in the memory.
• Hence, this search is not feasible when you have a large search space.
Uniform Cost Search
• Generally, in the search method, with every edge that we traverse, there is a
cost associated with it.
• With BFS, we are assuming that every edge is having the same cost. But in
uniform cost search, all the edges do not have the same cost. So, the
expansion takes place in the order of costs of the edges from the root rather
than the order of the depth.
• At every step, the next thing to be performed expands/selects a node X,
whose cost c(X) is lowest, where c(X) is the sum of cost of edges from root to
the node. It is the core step that is followed while performing the uniform
cost search.
• This search technique can be easily implemented using a priority queue.
• The search is said to ensure completeness if the cost at every edge is
greater or equal to some constant. It, therefore, satisfies the optimal
property as well. The uniform search has O(bd)- space and time
complexities, as it mostly explores large trees.
• The uniform cost search is to be applied from the start, i.e., node A to
the goal node G. We will use a frontier and an expanded list while
generating the solution.
Depth First Search (DFS)
• Taking the example of finding a route to the hotel, you start with one
route and continue it till you come to know that you are at the hotel
or you have to change the path as it will not lead you to the hotel or it
is a dead end.
• While doing so you can think of going back at some point and taking
up some other lane/road that can lead you to the place and this is
very much possible. This is called backtracking.
• It is the stack data structure that is most commonly used in the
implementation of DFS, where the states or the nodes are in
operation on first in last out basis.
DFS tree
Example: Initial state:A Goal state:D
• In search, the same can be formulated as follows:
1. If initial state is the final state (You are just in front of the hotel) -> success,
exit
2. Do it till you get success or failure.
Generate a successor, if no more successors can be generated > failure Go to
step 1 with initial state to be the current generated successor. The algorithm
just discussed above does a DFS. Figure 3.6 depicts the DFS process As
described, the search starts with the initial node or state say root. It proceeds
with its successor and follows the path ahead till either is knows that it has
come to a solution or has to go back and seek new solution as shown in the
figure.
• Stack
Step 1: A<---top Pop A, is it goal? No, push its children on the stack.
B<---top E A's successor is pushed.
Step 2 : B<----top E Pop B, is it goal? No, push its children on the stack.
C<----top E B's successor is pushed.
Step 3: C<----top Pop C, is it goal? No, push its children on the stack.
D<------top E C's successor is pushed.
Step 4: D<------top E Pop D, is it goal?? YES!
Pop all the contents. Path found!
So, by traversing from one path in one direction of depth, we lead to the goal state. In this
case, no backtracking is required.
• Consider the second case, where we want to reach to F.
• The initial working is same as the way we had to reach to D.
• The example below shows that after having reached till D state, the
next step needs backtracking and hence it starts with E. So, we will
start from that point.
• Thus, the stack contents are as follows:
Conclusion for DFS
• With respect to the completeness of DFS, we cannot say that it will
converge.
• The search is not optimal.
Always remember never use DFS if you suspect a big tree depth.
In the worst case, DFS visits all the nodes before getting a solution.
The time complexity will be O(bd)
Space complexity will be O(bd)
Depth Limited Search (DLS)

• In DFS the probabilities of it getting terminated with wrong expansion


cannot be eliminated.
• Thus, the notion of depth limit comes.
• The basic idea is not allowing expansion after the certain depth.
• This process proves to be the most useful if one is aware of the maximum
depth of the solution.
• Imagine that you are out for purchase of a mobile and in a particular area.
For convenience, you set 3 streets as depth limit in that area. You begin
with street 1. If your budget requirements and features required are
available in the first shop itself, then you would stop and purchase there or
else go to the next shop on that street. So, possibly at depth of that street,
i.e., 1, you have explored all the shops. E the requirements are not
satisfied, you would go to the next level, i.e., street 2 and then street 3.
• The following algorithm summarises the working of depth limited search:

1. Set the depth limit to the max depth to search.


2. Initial node = current node
If initial node = goal, return
3. If depth(initial node) > depth limit
return
else
Expand(initial node)
Save(successors) using stack
Go to step 2
Conclusions
Since depth limited search does not find solutions in all cases, it is not
complete.
The only reason behind it is that if the depth of the solution lies beyond
the one, then it is selected. But if the depth limit is greater than that of
solution's depth, then it is complete.
This method is not an optimal one.
There is no guarantee that the search will give a solution that will be
optimal, as it finds the one which is within its limits.
With respect to the space and time complexities, the space complexity
is same as that of DFS, i.e., O(bl)But with respect to time complexity, it
now comes till the order of I, i.e., O(bl) where l is the depth
Iterative Deepening Search
• It is an enhanced version of the depth limited search.
• In some cases, depth limit restricts DLS from finding solution, since
solution may exist beyond prescribed depth limit.
• It further continues the DLS for the next level by extending the depth
limit as limit = limit +1 and so on till we are guaranteed of a solution.
• We can say that iterative deepening combines the benefits of BFS and
DFS.
• With regard to completeness and optimality of this approach, the
algorithm is complete and optimal.
• The time complexity comes to O(bd) due to the iterative calls.
• The space complexity of IDS comes to O(bd).
• When the search space is large and there is unavailability of the
depth factor or rather when the depth factor is not known, then in
such cases, IDS method is preferred.
Bi-directional Search
• Another variant of this type of search technique is bi-directional search.
• The search is carried out form both the ends and we are unsure of getting
a solution. The search needs to be explicitly specified with the goal state.
• It comprises forward search from initial stage and a backward one from
the goal state.
• At some point, they possibly can intersect and if they do, then we have a
solution or else there is no solution.
• The search is done expanding the tree with the branching factor b and the
distance from start to goal, ie We can relate this again to BFS that is
carried out from both the ends.
Thus, the bi-directional search is complete and at the same time, give
an optimal solution as well. The time and space complexities come to
O(bd/2) with BFS working in both directions and the space comes to
O(bd/2)
Comparison of Uninformed Search

You might also like