Need an idea for A star search algorithm with multiple goals

前端 未结 3 912
孤街浪徒
孤街浪徒 2020-12-19 19:56

The algorithm of A star search with a specified goal is pretty straightforward. However, what if there are multiple goals in a graph. For instance; you may want to find a sh

3条回答
  •  心在旅途
    2020-12-19 20:20

    Hmm.. Compute shortest paths from S->A, S->B, S->C, select the shortest (say to B), compute shortest path from B->C and B->A, select the shortest (say C), compute shortest path C to A. Then add the paths together.

    [Edit] Ok its not quite that simple. I think you could use A* to evalute shortest paths for all permutations between Start, A, B, C (which includes S->every node in the goal sets, each node in A to each in B etc.) and pick the shortest combination.

提交回复
热议问题