You are on page 1of 9

CC3201-Artificial

Intelligence and
Machine Learning
BY

DR. SUNIL KUMAR

PROFESSOR, DEPT OF CCE


Water Jug
Problem
The water Jug Problem, as the name
suggests, is a problem where two
jugs of water are given, say one is a
4-litre one, and the other one is a 3-
litre one, but none of the measuring
markers is mentioned on any of it.
There is a pump available to fill the
jugs with water. How can you
exactly pour 2 litres of water into a
4-litre jug? Assuming that both the
jugs are empty, the task is to find a
solution to pour 2-litre water into a
4-litre jug.
In production rules for the water jug problem, let x
denote a 4-litre jug, and y denote a 3-litre jug, i.e.
x=0,1,2,3,4 or y=0,1,2,3

State Space Start state (0,0)

Representatio Goal state (2,n) from any n

n
Production rules

1.Fill the first jug to its capacity.


2.Fill the second jug to its capacity.
3.Empty the first jug.
4.Empty the second jug.
5.Pour water from the first jug to the second jug until either the first jug is
empty or the second jug is full.
6.Pour water from the second jug to the first jug until either the first jug is
full or the second jug is empty.
Production rules
Three Jug Problem

Suppose that you are given 3 jugs A,B,C with capacities


8,5 and 3 liters respectively but are not calibrated (i.e. no
measuring mark will be there). Jug A is filled with 8 liters
of water. By a series of pouring back and forth among the
3 jugs, divide the 8 liters into 2 equal parts i.e. 4 liters in
jug A and 4 liters in jug B. How?

You might also like