Sanjivani Rural Education Society’s
Sanjivani College of Engineering, Kopargaon-423603
(AnAutonomous Institute Affiliated to Savitribai Phule Pune University, Pune)
NAAC ‘A’GradeAccredited, ISO 9001:2015 Certified
Department of Information Technology
(NBA Accredited)
Department:- Information Technology
Name of Subject:- Artificial Intelligence
Class:- TYIT
Subject Code:- IT313
Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023
Unit No. 2: Uninformed Search Strategies
Course Objectives:
1.To understand the basic principles ofArtificial Intelligence
2.To Apply different uninformed search algorithms.
3.To provide an understanding of informed search strategies.
4.To study the concepts of Knowledge based system.
5.T
o learn and understand use of fuzzy logic and neural networks.
6.To learn and understand various application domain ofArtificial Intelligence.
Dept of Information Technology 5/31/2023
Uninformed Search Strategies
⦁ Uninformed search also called as blind search or brute-force method means that, the
strategies have no additional information about states beyond that provided in the problem
definition.
⦁ All they do is,generate successors and distinguish a goal state from a non-goal state.
⦁ All the search strategies are distinguished by the order in which nodes are expanded.
⦁ We can also say that,only start state and goal state
are known and other information about the domain
is not given.
⦁ All problems are NP-hard problems,as time and space
complexity is very large and they can be solved in
polynomial time.
⦁ But,these algorithms will always give an optimal solution.
Dept of Information Technology 5/31/2023
Uninformed Search Strategies
 Points to remember:
 Search without information.
 No prior knowledge.
 Time consuming.
 More complexity (time as well as
space)
 Uninformed Search Strategies:
 BFS (Breadth First Search)
 DFS (Depth First Search)
 UCS (Uniform Cost Search)
 DLS (Depth Limited Search)
 Iterative deepening DFS
 Bidirectional search
