3.2 Uninformed Search
3.2 Uninformed Search
AI
CH:03
Solving Problems by Searching
Content
• Performance evaluation of search strategies,
– Time Complexity,
– Space Complexity,
– Completeness,
– Optimality
Content
• Uninformed Search:
– Depth First Search,
– Breadth First Search,
– Depth Limited Search,
– Iterative Deepening Search,
– Uniform Cost Search,
– Bidirectional Search
Searching for solutions
• We have seen many problems. Now, there is a
need to search for solutions to solve them.
• Understand how searching can be used by the
agent to solve a problem.
• For solving different kinds of problem, an agent
makes use of different strategies to reach the
goal by searching the best possible algorithms.
This process of searching is known as search
strategy.
Measuring problem-solving
performance
Before discussing different search strategies, the
performance measure of an algorithm should be
measured.
Four ways to measure the performance of an
algorithm:
Completeness: It measures if the algorithm
guarantees to find a solution (if any solution
exist).
Measuring problem-solving performance
Optimality: It measures if the strategy searches for an optimal
solution.
Time Complexity: The time taken by the algorithm to find a
solution.
Space Complexity: Amount of memory required to perform a
search.
• Thus, Depth limited search can be called an extended and refined version of
the DFS algorithm.
• To avoid the infinite loop status while executing the codes, and depth
limited search algorithm is being executed into a finite set of depth called
depth limit.
Algorithm of the example
2. Then we search along with the depth using the DFS algorithm.
3. Then we keep checking if the current node is the goal node or not.
Advantages of Depth Limited Search
● Depth limited search is better than DFS and requires less time and memory space.
● There are applications of DLS in graph theory particularly similar to the DFS.
● To combat the disadvantages of DFS, we add a limit to the depth, and our search
● The goal node will not be found if it does not exist in the desired limit.
● The goal node may not exist in the depth limit set earlier, which will push
• There are two common ways to traverse a graph, BFS and DFS.
Considering a Tree (or Graph) of huge height and width, both
BFS and DFS are not very efficient due to following reasons.
● It combines the benefits of BFS and DFS search algorithm in terms of fast search
and memory efficiency.
Disadvantages:
● The main drawback of IDDFS is that it repeats all the work of the previous phase.
Uniform Cost Search
• Uniform-Cost Search is a variant of Dijikstra’s algorithm.
• Here, instead of inserting all vertices into a priority queue, we insert only
source, then one by one insert when needed.
• In every step, we check if the node is already in priority queue (using
visited array).
• used for weighted tree.
• backtracking approach
• gives optimal solution. select the path which has minimum cost.
• Node expansion is based on path cost.
• Uniform-Cost Search is mainly used in Artificial Intelligence.
• In this algorithm from the starting state we will visit the adjacent states
and will choose the least costly state then we will choose the next least
costly state from the all un-visited and adjacent states of the visited
states,
• In this way we will try to reach the goal state (note we wont continue
the path through a goal state ), even if we reach the goal state we will
continue searching for other possible paths( if there are multiple
goals) .
• We will keep a priority queue which will give the least costliest next
state from all the adjacent states of visited states.
Advantages:
● Uniform cost search is optimal because at every state the path with the least cost
is chosen.
Disadvantages:
● It does not care about the number of steps involved in searching and only
concerned about path cost. Due to which this algorithm may be stuck in an
infinite loop.
Bidirectional Search
• Bidirectional search algorithm runs two simultaneous searches, one
form initial state called as forward-search and other from goal node
called as backward-search, to find the goal node.
• Bidirectional search 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,
DLS, etc.
Advantages:
Disadvantages:
44