Code covered by the BSD License  

Highlights from
TSP solver by CE & BK algorithms

image thumbnail
from TSP solver by CE & BK algorithms by Sebastien PARIS
Solve TSP problems with 2 stochastic solvers : CE & BK algorithms

demo_cemcmc_tsp.m
clear, clc, close all

prob                     = {'random','st70', 'si175','pr76','pr107','pr124','pr136','pr144','pr152','eil101','a280','rd100','gr120','gr202','dsj1000'};

num                      = 2; %9

if(num > 1)

    data                     = prob{num};

    load(data)

    n                        = size(C , 1);
    
    option.V                 = x;
    

else

    n                        = 20;             % number of city

    option.V                 = 10*rand(n , 2);

    C                        = distmat(option.V);

end


option.N                 = 2000;           % number of tours to generate by MCWR

option.b                 = round(10*log10(n))*n;

option.rho               = log10(n)*0.25; %0.5;             % threshold for selectionning the best rho*N paths

option.winjec            = 10;

option.nbinjec           = 1*round(5*log10(n));

option.Kgamma            = 1/200;

option.Kb                = 2/10;

option.Krho              = 1/50;

option.rhomax            = 0.7;

option.KN                = 1*1/10;

option.T_max             = 100000;           % Maximum number of iteration

option.verbose           = 1;


tic,out                  = cemcmc_tsp(C , option);,toc





figure(1)

clf

p1          = plot(option.V(out.X_opt , 1) , option.V(out.X_opt , 2) , 'r' , option.V(: , 1) , option.V( : , 2) ,  '+' , 'markersize' , 8 , 'linewidth' , 2);
        
text(option.V(: , 1) , option.V(: , 2) , num2str((1 : n)' , '%0.0f') , 'fontname' , 'times' , 'fontsize' , 12);

title(sprintf('\\bf{n = %d, N = %d, \\rho=%3.2f, \\gamma_{%d}^{*} = %6.2f}' , n , option.N , option.rho, length(out.St) , out.S_opt) , 'fontsize' , 12 , 'fontname' , 'times');


Contact us at files@mathworks.com