Heuristic function for a water jug

I have a problem with the Hill Climbing algorithm with the Water Jug problem:

Given two jugs, one of which can hold X liters of water, and the other that can hold Y liters of water, determine the number of steps required to get exactly D liters of water in one of the jugs.

In the initial state (X, Y) = (0,0), it can generate some states:

  • (X, Y) = (0, Y)
    or
  • (X, Y) = (X, 0)

And from these states, he can generate others to the final state, which is either (X, D) or (D, Y).

So, can I evaluate the heuristic function for this problem? How to find out which condition is better than others?

Thanks to everyone.

+1
1

(x, y).

: h (s) s = (x, y) = | x-D | + | y ​​- D | (, h (.))

, , , , , ! , , , HC!

h (.)? , (, ) A *, .


"Hill Climbing", :

  • Foothill
    "".

  • , .

  • ,
+2

All Articles