0% found this document useful (0 votes)
37 views40 pages

AI Module 1 Lecture 4

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)
37 views40 pages

AI Module 1 Lecture 4

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/ 40

Amity School of Engineering and Technology

B. Tech. (CSE), 6th Semester


Artificial Intelligence CSE401
Module 1
Scope of AI & Problem Solving

Dr. Shuchi Mala, Assistant Professor


Department of CSE, ASET
Production System

A production system consist of:-


• A set of rules, each consisting of a left side (pattern) that determines
the applicability of the rule and a right side describing the operation
to be performed.

• One or more knowledge/databases that contain whatever information


is appropriate for the particular task.

• 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.

• A rule applier which is the computational system that implements


the control strategy and applies the rules.
Amity School of Engineering and Technology

Classes of Production System


•Monotonic production system: the application of a rule
never prevents the later application of another rule that
could also have been applied at the time the first rule was
selected.
•Non-monotonic production system: Is one in which this
is not true.
•Partially commutative production system: the
application of a particular sequence of rules transforms state
x into state y, then any permutation of those rules that is
allowable also transforms state x into state y.
•Commutative production system: system that is both
monotonic and partially commutative.
Amity School of Engineering and Technology

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

1.Uninformed search (blind search)(Exhaustive search)


(Bruteforce)
Having no information about the number of steps from
the current state to the goal.

2.Informed search (heuristic search)


More efficient than uninformed search.
Amity School of Engineering and Technology

Brute Force or Uninformed Search Strategies


• These are commonly used search procedure which
explore all the alternatives during the search process.
• They do not have any domain specific knowledge.
• They need the initial state, the goal state and a set of legal
operators.
• The strategy gives the order in which the search space is
searched
• The followings are example of uninformed search
–Depth First Search (DFS)
–Breadth First Search (BFS)
Amity School of Engineering and Technology

Search Strategies: Blind Search

• 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

Depth First Search

• The search begins by expanding the initial node,


generate all successors of the initial node and test
them.
• Depth-first search always expands the deepest node
in the current frontier of the search tree.
• Depth-first search uses a LIFO approach.
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology

Algorithm for Depth First Search


1. If the initial state is a goal state, quit and return success.
2. Otherwise, do the following until success or failure is
signaled:
1. Generate a successor, E, of the initial state. If there are
no more successors, signal failure.
2. Call Depth-First Search with E as the initial state.
3. If success is returned, signal success. Otherwise
continue in this loop.
Amity School of Engineering and Technology

Time and space complexity

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

Advantages of Depth-First Search


• It requires less memory since only the nodes of the current
path are stored.
• By chance, it may find a solution without examining
much of the search space at all.
Amity School of Engineering and Technology

Disadvantages of Depth-First Search

• Determination of the depth until which the search has to


proceed. This depth is called cut-off depth.
• If the cut-off depth is smaller, solution may not be found.
• If cut-off depth is large, time complexity will be more.
• And there is no guarantee to find a minimal solution, if
more than one solution exists.
Amity School of Engineering and Technology

Breadth First Search

• Searching processes level by level unlike depth first


search which goes deep into the tree.
• An operator is employed to generate all possible
children of a node.
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology

Algorithm of Breadth First Search

1. Create a variable called Node-LIST and set it to the initial


state.
2. Until a goal state is found or Node-LIST is empty:
1. Remove the first element from Node-LIST and call it E.
if Node-LIST was empty, quit.
2. For each way that each rule can match the state
described in E do:
1. Apply the rule to generate a new state,
2. If the new state is a goal state, quit and return this
state.
3. Otherwise, add the new state to the end of Node-
LIST.
Amity School of Engineering and Technology

Time and space complexity

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

Advantages of Breadth-First Search

• 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

Disadvantages of Breadth-First Search

• It requires more memory


• Searching process remembers all unwanted nodes which
is of no practical use for the search.
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

You might also like