You are on page 1of 4

KNOWLEDGE-BASED PROBLEM SOLVING - 1:

RULE-BASED PROBLEM SOLVING


%---------------------------------------------------------------------------World Knowledge
World knowledge can be of many kinds, e.g., associative, episodic and
semantic.
One kind of world knowledge is knowledge about the possible actions in
a given world.
Example: The Water Jug Problem
Problem: You are given two jugs, a 4-gallon one and a 3-gallon
one. Neither has any measuering marks 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 in the 4-gallon jug?
In the water jug problem, one possible action is to pump water into
the 4 gallon jug until the jug is full.
%---------------------------------------Knowledge Representation
A state in this problem may be represented as a two-tuple (x,y),
where:
x stands for the amount of water in the 4-gallon jug, and
y denotes the amount of water in the 3-gallon jug.
The initial state is <0,0> and the goal state is (2,0)
An operator (i.e., knowledge of an action possible in the world) can
be represented in the LANGUAGE of PRODUCTION RULES.
For this example, all ten basic operations in the water jug problem
can be represented in the language of production rules as follows:
R1: (x,y) --> (4,y)
if x < 4
R2: (x,y) --> (x,3)
if y < 3
R3: (x,y) --> (x-d,y)
if x > 0
R4: (x,y) --> (x,y-d)
if y > 0
R5: (x,y) --> (0,y)
if x > 0

R6: (x,y) --> (x,0)


if y > 0
R7: (x,y) --> (4,y-(4-x))
if x+y >= 4 and y > 0
R8: (x,y) --> (x-(3-y),y)
if x+y >= 3 and x > 0
R9: (x,y) --> (x+y,0)
if x+y =< 4 and y > 0
R10: (x,y) --> (0,x+y)
if x+y =< 3 and x > 0
The general form of productions looks like this:
<antecendent1, antecedent2, ... antecedentN>
(condition1, condition2, ...)
---> (consequent1, consequent2, consequentM)
where the conditions on the antecedents specify the applicability of
an operation
Note that production rules offer one language for representing
ASSOCIATIVE knowledge including that of operations (that is, knowledge
of the actions that can be performed in the world).
%---------------------------------------------------------------------------Control in Rule-Based Problem Solving
In addition to world knowledge, problem solving requires control
knowledge which helps decide what to next (e.g., which state to expand
next, which operator to apply among the applicable operators etc.)
Different kinds of control knowledge make for different search
strategies and can give rise to quite different solutions.
The control strategy of rule-based problem solving consists of four
main steps:
(i) Match the antecedents and conditions of the available production
rules with the current state, and select the applicable rules.
(ii) If more than one rule is applicable, then select a rule based on
two factors:
(a) the problem solving should cause some change to the current state
(b) the problem solving should not go back to a previous state
(iii) If, after consideration of the above two factors, more than one
rule is applicable to the current state, then select a rule at random
(iv) apply the selected rule to the current state, go to the next state,
and repeat the process.

The application of this strategy gives the following possible solution


to the water jug problem:
x

s1

s2

s3

s4

s5

s6

Rule
applied
R2
R9
R2
R7
R5
R9

s7

%---------------------------------------------------------------------------Representation of Problem Solving


The problem space is a ``virtual'' space that can be generated by
applying combinations of the operators. Problem solving, i.e., search
through a problem space, can be represented as a tree.
The problem solving in the water jug example can be represented as the
following tree:
<0,0>
/ \
R1 R2
<0,3>
/ |...\
/ |... \
R1 R4... R9
<3,0>
/ | \
/ | \
R2 R3 R5
<3,3>
/ |...\...
/ |... \...
R1 R3 R7
<4,2>
/ |...\...
/ |... \...

R2 R3 R5
<0,2>
/ | \
/ | \
R1 R7 R9
<2,0>
%---------------------------------------------------------------------------Production Systems
A production system consists of three main elements: (i) a rule base,
(ii) a rule applier and selector that instantiates the control
strategy, and (iii) a working memory that keeps track of the current
state of problem solving.
The working memory may maintain information about the original goal,
the current subgoal, and the current state.

You might also like