Dept of Information Technology 5/31/2023
Breadth First Search
⦁ It is a simple strategy in which the root node is expanded first, then all the successors of the
root node are expanded next,then their successors,and so on.
⦁ It is an instance of the general graph-search algorithm in which the shallowest unexpanded
node is chosen for expansion. This is achieved very simply by using a FIFO queue for the
frontier
.
⦁ Thus, new nodes(which are always deeper than their parents) go to the back of the queue,
and old nodes,which are shallower than the new nodes,get expanded first.
Dept of Information Technology 5/31/2023
Pseudo code for Breadth First Search algorithm
Dept of Information Technology 5/31/2023
Let us check if the BFS algorithm satisfies the 4 properties :
⦁ BFS is complete — if the shallowest goal node is at depth d,it will eventually find it after
expanding all the nodes shallower than d. (ie. As we are exploring each node, level by
level,till the last depth,it will always give the goal node)
⦁ As far as optimality of the solution is concerned — the BFS algorithm stops at the
shallowest goal found. We must remember that the shallowest goal node need not
necessarily be the optimal goal node. BFS is optimal if the path cost is a non-decreasing
function of d.Usually,BFS is applied when all the actions have the same cost.
⦁ To find the time complexity, let us assume all the non-goal nodes have b successors (b is
the branching factor of the tree), and generating each successor from the parent node
takes constant time. Then, the root of the search tree generates b nodes, and so it
consumes b time. Then each of the b nodes in depth 1 further generates b nodes,
consuming b² time, and so on, until the goal is reached in depth d. Hence, the time
complexity is;
Dept of Information Technology 5/31/2023
Let us check if the BFS algorithm satisfies the 4 properties :
⦁ Until the goal node is reached in depth d, all the nodes until d-1 must be
stored in the memory.Hence,the space complexity is also:
Figure :The time and memory required for BFS.
We assume b = 10,the processing speed is 1 million nodes per second,and the space required is 1kB per node
Dept of Information Technology 5/31/2023
Uniform Cost Search
⦁ BFS is optimal if all the step costs are the same.
⦁ By simple extension of BFS, we can find an algorithm that is optimal with any step-cost
function.
⦁ So, instead of expanding the shallowest node, uniform cost search expands the
node n with least path cost g(n).
⦁ To implement this,the frontier will be stored in a priority queue.
⦁ Other than the ordering of queue there is one more important difference between
BFS and uniform-cost search;
In breadth-first search, the goal test on the node is performed when it is first
generated. But in uniform-cost search, goal test on the node is performed when it
is selected for expansion. This is because the first node generated could be a sub-
optimal path.
Dept of Information Technology 5/31/2023
Pseudo code for Uniform Cost Search
Dept of Information Technology 5/31/2023
For example, let us consider a smaller region of Romania, where
our goal is to reach Bucharest from Sibiu with least path cost.
⦁ The successors of Sibiu are Rimnicu Vilcea (with cost of
80) and Fagaras (cost = 99).
⦁ The least-cost node is Rimnicu Vilcea, which is expanded
next to get Pitesti whose path cost from Sibiu is now 80 +
97 =177.
⦁ The least-cost node is now Fagaras, which is then
expanded to get Bucharest with path cost 99 + 211 = 310.
⦁ Now, we have generated the goal node,but the search still
continues.
⦁ What if the path through Pitesti reaches Bucharest with a
lesser cost?
⦁ Turns out this is the case in this situation. The Pitesti is
expanded next,to give Bucharest with path cost 177 + 101
= 278.
⦁ Bucharest, now with path cost 278, is chosen for
expansion,and the solution is returned.
Dept of Information Technology 5/31/2023
Let us check if the UCS algorithm satisfies the 4 properties :
⦁ Uniform-cost search doesn’t care about the number of steps a path has, but only the total path
cost. It will get stuck in an infinite loop if there’s a path with infinite sequence of zero-cost
actions.Completeness is guaranteed only if the cost of every step is some positive number.
⦁ Uniform-cost search is optimal. This is because, at every step the path with the least cost is
chosen, and paths never gets shorter as nodes are added, ensuring that the search expands nodes in
the order of their optimal path cost.
⦁ To measure the time complexity, we need the help of path cost instead of the depth d. If C* is the
optimal path cost of the solution, and each step costs at least e, then the time complexity is:
O(b^[1+(C*/ e)]), which can be much greater than that of BFS. When all the step costs are the
same,then the optimal-cost search is same as BFS except that we go one more step deeper
.
⦁ In the first step, all the successors of the root node are stored. Then, the least-cost node is
removed, and its successors are added. Since we need the least cost of all the nodes explored, we
need to store all the nodes explored until the goal node is found. Hence, the space
complexity is also O(b^[1+(C*/e)]).
Dept of Information Technology 5/31/2023
Depth First Search
⦁ It always expands the deepest node in the current frontier of the search tree.
⦁ The search proceeds immediately to the deepest level of the search tree, where
the nodes have no successors.
⦁ As those nodes are expanded, they are dropped from the frontier
, so then the
search“backs up” to the next deepest node that still has unexplored successors.
⦁ DFS uses a LIFO queue, means that, the most recently generated node is chosen
for expansion. This must be the deepest unexpanded node because it is one
deeper than its parent which, in turn, was the deepest unexpanded node when it
was selected.
Dept of Information Technology 5/31/2023
Depth First Search
Dept of Information Technology 5/31/2023
Let us check if the DFS algorithm satisfies the 4 properties :
⦁ DFS is not complete. In the problem of traveling from Arad to Bucharest, the search agent might get
stuck in Arad — Sibiu — Arad loop forever
. The only way to avoid loopy path in DFS is to remember all
the nodes present in the path from the root to the current node. This could solve the problem of
loopy paths,but still cannot avoid redundant paths.
⦁ DFS is non-optimal in nature. DFS will explore all the left nodes first, even if node C is the optimal
solution. Suppose node K is also a solution (but a non-optimal one), DFS returns K as the optimal
solution.
⦁ Time taken by DFS depends on the depth of the entire search tree (which could be infinite, if loopy paths
are not eliminated). Even in the case of a search tree with finite depth, the time complexity will be
O(b^m), where m is the maximum depth of the search tree, which could be much larger than d (the
depth of the shallowest goal).
⦁ The main reason for the use of DFS over BFS in many areas of AI is because of its very less space
consumption. In DFS, we need to store only the nodes which are present in the path from the root to the
current node and their unexplored successors. For state space with branching factor b and maximum
depth m,DFS has space complexity of O(bm), a much better improvement over that of BFS.
Dept of Information Technology 5/31/2023
Depth Limited Search
⦁ DFS algorithm fails in infinite state spaces, this failure can
be alleviated by supplying DFS with a predefined depth
limit l, ie. nodes at depth l are treated as if they have no
successors.This approach is called depth limited search.
⦁ Sometimes, depth limits can be based on knowledge of the
problem.
⦁ For example, on the map of Romania there are 20 cities.
Therefore, we know that if there is a solution, it must be of
length 19 at the longest, so l=19 is a possible choice. But, if
we studied the map carefully
, we would discover that any
city can be reached from any other city in at most 9 steps.
This number
, is known as diameter of the state space,
which gives us a better depth limit, which leads to a more
efficient depth-limited search.
Dept of Information Technology 5/31/2023
Pseudo code for Depth Limited Search
Dept of Information Technology 5/31/2023
Let us check if the DLS algorithm satisfies the 4 properties :
⦁ Depth-limited search solves the infinite-path problem. But the search is not complete
if l < d.
⦁ Even if l> d,optimal solution is not guaranteed, as we could be eliminating some of
the solutions at depths > l.
⦁ Time complexity is O(b^l).
⦁ Space complexity is O(bl) (It is same as DFS, only with restricted depth to l).
⦁ In fact,DFS can be viewed as a special-case of depth-limited search with l →infinity.
⦁ The problem with depth-limited search is to set the value of loptimally, so as to not
leave out any solution,as well as keep the time and space complexity to a minimum.
Dept of Information Technology 5/31/2023
Iterative Deepening Depth First Search
⦁ Iterative-deepening depth-first search offers a solution for the problem of finding the best
depth limit.
⦁ It gradually increases the depth first 0,then 1,then 2,and so on until a goal is found.
⦁ It combines the advantages of both BFS and DFS. Like DFS, it consumes less memory:
O(bd). Like BFS, it is complete when b is finite, and is optimal when the path cost is a
non-decreasing function of depth.Time complexity is O(b^d), similar to BFS.
Iterative-deepening search,repeatedly calling the depth-limited search while varying the depth limit in
every iteration.
Dept of Information Technology 5/31/2023
Iterative Deepening Depth First Search
⦁ Iterative deepening search generates the states multiple times,but it is not too costly.
⦁ In a search tree with nearly the same branching factor at every level, the size of the
bottom levels are very huge compared to the top ones, hence it does not affect much if
the nodes in the top levels are generated many times.
⦁ To generate the node at depth d, the nodes at depth d-1 are generated twice, the nodes at
depth d-2 are created 3 times, and so on. Hence, the total number of nodes generated will
be;
⦁ Which has the complexity of O(b^d), the same as BFS.
For example,for d = 5 and b = 10:
⦁ n(IDS) = 50 + 400 + 3000 + 20000 + 100000 = 1,23,450
⦁ n(BFS) = 10 + 100 + 1000 + 10000 + 100000 = 1,11,110
In terms of performance measure,
since IDS seems to be the hybrid
form of BFS and DFS, IDS is the
preferred uninformed search
method when the search space is
large and the depth of the solution is
not known.
Dept of Information Technology 5/31/2023
Bidirectional Search
⦁ The idea behind the bidirectional search is to run two searches simultaneously — one
forward from the start state, and the other from the goal — hoping that the two will meet
somewhere in the middle.
⦁ It is implemented by replacing the goal test with a check to see whether the frontiers of
the two search intersect (the solution is found if they do). The check can be performed
when the node is generated,and can be done in constant time using hash tables.
⦁ The main aim of bidirectional search is to reduce the total search time. If we use BFS at
both the ends as the search algorithm, the time and space complexity will be
O(b^(d/2))(In the worst case,the two frontiers meet in the middle).
⦁ The space can be reduced if one of them is IDS, but one of the frontiers must be in the
memory to perform the check for the intersection.
Dept of Information Technology 5/31/2023
Bidirectional Search
2
2
⦁ The difficulty in using the bidirectional search is to search backwards.We need to find the
predecessors of each state (all the states having the given state as their successor).
⦁ If the actions of the search space are reversible, like in the Arad-Bucharest path-finding
problem,the predecessors of the node are its successors.
⦁ If there are several goal states, then we can create a dummy goal state whose
predecessors are the actual goal states.
A schematic view of a bidirectional search that is about to succeed, when a branch from the start node
meets a branch from the goal node
Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023
Comparison of Uninformed search Strategies
Dept of Information Technology 5/31/2023
Searching with partial information
⦁ What if the knowledge of the states or actions is incomplete?
⦁ That means,if the environment is not fully observable or deterministic.
⦁ Different types of incompleteness lead to three distinct problem types;
1.Sensorless problems,
2.Contingency problems,
3.Exploration problems
Dept of Information Technology 5/31/2023
Sensorless problems
⦁ If the agent has no sensors, then the
agent cannot know it’s current state,
and hence would have to make many
repeated action paths to ensure that the
goal state is reached regardless of it’s
initial state.
⦁ The agent has no sensors at all. It could be
in one of several possible initial states.
⦁ It knows all the effects of its actions. Each
action might lead to one of several
possible successor states
Absorb
Dept of Information Technology 5/31/2023
Absorb
Sensorless problems
⦁ The agent can reach state 8 with the action sequence [Left, Absorb, Right, Absorb]
without knowing the initial state.
⦁ “When the world is not fully observable, the agent must reason about sets of
states (belief state),rather than a single state.”
⦁ Searching in the space of beliefstates;
1. An action is applied to abelief state by unioning the results of applying the action to
each physical state in the belief state.
2. A path now connects belief states.
3. A solution now is a path leading to a belief state,all of whose members are goal states.
In general,there are 2s belief states given S physical states.
The analysis is essentially the same if the environment is not deterministic. We just need
to add the various outcomes of the action to the successor belief state.
Dept of Information Technology 5/31/2023
Contingency problems
⦁ The environment is only partially observable or nondeterministic,but the agent can
obtain new information from sensors after acting.
⦁ Forexample,inthevacuumworld,theAbsorb action sometimes deposits dirt when there is
no dirt already
.
⦁ This is when the environment is partially observable or when actions are uncertain.
⦁ Then after each action the agent needs to verify what effects that action has caused.
⦁ Rather than planning for every possible contingency after an action, it is usually better to
start acting and see which contingencies do arise .This is called interleaving of search and
execution.
⦁ A problem is called adversarial if the uncertainty is caused by the actions of another agent.
Dept of Information Technology 5/31/2023
Contingency problems
⦁ The agent has a location sensor and a
“local” dirt sensor. No fixed action
sequence guarantees a solution to this
problem.
⦁ Many problems in the real world are
contingency problems, because exact
prediction is impossible;
• They lead to a different agent design, in
which the agent can act before finding a
guaranteed plan.
• This type of interleaving of search and
execution is also useful for exploration and
game playing.
Absorb
Dept of Information Technology 5/31/2023
Exploration problems
⦁ This can be considered an extreme case of contingency problems; when the
states and actions of the environment is unknown, the agent must act to discover
them.
o No sensor
o Initial State(1,2,3,4,5,6,7,8)
o After action [Right] the state (2,4,6,8)
o After action [Absorb] the state (4,8)
o After action [Left] the state (3,7)
o After action [Absorb] the state (8)
o Answer :[Right,Absorb, Left,Absorb] coerce the world into state 7 without any sensor
o Belief State:Such state that agent belief to be there
Dept of Information Technology 5/31/2023
Sensorless multi-state problem
30
⦁ Contingency, start in {1,3}.
⦁ Murphy’
s law, Absorb can dirty a clean
carpet.
⦁ Local sensing:dirt,location only.
– Percept = [L,Dirty] ={1,3}
– [Absorb] = {5,7}
– [Right] ={6,8}
– [Absorb] in {6}={8} (Success)
– BUT [Absorb] in {8} = failure
⦁ Solution??
– Belief-state:no fixed action sequence
guarantees solution
⦁ Relax requirement:
– [Absorb,Right,if[R,dirty] thenAbsorb]
– Select actions based on contingencies
arising during execution.
Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023
Sensorless multi-state problem
3
1
A
Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023
A
A
A
A A
Summary: Partial knowledge of states and actions
32
 Different types of incompleteness lead to three distinct problem types:
