function x=gtsp1(Pkp) % generate a permutation from P_t % generation using node placements [n,m]=size(Pkp); % n==m k=1; while kcc), c=c+1; if c<=n, cc=cc+Pkp(k,c); else cc=cc+Pkp(k,n); break end end if(c<=n), x(k)=c; else, x(k)=n; end k=k+1; ss=0; for j=1:n, if (sum(x==j)==1), ss=ss+Pkp(k,j); Pkp(k,j)=0; end end for j=1:n, if (sum(x==j)==0), if ss<1, Pkp(k,j)=Pkp(k,j)/(1-ss); else Pkp(k,j)=0; end end end end for j=1:(n), if(sum(x==j)==0), x(n)=j; break; end end