1 算法介绍
模型介绍见这里。
2 部分代码
nn=40; % number of citiesasz=10; % area size asx x aszps=3000; % population sizeng=5000; % number of generationpm=0.01; % probability of mutation of exchange 2 random cities in the path (per gene, per genration)pm2=0.02; % probability of mutation of exchange 2 peices of path (per gene, per genration)pmf=0.08; % probability of mutation of flip random pece of pathr=asz*rand(2,nn); % randomly distribute cities% r(1,:) -x coordinaties of cities% r(2,:) -y coordinaties of cities% % uncomment to make circle:% % circle% al1=linspace(0,2*pi,nn+1);% al=al1(1:end-1);% r(1