A-star: heuristic for multiple goals

前端 未结 3 1434
情话喂你
情话喂你 2020-12-19 04:47

Let\'s consider a simple grid, where any point is connected with at most 4 other points (North-East-West-South neighborhood).

I have to write program, that computes

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-19 05:25

    How many goals, tens or thousands? If tens your way will work fine, if thousands then nearest neighbor search will give you ideas on setting up your data to search quickly.

    The tradeoffs are obvious, spatially organizing your data to search will take time and on small sets brute force will be simpler to maintain. Since you're constantly evaluating I think that structuring the data will be worthwhile at very low numbers of points.

    An alternate way to do this would be a modified flood fill algorithm that stops once it reaches a destination point during the flood.

提交回复
热议问题