Problems, Problem Spaces, and Search

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 111

Module 1

Chapter 2:
Problems, Problem Spaces ,and Search
Problem:

• A problem, which can be caused for different


reasons,
• if solvable, can usually be solved in a number
of different ways,
• is defined in a number of different ways.
Problem Solving
• It is a process of generating solutions from
observed data.
• A problem is characterized by a:
Set of Goals
Set of Objects
Set of Operations
To build a system or to solve a particular
problem we need to do four things.

1. Define the problem precisely. This definition


must include precise specification of what the
initial situation will be and what final situations
constitute acceptable solutions to the problem
2. Analyze the problem
3. Isolate and represent the task knowledge that
is necessary to solve the problem
4. Choose the best solving technique and apply it
to the particular problem.
Defining the Problem as a State Space Search

Problem solving = Searching for a goal state


• It is a structured method for solving an
unstructured problem.
• This approach consists of number of states.
• The starting of the problem is “Initial State” of
the problem.
• The last point in the problem is called a “Goal
State” or “Final State” of the problem.
“State space is a set of legal positions, starting at
the initial state, using the set of rules to move
from one state to another and attempting to
end up in a goal state”.
Methodology of State Space Approach
1. To represent a problem in structured form using
different states
2. Identify the initial state
3. Identify the goal state
4. Determine the operator for the changing state
5. Represent the knowledge present in the
problem in a convenient form
6. Start from the initial state and search a path to
goal state
Example: To build a program that could “Play Chess”
 We have to first specify the starting position of the chess
board
o Each position can be described by an 8-by-8 array.
o Initial position is the game opening position.
 Rules that define the legal moves
o Legal moves can be described by a set of rules:
Left sides are matched against the current state.
Right sides describe the new resulting state.
 Board positions that represent a win for one side or the
other
o Goal position is any position in which the opponent does
not have a legal move and his or her king is under attack.
 We must make explicit the preciously implicit goal of not
only playing a legal game of chess but also winning the
game, if possible.
• A chessboard consists of 64 squares in a checkerboard pattern.
• There are light colored squares (referred to as white) and dark colored squares
(referred to as black).
• There are 8 rows and columns, referred to as the "rank" and "file", respectively. The
bottom right corner should be a white square.
Naming the squares
• Each square of the chessboard is identified by a
unique coordinate pair:-a letter and a number.
• The vertical columns of squares, called files, are
labeled a through h from White's left
(the queenside) to right (the kingside).
• The horizontal rows of squares, called ranks, are
numbered 1 to 8 starting from White's side of the
board.
• Thus each square has a unique identification of
file letter followed by rank number.
Chess Problem
• Problem of playing chess can be defined as a problem of
moving around in a state space where each state represents
a legal position of the chess board.
• The game start with an initial state described as an 8x8 of
each position contains symbol standing for the appropriate
place in the official chess opening position.
• A set of rules is used to move from one state to another and
attempting to end up on one of a set of final states which is
described as any board position in which the opponent does
not have a legal move as his/her king is under attacks.
• The state space representation is natural for chess. Since
each state corresponds to a board position i.e. artificial well
organized.
• Initial State: Legal chess opening position
• Goal State: Opponent does not have any legal move/king
under attack
Production Rules:
• These rules are used to move around the state
space.
• They can be described easily as a set of rules
consisting of two parts:
1. Left side serves as a pattern to be matching
against the current board position.
2. Right side that serves decides the chess to be
made to the board position to reflect the move.
To describe these rules it is convenient to introduce
a notation for pattern and substitutions:
E.g.:
1. White pawn at square (file1,rank2)
Move pawn from square (file i, rank2) AND square (file i, rank2)
AND
Square (file i,rank3) is empty  To square (file i,rank4)
AND
Square (file i,rank4) is empty

2. White knight at square (file i,rank1)


move Square(1,1) to Square(i-1,3)
AND
Empty Square(i-1,3)

3. White knight at square (1,1)


