Code covered by the BSD License  

Highlights from
Cross Entropy TSP Solver

image thumbnail
from Cross Entropy TSP Solver by Sebastien PARIS
Solve TSP problem with a CE method.

generation_TSP();
function [] = generation_TSP();

% Generate N tours (realizations) of the Markov Chain Without Remplacement (MCWR).
%
%
% Usage : X   = generation_TSP(P , N , [X1]);
%
% Inputs 
% ------
% 
% P           : State transition probabilities matrix (n x n) (normalized column's sum up to 1).
% N           : Desired number of tours to generate.
% X1          : The start-end state X1=1,...,n, optional (X1 = 1);
%
% Output 
% ------
%
% X           : Generated tours ((n + 1) x N), where (X(1 , :) = X(n + 1 , :). 
%               Each elements of X reprensents an index of the cities
%               coordinates V (n x 2).
%
%
% Example
% -------
%
% n   = 50;
% P   = rand(n);
% P   = P./repmat(sum(P) , n , 1);;
% N   = 30;
% X1  = 1;
% X   = generation_TSP(P , N , X1);
%
% n   = 10;
% Y   = randperm(n);
% P   = zeros(n);
% P((0:n-1)*n + Y) = 1;
% N   = 30;
% X1  = Y(1);
% X   = generation_TSP(P , N , X1);


%   Author : Sbastien PARIS
%   

error('generation_TSP mex file absent, type mex generation_TSP.c to compile');

Contact us at files@mathworks.com