Page 38 - DCAP506_ARTIFICIAL_INTELLIGENCE
P. 38
Artificial Intelligence
Notes To resolve this we have to build some suppositions not stated in the problem. They are:
1. We can fill a jug from the pump.
2. We can pour water out of a jug to the ground.
3. We can pour water from one jug to another.
4. There is no measuring device available.
The different operators (Production Rules) that are obtainable to solve this problem may be
declared as given in the following Table.
Table 3.1
Rule No. Production Rule Action
1. (i, j) — (4, j) if i < 4. Fill the 4-liter jug, if 4-liter jug is not full.
2. (i, j) — (i, 3) if j < 3. Fill the 3-liter jug, if 3-liter jug is not full.
3. (i, j) — (I – s, j) if i > 0. Pour some water out of the ground, if 4-liter jug is
not empty.
4. (i, j) — (i, j – s) if j > 0. Pour some water out the 3-liter jug, if 3-liter jug is
not empty.
5. (i, j) — (o, j) if j > 0. Empty the 4-liter jug on the ground, if 4-liter jug
is not empty.
6. (i, j) — (i, o) if j > 0. Empty the 3-liter jug on the ground, if 3-liter jug
is not empty.
7. (i, j) — (4, j – (4 – I)) if (i + j) Pour water from the 30-liter jug into the 4-liter jug
< = 4 & j < 0. until the 4-liter jug is full, if the combined content
is > = 4 and 3-liter jug is not empty.
8. (i, j) — (i,(3 – j), 3) if (i + j) > = Pour water from the 4-liter into the 3-liter jug
3 & i > o. until the 3-liter jug is full, if the combined content
is > = 3 and 4-liter jug is not empty.
9. (i, j) — (i + j, 0) if (i + j) > = 4 Pour all the water from the 3-liter jug into the
and i > 0. 4-liter jug if the jug, combined content is < = 4 and
3-liter jug is not empty.
10. (i, j) — (0, i + j) if (i + j) < = 3 Pour all the water from the 4-liter jug into the
and i > 0. 3-liter jug, if the combined content is < = 3 and
4-liter jug is not empty.
For the water jug problem, there are several sequence of operators that will solve the problem,
let us see of them.
Solution 1:
Table 3.2
Liters in the 4-liter jug Liters in the 3-liter jug Rule applied
0 0
4 0 1
1 3 8
1 0 6
0 1 10
4 1 1
2 3 8
32 LOVELY PROFESSIONAL UNIVERSITY