move Square(1,1) to Square(i-1,3)
AND
Empty Square(i-1,3)
A Water-Jug Problem
“You are given two jugs, a 4-gallon one and
a 3-gallon one. Neither has any
measuring markers on it. There is a
pump that can be used to fill the jugs
with water.
How can you get exactly 2 gallons of water
into 4-gallon jug?”
Solution:
The state space for the problem can be described as a set of
states, where each state represents the number of gallons in
each state.
The game start with the initial state described as a set of ordered
pairs of integers:
• State: (x, y)
– x = number of gallon in 4 gallon jug
– y = number of gallon in 3 gallon jug
x = 0, 1, 2, 3, or 4 y = 0, 1, 2, 3
• Start state: (0, 0) i.e., 4-gallon and 3-gallon jugs is empty
initially.
• Goal state: (2, n) for any n that is 4-gallon jug has 2 gallon of
water and 3-gallon jug has any value from 0-3 since it is not
specified.
• Attempting to end up in a goal state.
Production Rules:
• These rules are used as operators to solve the
problem.
• They are represented as rules whose left sides
are used to describe new state that result from
approaching the rule.
• The solution to the water-jug problem is:
Production System
• The entire procedure for getting a solution for AI
problem can be viewed as “Production System”.
• It provides the desired goal.
• It is a basic building block which describes the AI
problem
• Describes the method of searching the goal.
• Its main components are:
Set of Rules, Knowledge Base, Control Strategy and
A rule applier.
• A Set of Rules:
Each consisting of a left side (a pattern) that
determines the applicability of the rule and
right side that describes the operation to be
performed if the rule is applied.
Knowledge Base :
• It contains whatever information is appropriate
for a particular task.
• Some parts of the database may be permanent,
while the parts of it may pertain only to the
solution of the current problem.
Control Strategy :–
• It specifies the order in which the rules will be
compared to the database and the way of
resolving the conflicts that arise when several
rules match at one.
 The first requirement of a goal control strategy is
that it causes motion; a control strategy that does
not cause motion will never lead to a solution.
The second requirement of a good control
strategy is that it should be systematic.
Rule applier:
Production rule is like below:
if(condition) then
consequence or action
"How to decide which rule to apply next during the process of
searching for a solution to a problem?"
• Requirements of a good search strategy:
1. It causes motion. It must reduce the difference
between current state and goal state.
Otherwise, it will never lead to a solution.
2. It is systematic. Otherwise, it may use more
steps than necessary.
3. It is efficient. Find a good, but not necessarily
the best, answer.
Breadth First Search(BFS)
• One of the Systematic control strategy to solve
the water jug problem.
• Construct a tree with the initial state as its root.
• Generate all the offspring of the root by applying
each of the applicable rules to the initial state.
• Tree may looks like this.
• Now for each leaf node ,generate all its
successors by applying all the rules that are
appropriate.
• The tree at this point looks like this.(Rule 3,4,11
and 12 have been ignored in constructing the
search tree)
• Continue the process until some rule produces a
goal state.
• This process is called BFS.
“Breadth first search is a graph traversal algorithm
that starts traversing the graph from root node
and explores all the neighboring nodes. Then, it
selects the nearest node and explore all the
unexplored nodes. The algorithm follows the
same process for each of the nearest node until it
finds the goal”.
Algorithm : BFS
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 do:
a) Remove the first element from NODE_LIST and
call it E. If NODE_LIST was empty quit.
b)For each way that each rule can match the state
described in E do:
i) Apply the rule to generate a new state
ii) If the new state is goal state, quit and
return this state
iii) Otherwise add the new state to the end of
NODE_LIST
• The data structure used in this algorithm is
QUEUE.
• Explanation of Algorithm:
– Initially put (0,0) state in the queue
– Apply the production rules and generate new
state
– If the new states are not the goal state, (not
generated before and not expanded) then only
add these states to queue.
Depth First Search(DFS)
• There is another way of dealing the Water Jug Problem.
• One should construct a single branched tree until it
yields a solution or until a decision to terminate when
the path is reaching a dead end, produces a previous
state.
• If the branch is larger than the pre-specified unit then
backtracking occurs to the previous state so as to create
another path.
• This is called Chronological Backtracking because the
order in which steps are undone depends only on the
temporal sequence in which the steps were originally
made.
• This procedure is called Depth-First Search.
“Depth first search (DFS) algorithm starts with the initial
node of the graph G, and then goes to deeper and
deeper until we find the goal node or the node which
has no children. The algorithm, then backtracks from
the dead end towards the most recent node that is
yet to be completely unexplored”.
• The data structure which is being used in DFS is stack.
• The process is similar to BFS algorithm.
• In DFS, the edges that leads to an unvisited node are
called discovery edges while the edges that leads to
an already visited node are called block edges.
Algorithm : DFS
1) If the initial state is the goal state, quit return success.
2) Otherwise, do the following until success or failure is
signaled:
a) Generate a successor E of the initial state. If there
are no more successors, signal failure.
b) Call Depth-First Search with E as the initial
state.
c)If success is returned, signal success. Otherwise
continue in this loop.
Advantages of Breadth-First Search

