Optimal Path from source to multiple destinations

Click For Summary

Discussion Overview

The discussion revolves around finding an optimal path in a 2-dimensional labyrinth from a starting location to multiple goal locations using the A* algorithm. Participants explore the challenges of adapting A* for multiple destinations and consider alternative approaches for approximating solutions.

Discussion Character

  • Homework-related
  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes their current approach using A* to find the shortest path to the nearest goal, but acknowledges it leads to suboptimal paths due to its greedy nature.
  • Another participant suggests that the problem of finding the shortest path to all goals is akin to the traveling salesman problem, indicating that there is no straightforward solution for optimal paths.
  • Some participants propose that for small numbers of goals, checking all possible orders of goals could yield a solution.
  • A later reply raises the idea of seeking a reasonably accurate approximation instead of the optimal path, suggesting that this could be achieved with less resolution in the optimization process.
  • One participant recommends exploring simulated annealing as a potential method for finding approximations, emphasizing the importance of escaping local minima to find a global minimum.

Areas of Agreement / Disagreement

Participants express a consensus that the problem is complex and does not have a guaranteed optimal solution. There is agreement on the potential for approximations, but no consensus on the best method to achieve this.

Contextual Notes

The discussion highlights the limitations of the A* algorithm when applied to multiple goals and the challenges of defining a goal state in this context. The relationship to the traveling salesman problem is noted, along with the implications for computational complexity.

Potatochip911
Messages
317
Reaction score
3

Homework Statement


You are placed in a 2-dimensional labyrinth at a starting location ##s## and must travel to n goal locations ##g_1, g_2, ..., g_n##. Determine the optimal path using the A* algorithm.

g = goal cell, s = start cell
example input:
3 11 //row length, column length
# # # # # # # # # # #
# g - - s - g - g - #
# # # # # # # # # # #example output:
# # # # # # # # # # #
# 1 2 2 2 1 1 1 1 0 #
# # # # # # # # # # #

numbers represent how many times that square was traveled over.

Homework Equations


A* Algorithm

The Attempt at a Solution



What I've currently managed to do is scan in the labyrinth, record the starting position, and create a list of all the goal locations. Then I determine which flag to travel to by checking which one is closest to the starting location and performing an A* search towards that location using Manhattan distance as the heuristic then setting my start location to the flag and repeating this operation for the next closest goal. Repeating this step ##n## times creates the path. Unfortunately, this is essentially just a greedy algorithm using A* to find the shortest path between two locations in the labyrinth and in my example it will fail to find the shortest path as it will take the path (first goal to the right of start location)->(second goal to the right of start location)->(first goal on the left of start location) resulting in it taking a longer path back to the unvisited goal(s).

I would like to remove the greedy algorithm part of picking the closest goal as the target and then just traveling to that goal location (rinse and repeat) by creating an actual heuristic to determine the fastest path between all of the goals however I have no clue how to go about doing this. For example I am completely clueless as to what the goal state would be for this since it no longer becomes reaching a single goal destination.

If someone could point me in the right direction that would be great!
 
Physics news on Phys.org
A* will give you the shortest path between two given points, but the general problem of the shortest path reaching all goals should be equivalent to the traveling salesman problem, which means there is no easy solution that is guaranteed to find the optimal path.
For small n you can simply check all options (all possible orders of the goals to travel to).
 
  • Like
Likes   Reactions: Potatochip911
mfb said:
A* will give you the shortest path between two given points, but the general problem of the shortest path reaching all goals should be equivalent to the traveling salesman problem, which means there is no easy solution that is guaranteed to find the optimal path.
For small n you can simply check all options (all possible orders of the goals to travel to).
Ok makes sense. What if instead of the optimal path we are interested in a reasonably accurate approximation?
 
Potatochip911 said:
Ok makes sense. What if instead of the optimal path we are interested in a reasonably accurate approximation?
the same logic applies.

a reasonably accurate prediction is just a form of optimization, its just not the ideal optimization. A reasonably accurate approximation can be found by following the same techniques used to find the ideal optimization, just with less resolution (for example if you need to decrease run-time).If you are looking for an easy to implement solution, look into simulated annealing.
The trick to finding a global minimum is to escape the local minimum.
 
  • Like
Likes   Reactions: Potatochip911

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
3
Views
4K
Replies
1
Views
1K
Replies
1
Views
3K
Replies
5
Views
3K