91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

用遺傳算法求函數(shù)f=x+10*sin(5*x)+7*cos(4*x)的最大值點:簡單的單點交叉、基本位變異、賭輪盤選擇、隨機產(chǎn)生初始種群中的個體,求的最好解是24.689。注:本算法基于matlab7.0,是我自己編寫的,每個步驟都有詳細的說明。適用于遺傳算法初學(xué)者。

資源截圖

代碼片段和文件信息

function[child1child2]=crossover(parent1parent2pc);%單點交叉
popsize=100;stringlength=20;
a=0;b=9;
if(rand????cpoint=round(rand*(stringlength-2))+1;
????child1(:1:cpoint)=parent1(:1:cpoint);
????child1(:cpoint+1:stringlength+2)=parent2(:cpoint+1:stringlength+2);
????child2(:1:cpoint)=parent2(:1:cpoint);
????child2(:cpoint+1:stringlength+2)=parent1(:cpoint+1:stringlength+2);
????for?i=1:stringlength
????????if?child1(:i)==1
?????????child1(:stringlength+1)=child1(:stringlength+1)+2^(stringlength-i);
???????end
????end
????child1(:stringlength+1)=child1(:stringlength+1)*(b-a)/(2^stringlength-1)+a;
????for?j=1:stringlength
????????if?child2(:j)==1
??????????child2(:stringlength+1)=child2(:stringlength+1)+2^(stringlength-j);
????????end
????end
????child2(:stringlength+1)=child2(:stringlength+1)*(b-a)/(2^stringlength-1)+a;
????child1(:stringlength+2)=fun(child1(:stringlength+1));
????child2(:stringlength+2)=fun(child2(:stringlength+1));
else
????child1=parent1;
????child2=parent2;
end

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????1053??2009-06-23?19:56??xujinpeng3.14\crossover.m

?????文件?????????59??2009-06-23?19:55??xujinpeng3.14\fun.m

?????文件???????1684??2009-06-23?19:58??xujinpeng3.14\ga.m

?????文件????????452??2009-06-23?19:57??xujinpeng3.14\initialise.m

?????文件????????433??2009-06-23?19:57??xujinpeng3.14\mutation.m

?????文件????????405??2009-06-23?19:58??xujinpeng3.14\roulette.m

?????文件????????147??2009-09-29?20:50??xujinpeng3.14\說明.txt

?????目錄??????????0??2009-10-27?15:35??xujinpeng3.14

-----------?---------??----------?-----??----

?????????????????4233????????????????????8


評論

共有 條評論