• BFS will not get trapped exploring a blind alley.


– In case of DFS, it may follow a single path for a
very long time until it has no successor.
• If there is a solution for particular problem,
the BFS is generated to find it.
We can find minimal path if there are multiple
solutions for the problem.
Advantages of Depth –First Search

• DFS requires less memory since only the nodes


on the current path are stored.
• Sometimes we may find the solution without
examining much.
Algorithm for Production System:
1. Represent the initial state of the problem
2. If the present state is the goal state then go to
step 5 else go to step 3
3. Choose one of the rules that satisfy the present
state, apply it and change the state to new state.
4. Go to Step 2
5. Print “Goal is reached ” and indicate the search
path from initial state to goal state
6. Stop
Problem Characteristics
In order to choose the most appropriate method
(or a combination of methods) for a particular
problem, it is necessary to analyze the problem
along several key dimensions:
• Is the problem decomposable?
• Can solution steps be ignored or undone?
• Is the universe predictable?
• Is a good solution absolute or relative?
• Is the solution a state or a path?
• What is the role of knowledge?
• Does the task require human-interaction?
• Problem Classification
Is the problem decomposable?
• Can the problem be broken down to smaller
problems to be solved independently?
• Decomposable problem can be solved easily.
• Suppose we want to solve the problem of
computing the expression.
• We can solve this problem by breaking expression
down into smaller problems.
• Each of which can be solved by using a small
collection of specific rules.

45
Ex: A decomposable problem

(x2 + 3x + sin2x.cos2x)dx

x2dx 3xdx sin2x.cos2xdx

(1  cos2x)cos2xdx

cos2xdx cos4xdx

46
Ex2: A simple Blocks World Problem

Start Goal
A

C B

A B C

Blocks World

Assume that the following operators are available:


1. CLEAR(x)  ON(x, Table)
2.CLEAR(x) and CLEAR(y)  ON(x, y)

Where Clear(x) means Block x has nothing on it


ON(x, Table) means Pick up x and put it on the table
ON(x,y) means put x on y 47
A proposed solution for the blocks
problem
ON(B, C) and ON(A, B)

ON(B, C) ON(A, B)

CLEAR(A) ON(A, B)

C B

A B C

48
Can solution steps be ignored or
undone?
• Suppose we are trying to prove a mathematical
theorem.
• We proceed by first proving a lemma that we think
will be useful.
Theorem Proving
A lemma that has been proved can be ignored for
next steps.

Ignorable!
in which solution steps can be ignored.
49
8-Puzzle Problem
• The Problem is 8-Puzzle is a square tray in
which 8 square tiles are placed. The remaining
9th square is uncovered. Each tile has a number
on it. A file that is adjacent to the blank space
can be slide into that space.
• The goal is to transform the starting position
into the goal position by sliding the tiles
around.
• In attempting to solve the 8 puzzle, we might
make a stupid move
• for example; we slide the tile 5 into an empty
space.
• We actually want to slide the tile 6 into empty
space but we can back track and
• undo the first move, sliding tile 5 back to where it
was then we can know tile 6 so mistake and
• still recovered from but not quit as easy as in the
theorem moving problem.
• An additional step must be performed to undo
each incorrect step.
Can solution steps be ignored or
undone?
The 8-Puzzle

