Heuristic for using A* to find the path with the highest gain

前端 未结 1 1662
刺人心
刺人心 2021-01-23 09:40

Suppose that I want to change the logic in A*, trying to find the most useful path (i.e., the one with the highest gain) instead of finding the shortest path (i.e., the one with

相关标签:
1条回答
  • 2021-01-23 10:00

    Your problem is the longest path problem, which is strongly NP-Hard. This means that, not only is there (almost certainly) no fast exact algorithm, but there is also (almost certainly) no good approximate algorithm.

    You will unfortunately either have to brute-force it, or resort to various global optimization techniques, like annealing, genetic programming etc.


    Negating the sign of the edge-weights, as @Charles suggests, will not work, as A* cannot handle negative edge-weights. And other algorithms which can handle negative edge-weights still cannot handle negative cycles.

    0 讨论(0)
提交回复
热议问题