user1319449
user1319449

Reputation: 31

Shortest path A to B taking in specific points

I have a set of N points for which I have coordinates (Ordnance Survey grid references). I want to start at point A and finish at point B and visit all the other points along the way, with the least travel time.

I have acquired Mathematica 9 but I am struggling with it. I tried FindShortestTour but that wants to take me back to my starting point. Any suggestions?

Upvotes: 0

Views: 151

Answers (1)

Dmitrii Bychenko
Dmitrii Bychenko

Reputation: 186668

Your problem is a variation of "Traveling Salesman Problem".

The suggestion is to induce FindShortestTour function to include BA edge into the tour and then remove BA from the solution: manually set BA edge being, say, -1000; find the shortest tour (check that BA is in the solution!) and finally remove BA edge: add 1000 to compensate -1000 you've initially set.

Upvotes: 1

Related Questions