What are some good methods to finding a heuristic for the A* algorithm?

前端 未结 3 354
予麋鹿
予麋鹿 2021-01-03 01:53

You have a map of square tiles where you can move in any of the 8 directions. Given that you have function called cost(tile1, tile2) which tells you the cost of

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-03 02:23

    Yes, the heuristic is dependent on the cost function, in a couple of ways. First, it must be in the same units. Second, you can't have a lower-cost path through actual nodes than the cost of the heuristic.

    In the real world, used for things like navigation on a road network, your heuristic might be "the time a car would take on a direct path at 1.5x the speed limit." The cost for each road segment would use the actual speed limit, which will give a higher cost.

    So, what is your cost function between tiles? Is it based on physical properties, or defined outside of your graph?

提交回复
热议问题