Optimization: principles and algorithms, by Michel Bierlaire
getTourList.m
Go to the documentation of this file.
1 %> \file
2 %> Transforms a tour stored as a sequence of cities into a list of successors
3 %>
4 %> @note Called by \ref tspVns
5 %> @note Called by \ref tspInsertionLocalSearch
6 %>
7 %> @author Michel Bierlaire
8 %> @date Wed Apr 15 11:42:31 2015
9 %> @ingroup Algorithms
10 %> @ingroup chap27
11 
12 %>
13 %> Transforms a tour stored as a sequence of cities into a list of successors
14 %> @param sequence tour as a sequence of cities
15 %> @param n number of cities
16 %> @return succ tour stored as a list of successors
17 function succ = getTourList(sequence,n)
18  succ = zeros(n,1) ;
19  p = size(sequence,1) ;
20  for i=1:p-1
21  succ(sequence(i)) = sequence(i+1) ;
22  endfor
23 endfunction
function tspInsertionLocalSearch(in dist, in subtourList)
function getTourList(in sequence, in n)
Transforms a tour stored as a sequence of cities into a list of successors.
function tspVns(in tour, in dist)
Runs the VNS heuristic on the TSP.
Copyright 2015-2016 Michel Bierlaire