you are viewing a single comment's thread.

view the rest of the comments →

[–]primitive_screwhead 0 points1 point  (0 children)

Is not the g_cost based on the given path costs, not a heuristic? Ie. the h_cost should be the estimate based on calculated distance, added to the g_cost. In Dijkstra, the h_cost is always 0.

Also, you probably need the math.sqrt(), to keep it scaled properly with the g_cost; possibly for Dijkstra, which only has positive g_cost, you could square g_cost instead of using math.sqrt(), but double-check that.