Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

i) Representing the problem as a state-space problem:

- States: The state in this problem can be defined by the amount of water in each jug. So,
we have two jugs, Jug A with a capacity of 4 gallons and Jug B with a capacity of 3 gallons.
Each state can be represented as (x, y), where x is the amount of water in Jug A and y is the
amount of water in Jug B. The initial state is (0, 0), and the goal state is (2, _), where _
represents any amount of water in Jug B.
- Operators/Moves:
1. Fill Jug A: Fills Jug A to its maximum capacity.
2. Fill Jug B: Fills Jug B to its maximum capacity.
3. Empty Jug A: Empties the contents of Jug A.
4. Empty Jug B: Empties the contents of Jug B.
5. Pour from Jug A to Jug B: Transfers water from Jug A to Jug B until Jug B is full or Jug A is
empty.
6. Pour from Jug B to Jug A: Transfers water from Jug B to Jug A until Jug A is full or Jug B is
empty.

ii) Showing a solution path:


Starting from the initial state (0, 0), we can follow these steps to reach the goal state (2, _):

1. Fill Jug A: (4, 0)


2. Pour from Jug A to Jug B: (1, 3)
3. Empty Jug B: (1, 0)
4. Pour from Jug A to Jug B: (0, 1)
5. Fill Jug A: (4, 1)
6. Pour from Jug A to Jug B: (2, 3)

At this point, we have 2 gallons of water in Jug A, which is the goal state.

iii) Alternative solution path:


There is an alternative solution path:

Starting from the initial state (0, 0), we can follow these steps to reach the goal state (2, _):

1. Fill Jug B: (0, 3)


2. Pour from Jug B to Jug A: (3, 0)
3. Fill Jug B: (3, 3)
4. Pour from Jug B to Jug A: (4, 2)

Again, we have 2 gallons of water in Jug A, which is the goal state.

You might also like