% [P,L] = TSPSEARCH(X,M) gives a tour P of length L. X is either a
% coordinate matrix of size Nx2 or Nx3 or a symmetric distance matrix.
% Euclidian distances are used in the coordinate case. M is an integer
% in the range 1 to N. Default is M = 1.
% M nearest neighbour tours are generated from randomly selected starting
% points. Each tour is improved by 2-opt heuristics (pairwise exchange of
% edges) and the best result is selected.
% X = rand(100,2);
% [p,L] = tspsearch(X,100);
% % Optimal tour length 1620
% X = load('hex162.dat');
% [p,L] = tspsearch(X,10);
Jonas Lundgren (2019). TSPSEARCH (https://www.mathworks.com/matlabcentral/fileexchange/71226-tspsearch), MATLAB Central File Exchange. Retrieved .
Create scripts with code, output, and formatted text in a single executable document.