I'm still trying to figure out how and why my heuristics choices affect the search time of my a* implementation.
I have my map as follows ( not exact size ):
###########
# #
# # # # # #
# #
# # # # # #
# #
I chose my heuristics as
option 1: h = abs(n.x - target.x) + abs(n.y - target.y)
option 2: h = 2*(abs(n.x- target.x) + abs(n.y - target.y))
with option 1
, the algorithm runs relatively fine until I have to move from top to bottom, and in that case it takes long to come up with the path.
with option 2
, the option 1
time is improved by around 90%.
I tried to read about overestimation/underestimation, and I couldn't come up with a clear explanation.
What could be the reason? also, are my choices reasonable?