2 %> Calculate the length of a subtour of the TSP
7 %> @author Michel Bierlaire
8 %> @date Tue Apr 14 11:39:05 2015
12 %> Calculate the length of a tour
13 %> @param next
for each node, provides the next node in the tour
14 %> @param dist the distance matrix
15 %> @
return l the length of the tour
16 %> @
return m the number of nodes in the tour
21 while (currentnode != 0)
23 if (next(currentnode) == 0)
26 nb = next(currentnode) ;
30 currentnode = next(currentnode) ;
function bestInsert(in next, in dist, in i)
Inserts city i in the best place.
function subtourLength(in next, in dist)
Calculate the length of a tour.
function tspInsertion(in dist, in initialTour)
Compute an halmitonian path using the insertion heuristic.