• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Algorithmatic problem

GiLtY

Golden Member
I'm bored, so here's a problem (still trying to figure out the best way to solve this problem):

On a map dictated by x-y coordinates stations are randomly placed on the map, and you are a train operator that drives the train. At the beginning of every travel you are starting at a different station (picked at random); however, you have the knowledge of the x-y coordinates of all the stations. The problem is to go through all of the train stations once and once only, but you have to pick out a route that provides the shortest total travel distance.

Have fun with the problem 🙂

--GiLtY
 
To the Highly Technical forum with you.

Our tired brains = not compute.

But this does remind me of the time when I couldn't stop trying to figure out which type of mowing pattern would take the least amount of time to finish the yard.
 
I didn't give this a lot of thought so I'm probably missing something, but the obvious answer is just to always go to the station closest to your current station, barring any station you've already been to.

Or, let a computer solve it.

dfi
 
This is a special case the Hamiliton graph cycles, and Hamiltion is NP-hard. Thus, by reduction, TSP is NP-hard.

Where is my cookie?
 
Originally posted by: dfi
I didn't give this a lot of thought so I'm probably missing something, but the obvious answer is just to always go to the station closest to your current station, barring any station you've already been to.

Or, let a computer solve it.

dfi

Greedy algorithms won't work.

IE.
A to B = 4
B to C = 10
C to D = 5
A to D = 1
B to D = 6

Using your method, starting at A, you go to D then C and lasty B, summing to 16. An obvious shorter path is 15, A to B then D ending at C.
 
Being that we are in the year 2004, I would key all the coords into my Navi/GPS system (sorting by shortest distance) and follow the on-screen routing!
 
depending on how many nodes there are i would probably brute force it using some recursive algorithm starting from every point to return a list of routes given the starting point. at least thats the easiest way I can solve your problem.
 
Brute force method. Just compute all the possibilities and select the shortest. Until somebody comes with a better method I'm the winnah.
 
np-complete , no cookie for you. Stop getting problems out of your textbooks😀 and posting them here.

Oh this could b "solved" using DNA computing as well.


Edit: On a side note I will start doing research next semester on combinatorial optimaztion.So I will post the answer in a few months:laugh:
 
There are other more efficient methods than the Brute Force Method... You can try giving each node a weight and based on that come up with an algorithm... (don't remember the names off the top of my head)
 
Originally posted by: Argo
Brute force method. Just compute all the possibilities and select the shortest. Until somebody comes with a better method I'm the winnah.

Yeah, as long as there aren't too many nodes, a brute force algo would be fine really. There's no "easy" way to solve this AFAIK.
 
Originally posted by: Argo
Brute force method. Just compute all the possibilities and select the shortest. Until somebody comes with a better method I'm the winnah.

i beat you by 2 minutes woman! im the winnar!
 
Originally posted by: bleeb
There are other more efficient methods than the Brute Force Method... You can try giving each node a weight and based on that come up with an algorithm... (don't remember the names off the top of my head)

If you remember the names of any of these post them here. Is there a way to try weights, and then based on some results, figure out how to properly readjust them to "move" towards the solution?
 
Back
Top