AI Module 1 Lecture 4
AI Module 1 Lecture 4
• A control strategy that specifies the order in which the rules will be
compared to the database and a way of resolving the conflicts that
arise when several rules match at once.
Control strategies
•A control strategy that specifies the order in which the rules
will be applied.
•Control strategies help us to overcome the abnormal
situations, when there are more than one rules or fewer than
one rule will have its left sides match the current state.
•Requirement for control strategy
i.A good control strategy causes motion
ii.A good control strategy is systematic
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Search Strategies
• Breadth-first search
Expand all the nodes of
one level first.
• Depth-first search
Expand one of the nodes at
the deepest level.
Amity School of Engineering and Technology
Time Complexity :
1 + b + b2 + b3 +…+……bd.
Hence Time complexity =O (bd)
Where b-> branching factor
d-> Depth of a tree
Space Complexity :
Hence Space complexity = O (d)
Amity School of Engineering and Technology
Time Complexity :
1 + b + b2 + b3 +…+……bd.
Hence Time complexity = O (bd)
Space Complexity :
1 + b + b2 + b3 +…+……bd.
Hence Space complexity = O (bd)
Amity School of Engineering and Technology
• Breadth first search will never get trapped exploring the useless
path forever.
• If there is a solution, BFS will definitely find it out.
• If there is more than one solution then BFS can find the minimal
one that requires less number of steps.
Amity School of Engineering and Technology
DFS Vs BFS
DFS BFS
It require less memory because only the It require more memory because all the tree
nodes on the current path are stored. that has so far been generated must be
stored.
It is one in which by luck solution can be While in BFS all parts of the tree must be
found without examining much of the examined to level n before any nodes on
search space at all. level n+1 can be examined.
It does not give optimal solution. It gives optimal solution.
DFS may find a long path to a solution in BFS guarantees to find a solution if it
one part of the tree, when a shorter path exists. Furthermore if there are multiple
exists in some other, unexplored part of the solutions, then a minimal solution will be
tree. found.
Time complexity: O(bd ) Time complexity: O(bd )
where b : branching factor, d: depth where b : branching factor, d: depth
Space complexity: O(d) , d: depth Space complexity: O(bd )
where b : branching factor, d: depth
Amity School of Engineering and Technology
Thank You