⦁ Sensorless or conformant problem – Agent may have no idea where it is; solution (if
any) is a sequence.
⦁ Contingency problem – Percepts provide new information about current state;
solution is a tree or policy; often interleave search and execution. If uncertainty is caused
by actions of another agent:adversarial problem.
⦁ Exploration problem – When states and actions of the environment are unknown.
Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023
References
50
• “Artificial intelligence: A modern approach”, S. J. Russell and P. Norvig,
Pearson, 3rd Edition
• “Artificial Intelligence”, Elaine R. and Kevin K., McGraw Hill, 2nd edition
Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023
Thank you
Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023

Unit 2 Uninformed Search Strategies.pptx

  • 1.
    Sanjivani Rural EducationSociety’s Sanjivani College of Engineering, Kopargaon-423603 (AnAutonomous Institute Affiliated to Savitribai Phule Pune University, Pune) NAAC ‘A’GradeAccredited, ISO 9001:2015 Certified Department of Information Technology (NBA Accredited) Department:- Information Technology Name of Subject:- Artificial Intelligence Class:- TYIT Subject Code:- IT313 Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023 Unit No. 2: Uninformed Search Strategies
  • 2.
    Course Objectives: 1.To understandthe basic principles ofArtificial Intelligence 2.To Apply different uninformed search algorithms. 3.To provide an understanding of informed search strategies. 4.To study the concepts of Knowledge based system. 5.T o learn and understand use of fuzzy logic and neural networks. 6.To learn and understand various application domain ofArtificial Intelligence. Dept of Information Technology 5/31/2023
  • 3.
    Uninformed Search Strategies ⦁Uninformed search also called as blind search or brute-force method means that, the strategies have no additional information about states beyond that provided in the problem definition. ⦁ All they do is,generate successors and distinguish a goal state from a non-goal state. ⦁ All the search strategies are distinguished by the order in which nodes are expanded. ⦁ We can also say that,only start state and goal state are known and other information about the domain is not given. ⦁ All problems are NP-hard problems,as time and space complexity is very large and they can be solved in polynomial time. ⦁ But,these algorithms will always give an optimal solution. Dept of Information Technology 5/31/2023
  • 4.
    Uninformed Search Strategies Points to remember:  Search without information.  No prior knowledge.  Time consuming.  More complexity (time as well as space)  Uninformed Search Strategies:  BFS (Breadth First Search)  DFS (Depth First Search)  UCS (Uniform Cost Search)  DLS (Depth Limited Search)  Iterative deepening DFS  Bidirectional search Dept of Information Technology 5/31/2023
  • 5.
    Breadth First Search ⦁It is a simple strategy in which the root node is expanded first, then all the successors of the root node are expanded next,then their successors,and so on. ⦁ It is an instance of the general graph-search algorithm in which the shallowest unexpanded node is chosen for expansion. This is achieved very simply by using a FIFO queue for the frontier . ⦁ Thus, new nodes(which are always deeper than their parents) go to the back of the queue, and old nodes,which are shallower than the new nodes,get expanded first. Dept of Information Technology 5/31/2023
  • 6.
    Pseudo code forBreadth First Search algorithm Dept of Information Technology 5/31/2023
  • 7.
    Let us checkif the BFS algorithm satisfies the 4 properties : ⦁ BFS is complete — if the shallowest goal node is at depth d,it will eventually find it after expanding all the nodes shallower than d. (ie. As we are exploring each node, level by level,till the last depth,it will always give the goal node) ⦁ As far as optimality of the solution is concerned — the BFS algorithm stops at the shallowest goal found. We must remember that the shallowest goal node need not necessarily be the optimal goal node. BFS is optimal if the path cost is a non-decreasing function of d.Usually,BFS is applied when all the actions have the same cost. ⦁ To find the time complexity, let us assume all the non-goal nodes have b successors (b is the branching factor of the tree), and generating each successor from the parent node takes constant time. Then, the root of the search tree generates b nodes, and so it consumes b time. Then each of the b nodes in depth 1 further generates b nodes, consuming b² time, and so on, until the goal is reached in depth d. Hence, the time complexity is; Dept of Information Technology 5/31/2023
  • 8.
    Let us checkif the BFS algorithm satisfies the 4 properties : ⦁ Until the goal node is reached in depth d, all the nodes until d-1 must be stored in the memory.Hence,the space complexity is also: Figure :The time and memory required for BFS. We assume b = 10,the processing speed is 1 million nodes per second,and the space required is 1kB per node Dept of Information Technology 5/31/2023
  • 9.
    Uniform Cost Search ⦁BFS is optimal if all the step costs are the same. ⦁ By simple extension of BFS, we can find an algorithm that is optimal with any step-cost function. ⦁ So, instead of expanding the shallowest node, uniform cost search expands the node n with least path cost g(n). ⦁ To implement this,the frontier will be stored in a priority queue. ⦁ Other than the ordering of queue there is one more important difference between BFS and uniform-cost search; In breadth-first search, the goal test on the node is performed when it is first generated. But in uniform-cost search, goal test on the node is performed when it is selected for expansion. This is because the first node generated could be a sub- optimal path. Dept of Information Technology 5/31/2023
  • 10.
    Pseudo code forUniform Cost Search Dept of Information Technology 5/31/2023
  • 11.
    For example, letus consider a smaller region of Romania, where our goal is to reach Bucharest from Sibiu with least path cost. ⦁ The successors of Sibiu are Rimnicu Vilcea (with cost of 80) and Fagaras (cost = 99). ⦁ The least-cost node is Rimnicu Vilcea, which is expanded next to get Pitesti whose path cost from Sibiu is now 80 + 97 =177. ⦁ The least-cost node is now Fagaras, which is then expanded to get Bucharest with path cost 99 + 211 = 310. ⦁ Now, we have generated the goal node,but the search still continues. ⦁ What if the path through Pitesti reaches Bucharest with a lesser cost? ⦁ Turns out this is the case in this situation. The Pitesti is expanded next,to give Bucharest with path cost 177 + 101 = 278. ⦁ Bucharest, now with path cost 278, is chosen for expansion,and the solution is returned. Dept of Information Technology 5/31/2023
  • 12.
    Let us checkif the UCS algorithm satisfies the 4 properties : ⦁ Uniform-cost search doesn’t care about the number of steps a path has, but only the total path cost. It will get stuck in an infinite loop if there’s a path with infinite sequence of zero-cost actions.Completeness is guaranteed only if the cost of every step is some positive number. ⦁ Uniform-cost search is optimal. This is because, at every step the path with the least cost is chosen, and paths never gets shorter as nodes are added, ensuring that the search expands nodes in the order of their optimal path cost. ⦁ To measure the time complexity, we need the help of path cost instead of the depth d. If C* is the optimal path cost of the solution, and each step costs at least e, then the time complexity is: O(b^[1+(C*/ e)]), which can be much greater than that of BFS. When all the step costs are the same,then the optimal-cost search is same as BFS except that we go one more step deeper . ⦁ In the first step, all the successors of the root node are stored. Then, the least-cost node is removed, and its successors are added. Since we need the least cost of all the nodes explored, we need to store all the nodes explored until the goal node is found. Hence, the space complexity is also O(b^[1+(C*/e)]). Dept of Information Technology 5/31/2023
  • 13.
    Depth First Search ⦁It always expands the deepest node in the current frontier of the search tree. ⦁ The search proceeds immediately to the deepest level of the search tree, where the nodes have no successors. ⦁ As those nodes are expanded, they are dropped from the frontier , so then the search“backs up” to the next deepest node that still has unexplored successors. ⦁ DFS uses a LIFO queue, means that, the most recently generated node is chosen for expansion. This must be the deepest unexpanded node because it is one deeper than its parent which, in turn, was the deepest unexpanded node when it was selected. Dept of Information Technology 5/31/2023
  • 14.
    Depth First Search Deptof Information Technology 5/31/2023
  • 15.
    Let us checkif the DFS algorithm satisfies the 4 properties : ⦁ DFS is not complete. In the problem of traveling from Arad to Bucharest, the search agent might get stuck in Arad — Sibiu — Arad loop forever . The only way to avoid loopy path in DFS is to remember all the nodes present in the path from the root to the current node. This could solve the problem of loopy paths,but still cannot avoid redundant paths. ⦁ DFS is non-optimal in nature. DFS will explore all the left nodes first, even if node C is the optimal solution. Suppose node K is also a solution (but a non-optimal one), DFS returns K as the optimal solution. ⦁ Time taken by DFS depends on the depth of the entire search tree (which could be infinite, if loopy paths are not eliminated). Even in the case of a search tree with finite depth, the time complexity will be O(b^m), where m is the maximum depth of the search tree, which could be much larger than d (the depth of the shallowest goal). ⦁ The main reason for the use of DFS over BFS in many areas of AI is because of its very less space consumption. In DFS, we need to store only the nodes which are present in the path from the root to the current node and their unexplored successors. For state space with branching factor b and maximum depth m,DFS has space complexity of O(bm), a much better improvement over that of BFS. Dept of Information Technology 5/31/2023
  • 16.
    Depth Limited Search ⦁DFS algorithm fails in infinite state spaces, this failure can be alleviated by supplying DFS with a predefined depth limit l, ie. nodes at depth l are treated as if they have no successors.This approach is called depth limited search. ⦁ Sometimes, depth limits can be based on knowledge of the problem. ⦁ For example, on the map of Romania there are 20 cities. Therefore, we know that if there is a solution, it must be of length 19 at the longest, so l=19 is a possible choice. But, if we studied the map carefully , we would discover that any city can be reached from any other city in at most 9 steps. This number , is known as diameter of the state space, which gives us a better depth limit, which leads to a more efficient depth-limited search. Dept of Information Technology 5/31/2023
  • 17.
    Pseudo code forDepth Limited Search Dept of Information Technology 5/31/2023
  • 18.
    Let us checkif the DLS algorithm satisfies the 4 properties : ⦁ Depth-limited search solves the infinite-path problem. But the search is not complete if l < d. ⦁ Even if l> d,optimal solution is not guaranteed, as we could be eliminating some of the solutions at depths > l. ⦁ Time complexity is O(b^l). ⦁ Space complexity is O(bl) (It is same as DFS, only with restricted depth to l). ⦁ In fact,DFS can be viewed as a special-case of depth-limited search with l →infinity. ⦁ The problem with depth-limited search is to set the value of loptimally, so as to not leave out any solution,as well as keep the time and space complexity to a minimum. Dept of Information Technology 5/31/2023
  • 19.
    Iterative Deepening DepthFirst Search ⦁ Iterative-deepening depth-first search offers a solution for the problem of finding the best depth limit. ⦁ It gradually increases the depth first 0,then 1,then 2,and so on until a goal is found. ⦁ It combines the advantages of both BFS and DFS. Like DFS, it consumes less memory: O(bd). Like BFS, it is complete when b is finite, and is optimal when the path cost is a non-decreasing function of depth.Time complexity is O(b^d), similar to BFS. Iterative-deepening search,repeatedly calling the depth-limited search while varying the depth limit in every iteration. Dept of Information Technology 5/31/2023
  • 20.
    Iterative Deepening DepthFirst Search ⦁ Iterative deepening search generates the states multiple times,but it is not too costly. ⦁ In a search tree with nearly the same branching factor at every level, the size of the bottom levels are very huge compared to the top ones, hence it does not affect much if the nodes in the top levels are generated many times. ⦁ To generate the node at depth d, the nodes at depth d-1 are generated twice, the nodes at depth d-2 are created 3 times, and so on. Hence, the total number of nodes generated will be; ⦁ Which has the complexity of O(b^d), the same as BFS. For example,for d = 5 and b = 10: ⦁ n(IDS) = 50 + 400 + 3000 + 20000 + 100000 = 1,23,450 ⦁ n(BFS) = 10 + 100 + 1000 + 10000 + 100000 = 1,11,110 In terms of performance measure, since IDS seems to be the hybrid form of BFS and DFS, IDS is the preferred uninformed search method when the search space is large and the depth of the solution is not known. Dept of Information Technology 5/31/2023
  • 21.
    Bidirectional Search ⦁ Theidea behind the bidirectional search is to run two searches simultaneously — one forward from the start state, and the other from the goal — hoping that the two will meet somewhere in the middle. ⦁ It is implemented by replacing the goal test with a check to see whether the frontiers of the two search intersect (the solution is found if they do). The check can be performed when the node is generated,and can be done in constant time using hash tables. ⦁ The main aim of bidirectional search is to reduce the total search time. If we use BFS at both the ends as the search algorithm, the time and space complexity will be O(b^(d/2))(In the worst case,the two frontiers meet in the middle). ⦁ The space can be reduced if one of them is IDS, but one of the frontiers must be in the memory to perform the check for the intersection. Dept of Information Technology 5/31/2023
  • 22.
    Bidirectional Search 2 2 ⦁ Thedifficulty in using the bidirectional search is to search backwards.We need to find the predecessors of each state (all the states having the given state as their successor). ⦁ If the actions of the search space are reversible, like in the Arad-Bucharest path-finding problem,the predecessors of the node are its successors. ⦁ If there are several goal states, then we can create a dummy goal state whose predecessors are the actual goal states. A schematic view of a bidirectional search that is about to succeed, when a branch from the start node meets a branch from the goal node Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023
  • 23.
    Comparison of Uninformedsearch Strategies Dept of Information Technology 5/31/2023
  • 24.
    Searching with partialinformation ⦁ What if the knowledge of the states or actions is incomplete? ⦁ That means,if the environment is not fully observable or deterministic. ⦁ Different types of incompleteness lead to three distinct problem types; 1.Sensorless problems, 2.Contingency problems, 3.Exploration problems Dept of Information Technology 5/31/2023
  • 25.
    Sensorless problems ⦁ Ifthe agent has no sensors, then the agent cannot know it’s current state, and hence would have to make many repeated action paths to ensure that the goal state is reached regardless of it’s initial state. ⦁ The agent has no sensors at all. It could be in one of several possible initial states. ⦁ It knows all the effects of its actions. Each action might lead to one of several possible successor states Absorb Dept of Information Technology 5/31/2023 Absorb
  • 26.
    Sensorless problems ⦁ Theagent can reach state 8 with the action sequence [Left, Absorb, Right, Absorb] without knowing the initial state. ⦁ “When the world is not fully observable, the agent must reason about sets of states (belief state),rather than a single state.” ⦁ Searching in the space of beliefstates; 1. An action is applied to abelief state by unioning the results of applying the action to each physical state in the belief state. 2. A path now connects belief states. 3. A solution now is a path leading to a belief state,all of whose members are goal states. In general,there are 2s belief states given S physical states. The analysis is essentially the same if the environment is not deterministic. We just need to add the various outcomes of the action to the successor belief state. Dept of Information Technology 5/31/2023
  • 27.
    Contingency problems ⦁ Theenvironment is only partially observable or nondeterministic,but the agent can obtain new information from sensors after acting. ⦁ Forexample,inthevacuumworld,theAbsorb action sometimes deposits dirt when there is no dirt already . ⦁ This is when the environment is partially observable or when actions are uncertain. ⦁ Then after each action the agent needs to verify what effects that action has caused. ⦁ Rather than planning for every possible contingency after an action, it is usually better to start acting and see which contingencies do arise .This is called interleaving of search and execution. ⦁ A problem is called adversarial if the uncertainty is caused by the actions of another agent. Dept of Information Technology 5/31/2023
  • 28.
    Contingency problems ⦁ Theagent has a location sensor and a “local” dirt sensor. No fixed action sequence guarantees a solution to this problem. ⦁ Many problems in the real world are contingency problems, because exact prediction is impossible; • They lead to a different agent design, in which the agent can act before finding a guaranteed plan. • This type of interleaving of search and execution is also useful for exploration and game playing. Absorb Dept of Information Technology 5/31/2023
  • 29.
    Exploration problems ⦁ Thiscan be considered an extreme case of contingency problems; when the states and actions of the environment is unknown, the agent must act to discover them. o No sensor o Initial State(1,2,3,4,5,6,7,8) o After action [Right] the state (2,4,6,8) o After action [Absorb] the state (4,8) o After action [Left] the state (3,7) o After action [Absorb] the state (8) o Answer :[Right,Absorb, Left,Absorb] coerce the world into state 7 without any sensor o Belief State:Such state that agent belief to be there Dept of Information Technology 5/31/2023
  • 30.
    Sensorless multi-state problem 30 ⦁Contingency, start in {1,3}. ⦁ Murphy’ s law, Absorb can dirty a clean carpet. ⦁ Local sensing:dirt,location only. – Percept = [L,Dirty] ={1,3} – [Absorb] = {5,7} – [Right] ={6,8} – [Absorb] in {6}={8} (Success) – BUT [Absorb] in {8} = failure ⦁ Solution?? – Belief-state:no fixed action sequence guarantees solution ⦁ Relax requirement: – [Absorb,Right,if[R,dirty] thenAbsorb] – Select actions based on contingencies arising during execution. Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023
  • 31.
    Sensorless multi-state problem 3 1 A SanjivaniCollege of Engineering, Kopargaon Dept of Information Technology 5/31/2023 A A A A A
  • 32.
    Summary: Partial knowledgeof states and actions 32  Different types of incompleteness lead to three distinct problem types: ⦁ Sensorless or conformant problem – Agent may have no idea where it is; solution (if any) is a sequence. ⦁ Contingency problem – Percepts provide new information about current state; solution is a tree or policy; often interleave search and execution. If uncertainty is caused by actions of another agent:adversarial problem. ⦁ Exploration problem – When states and actions of the environment are unknown. Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023
  • 33.
    References 50 • “Artificial intelligence:A modern approach”, S. J. Russell and P. Norvig, Pearson, 3rd Edition • “Artificial Intelligence”, Elaine R. and Kevin K., McGraw Hill, 2nd edition Sanjivani College of Engineering, Kopargaon Dept of Information Technology 5/31/2023
  • 34.
    Thank you Sanjivani Collegeof Engineering, Kopargaon Dept of Information Technology 5/31/2023