0% found this document useful (0 votes)
104 views27 pages

Uninformed Search Techniques

Uploaded by

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

Uninformed Search Techniques

Uploaded by

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

SEARCH TECHNIQUES

Uninformed Search
Algorithms

 Uninformed search is a class of general-purpose


search algorithms which operates in brute force-
way.
 They do not have additional information about
state or search space other than how to
traverse the tree, so it is also called blind
search.
 Important types of uninformed search
algorithms:
1. Breadth-first Search
2. Depth-first Search
3. Bidirectional Search
Breadth-first search
• A Search strategy, in which the highest layer of a decision
tree is searched completely before proceeding to the next
layer is called Breadth-first search (BFS).
• No viable solutions are omitted and therefore it is
guaranteed that an optimal solution is found.
• This strategy is often not feasible when the search space is
large.
• Algorithm
• 1. Create a variable called LIST and set it to be the starting
state.
• 2. Loop until a goal state is found or LIST is empty, Do
• a. Remove the first element from the LIST and call it E. If
the LIST is empty, quit.
• b. For every path each rule can match the state E, Do
• (i) Apply the rule to generate a new state.
• (ii) If the new state is a goal state, quit and return this
state.
• (iii) Otherwise, add the new state to the end of LIST.
• Advantages
1. Guaranteed to find an optimal solution (in
terms of shortest number of steps to reach
the goal).
2. Can always find a goal node if one exists
(complete).
• Disadvantages
• 1. High storage requirement: exponential
with tree depth.
Example:
 the traversing of the tree using BFS algorithm
from the root node S to goal node K.
 BFS search algorithm traverse in layers, so it
will follow the path which is shown by the
dotted arrow, and the traversed path will be:
 S---> A--->B---->C--->D---->G--->H--->E----
>F---->I---->K
Time Complexity: Time Complexity of BFS
algorithm can be obtained by the number of
nodes traversed in BFS until the shallowest
Node. Where the d= depth of shallowest solution
and b is a node at every state.
T (b) = 1+b2+b3+.......+ bd= O (bd)
Space Complexity: Space complexity of BFS
algorithm is given by the Memory size of frontier
which is O(bd).
Completeness: BFS is complete, which means
if the shallowest goal node is at some finite
depth, then BFS will find a solution.
Optimality: BFS is optimal if path cost is a non-
decreasing function of the depth of the node.
Depth-first search
• A search strategy that extends the current path as far as
possible before backtracking to the last choice point and trying
the next alternative path is called Depth-first search (DFS).
• This strategy does not guarantee that the optimal solution has
been found.
• The search reaches a satisfactory solution more rapidly than
breadth first, an advantage when the search space is large.
• Algorithm
• Depth-first search applies operators to each newly generated
state, trying to drive directly toward the goal.
• 1. If the starting state is a goal state, quit and return success.
• 2. Otherwise, do the following until success or failure is
signaled:
• a. Generate a successor E to the starting state. If there are no
more successors, then signal failure.
• b. Call Depth-first Search with E as the starting state.
• c. If success is returned signal success; otherwise, continue in
the loop.
• Advantages
• 1. Low storage requirement: linear with tree
depth.
• 2. Easily programmed: function call stack
does most of the work of maintaining state of
the search.
• Disadvantages
• 1. May find a sub-optimal solution (one that is
deeper or more costly than the best solution).
• 2. Incomplete: without a depth bound, may
not find a solution even if one exists.
Example
 Root node--->Left node ----> right node.
 It will start searching from root node S, and traverse A, then
B, then D and E, after traversing E, it will backtrack the tree
as E has no other successor and still goal node is not found.
After backtracking it will traverse node C and then G, and
here it will terminate as it found goal node.
Completeness: DFS search algorithm is complete within finite
state space as it will expand every node within a limited search
tree.
Time Complexity: Time complexity of DFS will be equivalent to
the node traversed by the algorithm. It is given by:
T(n)= 1+ n2+ n3 +.........+ nm=O(nm)
Where, m= maximum depth of any node and this can be
much larger than d (Shallowest solution depth)

Space Complexity: DFS algorithm needs to store only single


path from the root node, hence space complexity of DFS is
equivalent to the size of the fringe set, which is O(bm).
Bidirectional Search
Algorithm:
Bidirectional search algorithm runs two
simultaneous searches, one from initial state
called as forward-search and other from goal
node called as backward-search.
It replaces one single search graph with two
small subgraphs in which one starts the search
from an initial vertex and other starts from goal
vertex. The search stops when these two
graphs intersect each other.
Bidirectional search can use search techniques
such as BFS, DFS, etc.
Advantages:
• Bidirectional search is fast.
• requires less memory
Disadvantages:
• Implementation of the bidirectional search
tree is difficult.
• one should know the goal state in advance.
Example:
This algorithm divides one graph/tree into two
sub-graphs. It starts traversing from node 1 in
the forward direction and starts from goal node
16 in the backward direction.
The algorithm terminates at node 9 where two
searches meet.
Completeness: Bidirectional Search is
complete if we use BFS in both searches.
Time Complexity: Time complexity of
bidirectional search using BFS is O(bd).
Space Complexity: Space complexity of
bidirectional search is O(bd).
Optimal: Bidirectional search is Optimal.
Apply BFS and DFS to trace
the goal node U from initial
node A.
Apply State space search to
reach the goal state
HEURISTIC SEARCH
TECHNIQUES
• The algorithms that use heuristic functions are called
heuristic algorithms.
• Heuristic algorithms are more efficient because they
take advantage of feedback from the data to direct
the search path.
• Uninformed search algorithms or Brute-force
algorithms, search through the search space all
possible candidates for the solution checking whether
each candidate satisfies the problem’s statement.
• Informed search algorithms use heuristic functions
that are specific to the problem, apply them to guide
the search through the search space to reduce the
amount of time spent in searching.
• A good heuristic will make an informed
search dramatically outperform any
uninformed search:
• Ex: Traveling Salesman Problem (TSP), where
the goal is to find is a good solution instead
of finding the best solution.

You might also like