| 3 | 1/1 | 返回列表 |
| 查看: 733 | 回復(fù): 2 | ||
shu_fyh新蟲(chóng) (初入文壇)
|
[求助]
求大神幫忙用matlab寫(xiě)一個(gè)關(guān)于遺傳算法的小程序
|
|
本人matlab剛學(xué)習(xí)不久,寫(xiě)的程序無(wú)法運(yùn)行,求大神幫忙修改至可以運(yùn)行 目標(biāo)函數(shù):VRRm=0.2355-0.637*10-4x1+1.85875*10-4x2+0.82225*10-2x3-0.1715x4-1.6725*10-6x1*x2+0.966925*10-4x1*x3+0.403*10-4x2*x3-0.471*10-2x3*x4 1.種群生成 pop_size:種群數(shù)量 chromosome:染色體(每組染色體即代表一個(gè)解) r:[0,1]間的隨機(jī)數(shù) j:不同堆垛方案所決定的決定變量(stckopile length、stockpile height、stacker speed、stockpile type) xupp、xlow分別表示各個(gè)變量的上下限 過(guò)程:for i=1,pop_size chromosomei=xj=(rij*(xuppj-xlowj))+xlowj End 種群選擇(輪盤(pán)賭) 過(guò)程:for i=1,pop_size E(vi)=a(1-a)i-1 end if i=0 then q0=0 else qi= endif generate a random number r between [0,qpop_size] if qi-1<r<qi then Vi is slected endif continute untill pop_size reached 交叉和變異 Pc:交叉概率 for i=1,pop_size generate a random number ri between [0,1] if ri<Pc, then Vi is selected as a parent qj end if clear i clear j if j is odd then qj is removed end if Q=Q(randperm(numel(q))) generate a random number r between [0,1] for i=1,j then xi=r*Qi+(1-r)*Qi+j/2 xi+j/2=(1-r)*Qi+r*Qi+j/2 End Pm:變異概率 generate a random number ri between [0,1] if ri<Pm, then Vi is selected as a parent qj end if for i=1,j xi=qi+M*d end 每一組方案的可行性分析 generate a random number, ra sum=1. for j=1, jvar-1 xj = (ra*(xuppj– xlowj))+xlowj sum=sum*xj end sp=(cap /sum)**(1.0 /(nvari-1)) for m=1,jvar-1 xm=xm*sp if (xm>xlowmr.and.xm<xuppm)feasible otherwise unfeasible and go to generate a number, ra end continue until population-size is reached |

新蟲(chóng) (初入文壇)
| 3 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 291 求調(diào)劑 +3 | 化工2026屆畢業(yè)?/a> 2026-03-21 | 3/150 |
|
|---|---|---|---|---|
|
[考研] 318求調(diào)劑 +4 | plum李子 2026-03-21 | 7/350 |
|
|
[考研] 求調(diào)劑 +5 | Zhangbod 2026-03-21 | 7/350 |
|
|
[考研] 求調(diào)劑 +4 | 要好好無(wú)聊 2026-03-21 | 4/200 |
|
|
[考研] 299求調(diào)劑 +4 | 某某某某位 2026-03-21 | 4/200 |
|
|
[考研] 268求調(diào)劑 +9 | 簡(jiǎn)單點(diǎn)0 2026-03-17 | 9/450 |
|
|
[考研] 265求調(diào)劑 +12 | 梁梁校校 2026-03-19 | 14/700 |
|
|
[考研] 332求調(diào)劑 +3 | 鳳凰院丁真 2026-03-20 | 3/150 |
|
|
[考研] 307求調(diào)劑 +3 | wyyyqx 2026-03-17 | 3/150 |
|
|
[考研] 083200學(xué)碩321分一志愿暨南大學(xué)求調(diào)劑 +3 | innocenceF 2026-03-17 | 3/150 |
|
|
[考研] 265求調(diào)劑 +9 | 梁梁校校 2026-03-17 | 9/450 |
|
|
[考研] 一志愿 西北大學(xué) ,070300化學(xué)學(xué)碩,總分287,雙非一本,求調(diào)劑。 +3 | 晨昏線與星海 2026-03-18 | 3/150 |
|
|
[考研] 材料專(zhuān)碩英一數(shù)二306 +7 | z1z2z3879 2026-03-18 | 7/350 |
|
|
[考研] 085600材料與化工 +8 | 安全上岸! 2026-03-16 | 8/400 |
|
|
[考研] 350求調(diào)劑 +5 | weudhdk 2026-03-19 | 5/250 |
|
|
[考研] A區(qū)線材料學(xué)調(diào)劑 +5 | 周周無(wú)極 2026-03-20 | 5/250 |
|
|
[考研] 08工學(xué)調(diào)劑 +5 | 用戶573181 2026-03-20 | 5/250 |
|
|
[考研] 0703化學(xué)調(diào)劑 +4 | 18889395102 2026-03-18 | 4/200 |
|
|
[考研] 本科鄭州大學(xué)物理學(xué)院,一志愿華科070200學(xué)碩,346求調(diào)劑 +4 | 我不是一根蔥 2026-03-18 | 4/200 |
|
|
[考研] 一志愿蘇州大學(xué)材料工程(085601)專(zhuān)碩有科研經(jīng)歷三項(xiàng)國(guó)獎(jiǎng)兩個(gè)實(shí)用型專(zhuān)利一項(xiàng)省級(jí)立項(xiàng) +6 | 大火山小火山 2026-03-16 | 8/400 |
|