Problem Decomposition: Goal Trees, Rule Based Systems, Rule Based Expert Systems. Planning:
STRIPS, Forward and Backward State Space Planning, Goal Stack Planning, Plan Space Planning,
A Unified Framework For Planning. Constraint Satisfaction : N-Queens, Constraint Propagation,
Scene Labeling, Higher order and Directional Consistencies, Backtracking and Look ahead
Strategies.
1. Topic To Be Covered:
Water Jug Problem Solution Using State
Space Search
Jagdamba Education Society's
SND College of Engineering & Research Centre
Department of Computer Engineering
SUBJECT: Artificial Intelligence & Robotics
Lecture No-08(UNIT-02)
Prof.Dhakane Vikas N
2. Water Jug Problem With State Space Search
What is Water Jug Problem?????
The state space for this problem
can be described as of ordered
pair of integers(x, y)
Such that x->0,1,2,3,4
(Representing the number of
gallon or liter of water into the
4-litre jug.)
x->0,1,2,3(Representing the
number of gallon or liter of
water into the 3-litre jug.)
Goal state is (n,2) for any value
of n, since the problem does not
specify how many liters need to
be in the 4-litre Jug
3. Water Jug Problem With State Space Search
General Solution to Water Jug Problem
We want exact 2-litre water into 3-litre jug(X->4-litre Jug & Y->3-liter
Jug)
Step-1:x=0,y=0
Step-2:x=0,y=3
Step-3:x=3,y=0
Step-4:x=3,y=3
Step-5:x=4,y=2
Now, we have to solve this problem using artificial intelligence(Means
,how computer will know that this problem has to solved in particular
way.)
For this we use state Space.
4. Water Jug Problem With State Space Search
Rule Set TO Solve Water Jug Problem Using State Space
We want exact 2-litre water into 3-litre jug(X->4-litre Jug & Y->3-liter Jug)
Rule:1 (For filling X-Jug Completely)
(x, y)->(4,y)
Rule:2 (For filling Y-Jug Completely)
(x, y)->(x,3)
Rule:3 (To take some water out of X)
(x, y)->(x-d, y) when X>0
5. Water Jug Problem With State Space Search
Rule Set TO Solve Water Jug Problem Using State Space
We want exact 2-litre water into 3-litre jug(X->4-litre Jug & Y->3-liter Jug)
Rule:4 (To take some water out of Y)
(x, y)->(x, y-d) when Y>0
Rule:5 (TO Empty X-Completely)
(x, y)->(0,y) when X>0
Rule:6 (TO Empty Y-Completely)
(x, y)->(x,0) when Y>0
6. Water Jug Problem With State Space Search
Rule Set TO Solve Water Jug Problem Using State Space
We want exact 2-litre water into 3-litre jug(X->4-litre Jug & Y->3-liter Jug)
Rule:7 (To Fill X using Y)
(x, y)->(4, y-(4-X)) when Y>0,x+y>=4
Rule:8 (To Fill Y using X)
(x, y)->(x-(3-Y),3) when X>0,x+y>=3
Rule:9 (TO add everything from X& Y into->X )
(x, y)->(x+y,0) when x+y<=4,y>0
Rule:10 (TO add everything from Y&X into->Y )
(x, y)->(0,x+y) when x+y<=3,x>0
7. Water Jug Problem With State Space Search
Solution to Water Jug Problem Using State Space
We want exact 2-litre water into 3-litre jug(X->4-litre Jug & Y->3-liter Jug)
We can apply above rules and solve water jug problem using Graphical or
Tree representation & Another way to solve this is Tabular
Representation.
We will solve WJP using Tabular Representation As Below.
X Y Rules
0 0 -
0 3 (2)
3 0 (9)
3 3 (2)
4 2(DesiredAnswer) (7)
0 2 (5)
2(DesiredAnswer) 0 (9)