A* Algorithm h value determination
Hello to all:
I have been working a bit on A* algorithm recently. The thing troubles me is the fact that h value determination in A* is so baffling yet vital. I mean you not only need to know how to assign h values, but also know how much to assign to. A little value off could mean a big shift in speed and cost. Does anyone have any idea on the general method of determining h value or is there any website that offers such kind of help?
Thanks for help in advance
That''s the thing with heuristics, it''s really only trial and error. You got to just keep trying different algorithms until you find one which works.
If you''re working with a grid, then the best one is probably the manhatten algorithm:
If you''re working with a grid, then the best one is probably the manhatten algorithm:
(x2 - x1) + (y2 - y1)
. You might think the straigh-line algorithm is better (sqrt( (x2 - x1)2 + (y2 - y1)2)
) but that''s generally not the case... That''s just the nature of heuristics. If I had my way, I''d have all of you shot! codeka.com - Just click it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement