Water Jug Problem in Artificial Intelligence
😦 What is a Water Jug Problem?
You are given two jugs, a 4-gallon jug, and a 3-gallon jug. Neither has any measuring marks on it. There is a pump that can be used to fill the jugs with water. How can you fill exactly 2 gallons of water into the 4-gallon jug?
To solve this problem we will make some assumptions:
- There is an infinite amount of water supply.
- We can fill/empty jugs completely.
Here, let’s consider the initial state (both jugs empty) as (0, 0), and the final goal state will be (2, n) where n can have any value and the 4-gallon jug has 2-gallons of water in it.
Let the state space for this problem be denoted by a set of ordered pairs of integers (C1, C2), where C1 and C2 represent the quantity of water, and C1 = {0, 1, 2, 3, 4} and C2 = {0, 1, 2, 3}.
Defining a set of rules that will help us solve this problem.

There can be different approaches to solve this problem, one of the approaches is as follows:
