5、ran<0) ran=rand; end ran; ifran<=fitness(1) newpopulation(ranseti,:)=population(1,:); else
6、 forfet=2:popsize if(ran>fitness(fet-1))&&(ran<=fitness(fet))专业知识整理分享WORD格式可编辑 newpopulation(ranseti,:)=population(fet,:); end end endendclearran;newpopulation;%交叉forint=1:2:popsize-1 popmoth=newpopulation(int,:); popfath=newpopul