Generating all possible combinations of route in a graph?

Started by
14 comments, last by lucky6969b 7 years, 6 months ago

The result is stored as a single matrix indicating the total cost for the path between any two nodes. Reconstructing the paths from this information is very easy.

Yes, storing ONLY the optimal distances between all paths is relatively small. But often it is also nearly useless by itself.

Reconstructing the paths is not always "very easy" as you blithely commented. For scenarios such as a small game level's map it can be easy, but for other scenarios it can require significant processing; for moderate searches it can become something that is no longer approachable realtime in a game, or outside of games becoming something that is an hours-long process.

Advertisement

The result is stored as a single matrix indicating the total cost for the path between any two nodes. Reconstructing the paths from this information is very easy.


Yes, storing ONLY the optimal distances between all paths is relatively small. But often it is also nearly useless by itself.

Reconstructing the paths is not always "very easy" as you blithely commented. For scenarios such as a small game level's map it can be easy, but for other scenarios it can require significant processing; for moderate searches it can become something that is no longer approachable realtime in a game, or outside of games becoming something that is an hours-long process.


You just need to move to the neighbor that minimizes the sum of cost from here to neighbor and cost from neighbor to destination. What's a realistic scenario where that is difficult implement or expensive to run?
Like Alvaro says: You basically just run A* with no open/closed sets because you immediately know what the best step is every time (since the costs in the matrix are true costs, not a heuristic).

Sorry, I should have clarified this.

Let's say I had waypoints A, B, C and D

I want to find the shortest path which must go thru each of them.

As my own solution is first from the starting node,

I build links connecting the start node and other "destinations",

and each one connecting other ones.

So I do a dijkstra flood fill on it, then I had a weighted graph at last.

Then when I do an astar on it, but I add one thing to this astar algorithm,

which is I push all nodes into a vector, the astar must be emptied before exiting out of the

loop rather than checking on the size of the opened list.

I am not sure if this works. But I came up with this during bedtime.

Just brainstorming....

Thanks

Jack

Let's say I had waypoints A, B, C and D
I want to find the shortest path which must go thru each of them.


Do you mean the travelling salesman problem (find the sequence out of all permutations that has the shortest total path)?

Or just go to points A, B, C, D in that sequence, within a more complicated graph?

Okay, I looked it up in wiki, I think it is the travelling salesman problem.

But I never knew it was that complex.

Thanks

Jack

This topic is closed to new replies.

Advertisement