You are on page 1of 2

Digital Assignment - 1

Course name: Artificial Intelligence


Course code: ITE2010
Class No.: VL2023240102494

Name: Nimish Jain


Reg No.: 20BIT0270

Question:
Develop all production for the following water jug problem:

You are given two jugs, 6-gallon one and a 5-gallon one. Neither has any measuring 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 into a 6-gallon jug?

Answer:
The state space for this problem can be described as the set of ordered pairs of integers (x , y ),
such that x=0,1,2,3,4,5∨6 and y=1,2,3,4∨5 .
x represents the number of gallons of water in the 6-gallon jug.
y represents the number of gallons of water in the 5-gallon jug.

Start state = (0,0)


Goal state = (2 , y)

Production rules:

Current state
Rule No. New state Description
with condition

(x , y ) Fill the 6-gallon jug completely with


1. (6 , y )
if x <6 water.

(x , y ) Fill the 5-gallon jug completely with


2. (x ,5)
if y <5 water.

(x , y ) Pour some water out of the 6-gallon


3. (x−d , y )
if x >0 jug onto the ground.

(x , y ) Pour some water out of the 5-gallon


4. (x , y −d )
if y >0 jug onto the ground.

(x , y ) Empty the 6-gallon jug into the


5. (0 , y )
if x >0 ground.
(x , y ) Empty the 5-gallon jug into the
6. (x ,0)
if y >0 ground.

(x , y ) Pour water from the 5-gallon jug into


7. if x + y ≥ 6 (6 , y−(6−x)) the 6-gallon jug until the 6-gallon jug
and y >0 is full.

(x , y ) Pour water from the 6-gallon jug into


8. if x + y ≥ 5 (x−(5− y ), y) the 5-gallon jug until the 5-gallon jug
and x >0 is full.

(x , y )
Pour all the water from the 5-gallon
9. if x + y ≤ 6 (x + y , 0)
jug into the 6-gallon jug.
and y >0

(x , y )
Pour all the water from the 6-gallon
10. if x + y ≤ 5 (0 , x+ y)
jug into the 5-gallon jug.
and x >0

Pour 2 gallons of water from the 5-


11. (0,2) (2,0)
gallon jug into the 6-gallon jug.

Empty the 2 gallons of water from the


12. (2 , y) (0 , y )
6-gallon jug onto the ground.

You might also like