# How can I define a heuristic function for water jug?

1 view

I am trying to put a water jug problem into a heuristic function but I am finding some problems.

There are 2 jugs, one that can hold 5(x) and others that can hold 3(y) gallons of water. The goal is (y,x)=(0,4).

I can't figure out how to put it into a heuristic function and also I have a doubt about the number of states. If I admit the actions (fill one from the faucet, empty one to the drain, and pour from one to the other until either the receiving jug is full or the pouring jug is empty), there are 15 possible states, but if I consider all the possibilities regarding the number of gallons, there are 24 possibilities. Is that correct?

(0,0)

(3,0)(0,5)

(0,3)(3,5)(3,2)

(3,3) (0,2)

(1,5) (2,0)

(1,0) (2,5)

(0,1) (3,4)

(0,4)

I think that the Heuristic function for this problem can be defined as:

h(x,y) = (x * 5) + (y * 3)

Can anyone explain it to me, please?

max(estimate_from_parent - action_cost, estimate_from_this_node)