AI Chapter 2
AI Chapter 2
Module 1
Problem Space
A problem space encompasses all valid states that can be generated by the application of any combination of
operators on any combination of objects.
The problem space may contain one or more solutions. A solution is a combination of operations and objects that
achieve the goals.
Search
a. Define a state space that contains all the possible configurations of the
relevant objects, including some impossible ones.
b. Specify one or more states that describe possible situations, from which the
problem solving process may start. These states are called initial states.
c. Specify one or more states that would be acceptable solution to the problem.
These states are called goal states.
The problem can then be solved by using the rules, in combination with an
appropriate control strategy, to move through the problem space until a path from an
initial state to a goal state is found.
Thus:
Search is fundamental to the problem-solving process.
Search is a general mechanism that can be used when a more direct method
is not known.
Search provides the framework into which more direct methods for solving
subparts of a problem can be embedded.
A very large number of AI problems are formulated as search problems.
Problem Space
• A problem space is represented by a directed graph,
where nodes represent search state and paths
represent the operators applied to change the state.
• To simplify search algorithms, it is often
convenient to logically and programmatically GRAPH
represent a problem space as a tree.
• A tree usually decreases the complexity of a search
at a cost.
• Here, the cost is due to duplicating some nodes on
the tree that were linked numerous times in the
graph, e.g. node B and node D.
• A tree is a graph in which any two vertices are
connected by exactly one path.
TREE
• Alternatively, any connected graph with no cycles
is a tree.
DEFINING PROBLEM AS A STATE
State Space Search
SPACE SEARCH
A state space represents a problem in terms of states and operators that change states.
A state space consists of:
• A representation of the states the system can be in.
• For example, in a board game, the board represents the current state of the game.
• A set of operators that can change one state into another state. In a board game, the
operators are the legal moves from any given state. Often the operators are
represented as programs that change a state representation to represent the new state.
• An initial state.
• A set of final states; some of these may be desirable, others undesirable.
This set is often represented implicitly by a program that detects terminal states.
Production System in Artificial
Intelligence
• Since the search process is the core of many artificial
intelligence (AI) processes, it is useful to structure Al
programs in a way that facilitates describing and
performing the search process.
• Production systems in artificial intelligence provide such
structures so that the search process’s performance can
be measured.
• A production system consists of:
• 1. A set of rules, “each consisting of a left side (a
pattern) that determines the applicability of the rule
and a right side that describes the operation to be
performed if the rule is applied.”
• In the Water Jug Problem, Rule (x, y) is x<4 ->(4, Y)
indicates Fill the 4-gallon jug and (x, y) if y<3 -> (x, 3)
indicates Fill the 3-gallon jug.
2. One or more knowledge/databases “that contain
whatever information is appropriate for the particular
task. Some plans of the database may be permanent,
while other plans of it may pertain only to the solution of
the current problem.”
3. 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.”
3. A rule applier.
Classes / Categories of
Production systems
• The production system is mainly categorized into 4 types,
• 1. 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”.
• 2. Non-Monotonic Production system: “is one in which this is
not true”.
• 3. Partially commutative Production system: “It is the
property that if the application of a particular sequence of rules
transforms state x to state y, then permutation of those rules
allowable, also transforms state x into state y.”
• 4. Commutative Production system: “is both monotonic and
Partially commutative”.
Partially Commutative and
Monotonic:
• These production systems are useful for solving
ignorable problems.
• Example: Theorem Proving
• They can be implemented without the ability to
backtrack to previous states when it is discovered that
an incorrect path has been followed.
• This often results in a considerable increase in
efficiency, particularly because since the database will
never have to be restored, It is not necessary to keep
track of where in the search process every change was
made.
Partially Commutative and Non-
Monotonic
• These production systems are useful for solving
problems in which changes occur but can be reversed
and in which order of operations is not critical.
• Example: Robot Navigation, 8-puzzle, blocks
world
• Suppose the robot has the following ops: go North (N),
go East (E), go South (S), go West (W).
• To reach its goal, it does not matter whether the robot
executes the N-N-E or N-E-N.
Not Partially Commutative
Integer amount of water in ‘X’ ltr Jug integer amount of water in ‘Y’ ltrs of Jug
For example:<1,2>
Example of water Jug Problem
Suppose capacity of 2 Jugs 2 Ltrs X
3 Ltrs Y
<2,0>
<0,3>
<2,3>
<2,1>
<2,0>
<0,1>
How can a sequence of boat trips be performed that will get everyone to
the other side of the river without any missionaries being eaten?
State representation: Missionaries/Cannibals Search Graph
1. BOAT position: original (T) or final (NIL) side
of the river.
2. Number of Missionaries and Cannibals on the original
side of the river.
3. Start is (T 3 3); Goal is (NIL 0 0).
(CC 0 2) 2 Cannibals
(M 1 0) 1 Missionary
(C 0 1) 1 Cannibal
Control Strategies
• The word ‘search’ refers to the search for a solution in a problem
space.
• Search proceeds with different types of ‘search control strategies’.
• A strategy is defined by picking the order in which the nodes expand.
• The Search strategies are evaluated along the following dimensions:
Completeness,
Time complexity,
Space complexity
Algorithm’s performance and complexity