Water Jug Problem Algorithm
Water Jug Problem:
In the water jug problem in AI, We are given two jugs, a four-gallon one and a three-gallon one. Neither has any measuring markers on it. There is a pump that can be used to fill the jugs with water. How can we get exactly two gallons of water into the four-gallon jug?
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, or 4 and y=0, 1, 2, or 3. Here x is the number of a gallon of water in the four-gallon jug and y is the quantity of water in the three-gallon jug.
Start State : (0,0)
Goal State : (2,n) for any value of n
Water Jug Problem in AI:
In AI, the water jug problem algorithm is given below:
|Gallons in the 4-Gallon jug||Gallons in the 3-Gallon jug||Rule Applied|