I have a square-based map. Only horizontal and vertical movement is allowed (no diagonals). Movement cost is always 1.
I'm implementing an A* algorithm on that map, using the Manhattan distance as a distance heuristic. Is this heuristic consistent? Can I can avoid checking g(node)
against nodes that are in the CLOSED set?
Edit: By consistent I mean monotonic.
Answer
To actually answer your question: the manhatten distance is consistent when you're constrained to moving vertically/horizonally along an unweighted grid (this can be easily shown by the definition on wikipedia). So yes, in your case you can avoid rechecking nodes in the closed set.
However, once you allow diagonal or any-angle movement, manhatten distance becomes nonadmissible because it overestimates diagonal costs, which necessarily means it's not consistent.
No comments:
Post a Comment