www.pudn.com > TWVRP.rar > mutate.m, change:2016-04-20,size:293b


function chrom=mutate(chrom,bestfit,gen) 
% 캯 
g=gen; 
pm=0.05; 
k1=1/(1-pm); 
while g>1&bestfit(g)==bestfit(g-1) 
      k1=k1+k1; 
      g=g-1; 
end 
pm=1-1./k1; 
  
[px,py]=size(chrom); 
for i=1:py 
    if pm>=rand 
         R=randperm(py); 
         chrom(i,R(1))=rand; 
    end 
end