2 8 3 1 2 3
1 6 4 8 4
7 5 7 6 5

Moves can be undone and backtracked.


Recoverable!
In which solution steps can be undone
52
Playing Chess
• Now consider the problem of playing chess.
• Suppose a chess playing problem makes a
stupid move and realize a couple of moves later.
• But here solutions steps cannot be undone.
Can solution steps be ignored or
undone?
Playing Chess
Moves cannot be retracted.

Irrecoverable!
In which solution steps can be undone

54
Can solution steps be ignored or
undone?
• Ignorable problems can be solved using a
simple control structure that never backtracks.

• Recoverable problems can be solved using


backtracking.
• Irrecoverable problems can be solved by
recoverable style methods via planning.

55
Is the universe predictable?
The 8-Puzzle
Every time we make a move, we know exactly
what will happen.

Certain outcome!

56
Is the universe predictable?
Playing Bridge
We cannot know exactly where all the cards are
or what the other players will do on their
turns.

Uncertain outcome!

57
Is the universe predictable?
• For certain-outcome problems, planning can
used to generate a sequence of operators that
is guaranteed to lead to a solution.
• For uncertain-outcome problems, a sequence
of generated operators can only have a good
probability of leading to a solution.
Plan revision is made as the plan is carried out
and the necessary feedback is provided.
58
Is a good solution absolute or relative?
Consider the problem of answering questions based on a
database of simple facts such as the following:
1. Marcus was a man.
2. Marcus was a Pompeian.
3. Marcus was born in 40 A.D.
4. All men are mortal.
5. All Pompeians died when the volcano
erupted in 79 A.D.
6. No mortal lives longer than 150 years.
7. It is now 2004 A.D.

59
Is a good solution absolute or relative?
1. Marcus was a man.
2. Marcus was a Pompeian.
3. Marcus was born in 40 A.D.
4. All men are mortal.
5. All Pompeians died when the volcano
erupted in 79 A.D.
6. No mortal lives longer than 150 years.
7. It is now 2004 A.D.

Is Marcus alive?

60
Suppose we ask a question “Is Marcus alive?”
• By representing each of these facts in a formal language such as
predicate logic, and then using formal inference methods we
can fairly easily derive an answer to the question.
Is Marcus alive?
• Since we are interested in the answer to the
question, it does not matter which path we
follow.
• If we do follow one path successfully to the
answer,
• there is no reason to go back and see if some
other path might also lead to a solution.
• These types of problems are called as “Any
path Problems”.
62
Is a good solution absolute or relative?
The Travelling Salesman Problem
• Now consider the Travelling Salesman Problem.
• Our goal is to find the shortest path route that
visits each city exactly once.
• We have to try all paths to find the shortest one.

63
Is a good solution absolute or relative?
• Any-path problems can be solved using
heuristics that suggest good paths to explore.

• For best-path problems, much more


exhaustive search will be performed.

66
Is the solution a state or a path?
Finding a consistent interpretation
“The bank president ate a dish of pasta salad with
the fork”.
– “bank” refers to a financial situation or to a side of a river?
– “dish” or “pasta salad” was eaten?
– Does “pasta salad” contain pasta, as “dog food” does not
contain “dog”?
– Which part of the sentence does “with the fork” modify?
What if “with vegetables” is there?

No record of the processing is necessary.


67
• Because of the interaction among the
interpretations of the constituents of the sentence
some search may be required to find a complete
interpreter for the sentence.
• But to solve the problem of finding the
interpretation we need to produce only the
interpretation itself.
• No record of the processing by which the
interpretation was found is necessary.
Is the solution a state or a path?
The Water Jug Problem
• But with the “water-jug” problem it is not
sufficient to report the final state we have to
show the “path” also.
• So the solution of natural language
understanding problem is a state of the world.
• And the solution of “Water jug” problem is a
path to a state.

