Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'FindShortestTour-Return to first knot' topicStudent Support Forum > General > "FindShortestTour-Return to first knot"

Help | Reply To Topic
Author Comment/Response
Christina
11/28/11 1:01pm

Dear readers,
this is an example from: http://reference.wolfram.com/mathematica/ref/FindShortestTour.html
d = SparseArray[{{1, 2} -> 1, {2, 1} -> 1, {6, 1} -> 1, {6, 2} -> 1, {5, 1} -> 1, {1, 5} -> 1, {2, 6} -> 1, {2, 3} -> 10, {3, 2} -> 10, {3, 5} -> 1, {5, 3} -> 1, {3, 4} -> 1, {4, 3} -> 1, {4, 5} -> 15, {4, 1} -> 1, {5, 4} -> 15, {5, 2} -> 1, {1, 4} -> 1, {2, 5} -> 1, {1, 6} -> 1}, {6, 6}, Infinity];
In: {len, tour} = FindShortestTour[{1, 2, 3, 4, 5, 6}, DistanceFunction -> (d[[#1, #2]] &)]
Out: {6,{1,4,3,5,2,6}}

My question now: Is ist possible to change the input in that way, that at the end of the tour the first knot will also be the last knot. So it would be a travelling salesman problem but with the shortest tour.
Thank u in advanve,
Chrissi

URL: ,
Help | Reply To Topic