A-star: heuristic for multiple goals
问题 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 minimal route from selected initial point to any of goal points, which are connected (there is route consisting of goal points between any two goals). Of course there can be obstacles on grid. My solution is quite simple: I'm using A* algorithm with variable heuristic function h(x) - manhattan distance from x to nearest goal point.