69
Is the solution a state or a path?
• A path-solution problem can be reformulated
as a state-solution problem by describing a
state as a partial path to a solution.

• The question is whether that is natural or not.

70
What is the role of knowledge
Playing Chess
Knowledge is important only to constrain the
search for a solution.

Reading Newspaper
Knowledge is required even to be able to
recognize a solution.

71
Does the task require human-interaction?
• Solitary problem, in which there is no
intermediate communication and no demand
for an explanation of the reasoning process.

• Conversational problem, in which


intermediate communication is to provide
either additional assistance to the computer
or additional information to the user.

72
Problem Classification
• There is a variety of problem-solving methods,
but there is no one single way of solving all
problems.

• Not all new problems should be considered as


totally new. Solutions of similar problems can
be exploited.

73
State Space Search: Water Jug Problem

“You are given two jugs, a 4-litre one and a 3-litre


one. Neither has any measuring markers on it.
There is a pump that can be used to fill the jugs
with water. How can you get exactly 2 litres of
water into 4-litre jug.”

74
State Space Search: Water Jug Problem
• State: (x, y)
– x = number of lts in 4 lts jug
– y = number of lts in 3 lts jug
x = 0, 1, 2, 3, or 4 y = 0, 1, 2, 3
• Start state: (0, 0).
• Goal state: (2, n) for any n.
• Attempting to end up in a goal state.
75
State Space Search: Water Jug Problem
1. (x, y)  (4, y)
if x  4
2. (x, y)  (x, 3)
if y  3
3. (x, y)  (x  d, y)
if x  0
4. (x, y)  (x, y  d)
if y  0
76
State Space Search: Water Jug Problem
5. (x, y)  (0, y)
if x  0
6. (x, y)  (x, 0)
if y  0
7. (x, y)  (4, y  (4  x))
if x  y  4, y  0
8. (x, y)  (x  (3  y), 3)
if x  y  3, x  0
77
State Space Search: Water Jug Problem
9. (x, y)  (x  y, 0)
if x  y  4, y  0
10.(x, y)  (0, x  y)
if x  y  3, x  0
11.(0, 2)  (2, 0)

12.(2, y)  (0, y)

78
State Space Search: Water Jug Problem

1. current state = (0, 0)


2. Loop until reaching the goal state (2, 0)
 Apply a rule whose left side matches the current state
 Set the new current state to be the resulting state

(0, 0)
(0, 3) 2
(3, 0) 9
(3, 3) 2
(4, 2) 7
(0, 2) 5
(2, 0) 11
79
Problem: 8-Puzzle
• The 8-Puzzle is a square tray in which 8 square
tiles are placed. The remaining 9th square is
uncovered. Each tile has a number on it. A file
that is adjacent to the blank space can be slide
into that space. The goal is to transform the
starting position into the goal position by
sliding the tiles around.

80
8-Puzzle Problem

• Initial State: Square tray of 3x3 cells


2 8 3
1 6 4
7 5

• Goal State

1 2 3
8 4
7 6 5

81
8-Puzzle Problem Production Rules

1. Tile in square (1,1)


AND Move tile from square (1,1) to (2,1)

Empty square (2,1)


2. Tile in square (1,1)
Move tile from square (1,1) to (1,2)
AND
Empty square (1,2)
3. Tile in square (2,1)
Move tile from square (2,1) to (1,1)
AND
Empty square (1,1)
82
1,1 1,2 1,3

2 3 2

2,1 2,2 2,3

3 4 3

3,1 3,2 3,3

2 3 2

No. of Production Rules :

2 + 3 + 2 + 3 + 4 + 3 + 2 + 3 + 2 = 24

83
2 8 3 2 8 3
IS 1 6 4 1 4
7 5 7 6 5
Step 1 Step 2

2 3 2 3
1 8 4 1 8 4
7 6 5 7 6 5
Step 3 Step 4

1 2 3 1 2 3
8 4 GS 8 4
7 6 5 7 6 5
Step 5 Step 6

