Optimal Path from source to multiple destinations

In summary, the author has attempted to solve a homework problem using a computer algorithm, but is not sure how to do it efficiently. He suggests looking into simulated annealing for a solution.
  • #1
Potatochip911
318
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
  • #2
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 Potatochip911
  • #3
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?
 
  • #4
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 Potatochip911

1. What is the "Optimal Path from source to multiple destinations" problem?

The "Optimal Path from source to multiple destinations" problem is a mathematical optimization problem that involves finding the most efficient route from a starting point to multiple end points. It is commonly encountered in transportation and logistics, as well as in network routing and scheduling.

2. What factors are considered when determining the optimal path?

The optimal path is determined by considering factors such as distance, time, cost, and any constraints or limitations on the route, such as road closures or traffic conditions. Other factors may also be taken into account, depending on the specific application of the problem.

3. What are some common algorithms used to solve this problem?

Some common algorithms used to solve the "Optimal Path from source to multiple destinations" problem include Dijkstra's algorithm, A* search algorithm, and genetic algorithms. Each algorithm has its own strengths and weaknesses, and the most suitable one will depend on the specific problem and its requirements.

4. How is this problem different from finding the shortest path?

The "Optimal Path from source to multiple destinations" problem is more complex than finding the shortest path between two points. In this problem, multiple destinations need to be reached from a single starting point, and different constraints and factors need to be considered in order to determine the most efficient route.

5. What are some real-world applications of the "Optimal Path from source to multiple destinations" problem?

This problem has a wide range of applications, including route planning for public transportation systems, delivery and supply chain management, and network routing for data and communication networks. It can also be applied to various problem-solving scenarios in fields such as logistics, engineering, and computer science.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Programming and Computer Science
Replies
19
Views
2K
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Programming and Computer Science
Replies
8
Views
2K
  • Special and General Relativity
Replies
7
Views
2K
  • STEM Academic Advising
Replies
27
Views
2K
  • Programming and Computer Science
2
Replies
37
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
3K
  • Special and General Relativity
Replies
5
Views
1K
Back
Top