Can someone give me an example of a valid heuristic that is not consistent?

In this picture:

enter image description here let h (C) = 1 If f (A) = g (A) + h (A) = 0 + 4 = 4, and f (C) = g (C) + h (C) = 1 + 1 = 2 Then f (C) is NOT greater than or equal to f (A) So this example is consistent and valid, but can someone give me an example of a valid heuristic that is not consistent? you are welcome

+4
source share
1 answer

if you want your heuristic to be valid, you must have h(n) <=h*(n)for each node n, where h*is the real value of the target. In your case, you want:

h(A) <= 4
h(C) <= 3
h(G) <= 0

, , h(G) = 0 h(n) <= cost(n, c) + h(c), node c node c. ,

h(A) <= 1 + h(C)
h(C) <= 3 + h(G) = 3

, h(C) <= 3 , h(A) > 1 + h(C). , , :

h(A) > 1 + h(C)
h(C) <= 3
h(G) = 0

.

h(A) = 4
h(C) = 1
h(G) = 0

.

+4

Source: https://habr.com/ru/post/1609956/


All Articles