84
Travelling Salesman Problem
• The salesman has a list of cities, each of which
he must visit exactly once. There are direct
roads between each pair of cities on the list.
Find the route the salesman should follow for
the shortest possible round trip that both
states and finishes at any one of the cities.

85
Travelling Salesman Problem
• Initial State
– Salesman starting at any arbitrary city in the given list of
cities

• Goal State
– Visiting all cities once and only and reaching his starting
state

86
Production Rules

• Visited(city[i]) AND Not Visited(city[j])


– Traverse(city[i],city[j])
• Visited(city[i],city[j]) AND Not Visited(city[k])
– Traverse(city[j],city[k])
• Visited(city[j],city[i]) AND Not Visited(city[k])
– Traverse(city[i],city[k])
• Visited(city[i],city[j],city[k]) AND Not
Visited(Nil)
– Traverse(city[k],city[i])
87
Towers of Hanoi Problem
• The state space for the problem can be
described as each state representing position
of the disk on each pole the position can be
treated as a stack the length of the stack will
be equal to maximum number of disks each
post can handle. The initial state of the
problem will be any one of the posts will the
certain the number of disks and the other two
will be empty.
88
Towers of Hanoi Problem
• Initial State:
– Full(T1) | Empty(T2) | Empty(T3)
• Goal State:
– Empty(T1) | Full(T2) | Empty (T3)

89
Production Rules
• Top(T1)<Top(T2) • Top(T2)<Top(T3)
– PUSH(POP(T1),T2) – PUSH(POP(T2),T3)
• Top(T2)<Top(T1) • Top(T3)<Top(T2)
– PUSH(POP(T2),T1) – PUSH(POP(T3),T2)
• Top(T1)<Top(T3) • Empty(T1)
– PUSH(POP(T1),T3) – PUSH(POP(T2),T1)
• Top(T3)<Top(T1) • Empty(T1)
– PUSH(POP(T3),T1) – PUSH(POP(T3),T1)

90
Production Rules

• Empty(T2) - PUSH(POP(T1),T3)
• Empty(T2) - PUSH(POP(T3),T2)
• Empty(T3) - PUSH(POP(T1),T3)
• Empty(T3) - PUSH(POP(T2),T3)

91
Monkey & Bananas Problem
• A hungry monkey finds himself in a room in
which a branch of bananas is hanging from the
ceiling. The monkey unfortunately cannot reach
the bananas however in the room there are also
a chair and a stick. The ceiling is just right high so
that a monkey standing on a chair could knock
the bananas down with the stick. The monkey
knows how to move round, carry other things
around reach for the bananas and wave the stick
in the air. What is the best sequence of actions
for the monkey to acquire lunch?

92
State Space

• (M,C,S,F1,F2)
– M: position of the monkey
– C: position of the chair
– S: position of the stick
– F1: 0 or 1 depends on the monkey on the
chair or not
– F2: 0 or 1 depends on the monkey
holding the stick or not
93
Monkey & Bananas Problem

• Initial State (M,C,S,0,0)


– The objects are at different places and
obviously monkey is not on the chair and not
holding the stick
• Goal State (G,G,G,1,1)
– G is the position under bananas and all objects
are under it, monkey is on the chair and
holding stick

94
Production Rules

• (M,C,S,0,0)  (A,C,S,0,0)
• (M,C,S,0,0)  (C,C,S,0,0)
• (M,C,S,0,0)  (S,S,S,0,0)
• (C,C,S,0,0)  (A,A,S,0,0)
• (S,C,S,0,0)  (A,C,A,0,1)
• (S,C,S,0,0)  (C,C,S,0,0)
• (C,C,C,0,1)  (C,C,C,1,1)
• (S,C,S,0,1)  (C,C,C,0,1)

95
Solution
• (M,C,S,0,0)
• (C,C,S,0,0)
• (G,G,S,0,0)
• (S,G,S,0,0)
• (G,G,G,0,0)
• (G,G,G,0,1)
• (G,G,G,1,1)

96
Missionaries and Cannibals
 3 missionaries and 3 cannibals find themselves one
side of the river.
 They have agreed that they would like to get the
other side.
 But the missionaries are not sure what else the
cannibals have agreed to.
 So the missionaries want to manage the trip across
the river on either side of the river is never less than
the number of cannibals who are on the same side.
 The only boat available hold only two people at a
time. How can every one get across without
missionaries risking hang eager?
97
State Space

• (C,M,C1,M1,B)
– C and M are number of cannibals and missionaries
on the starting bank
– C1 and M1 are number of cannibals and
missionaries on the destination bank
– B is the position of the boat wither left bank (L) or
right bank (R)

98
Missionaries and Cannibals

• Initial State
– C=3,M=3,B=L so (3,3,0,0,L)

99
Missionaries and Cannibals

• Goal State
– C1=3, M1=3, B=R so (0,0,3,3,R)

100
Production Systems

• (C,M,C1,M1,L / C=3, M=3)  (C-2,M,C1+2,M1,R)


• (C,M,C1,M1,L / C=3, M=3)  (C-1,M-
1,C1+1,M1+1,R)
• (C,M,C1,M1,L / C=3, M=3)  (C-1,M,C1+1,M1,R)
• (C,M,C1,M1,R / C=1, M=3)  (C+1,M,C1-1,M1,L)
• (C,M,C1,M1,R / C=0, M=3,C1=3,M1=0)
 (C+1,M,C1-1,M1,L)

101
LEFT BANK RIGHT BANK
BOAT
C M C1 M1
POSITION
3 3 0 0
1 3  2 0
2 3  1 0
0 3  3 0
1 3  2 0
1 1  2 2
2 2  1 1
2 0  1 3
3 0  0 3
1 0  2 3
2 0  1 3
0 0  3 3

102
Classification of Production System:
Based on the direction they can be
1. Forward Production System
Moving from Initial State to Goal State
When there are number of goal states and only one
initial state, it is advantage to use forward production
system.
2. Backward Production System
Moving from Goal State to Initial State
If there is only one goal state and many initial states,
it is advantage to use backward production system.
Production System Characteristics
• Production system is a good way to describe the
operations that can be performed in a search for
solution of the problem.
• Two questions we might reasonably ask at this point
are:
Can production systems, like problems, be described
by a set of characteristics that shed some light on
how they can easily be implemented?
 If so, what relationships are there between problem
types and the types of production systems best suited
to solving the problems?
The answer for the first question can be considered with the
following definitions of classes of production systems:
• A monotonic production system is a production system in
which the applications 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.
• A non-monotonic production system is one which this is
not true.
• A partially commutative production system is a production
system with the property that if 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.
• A commutative production system is a production system
that is both monotonic and partially commutative.
• In a formal sense, there is no relationship
between kinds of problems and kinds of
production of systems, since all problems can be
solved by all kinds of systems.
• But in practical sense, there definitely is such a
relationship between kinds of problems and the
kinds of systems that led themselves naturally
to describing those problems.
The following figure shows the four categories of
production systems
• produced by the two dichotomies,
• monotonic versus non-monotonic and
• partially commutative versus non-partially
commutative along with some problems that can
be naturally be solved by each type of system.
• Partially commutative, monotonic production
systems are useful for solving ignorable
problems that involves creating new things
rather than changing old ones generally
ignorable.
• Theorem proving is one example of such a
creative process partially commutative.
• Monotonic production system are important for
a implementation stand point because they can
be implemented without the ability to backtrack
to previous states when it is discovered that an
incorrect path has been followed.
• Non-monotonic, partially commutative
production systems are useful for problems in
which changes occur but can be reversed and in
which order of operations is not critical.
• This is usually the case in physical manipulation
problems such as “Robot navigation on a flat
plane”.
• The 8-puzzle and blocks world problem can be
considered partially commutative production
systems from an implementation point of view
• because they tend to read too much duplication
of individual states during the search process.
• Production systems that are not partially
commutative are useful for many problems in
which changes occur.
For example “Chemical Synthesis”
• Non-partially commutative production system
less likely to produce the same node many times
in the search process.
Cryptarithmetic
• Consider an arithemetic problem represented
in letters

You might also like