| 5 | 1/1 | 返回列表 |
| 查看: 737 | 回復(fù): 2 | ||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | ||
shu_fyh新蟲 (初入文壇)
|
[求助]
求大神幫忙用matlab寫一個(gè)關(guān)于遺傳算法的小程序
|
|
|
本人matlab剛學(xué)習(xí)不久,寫的程序無法運(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è)變量的上下限 過程:for i=1,pop_size chromosomei=xj=(rij*(xuppj-xlowj))+xlowj End 種群選擇(輪盤賭) 過程: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 |
新蟲 (初入文壇)

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 321求調(diào)劑 +7 | 璞玉~~ 2026-03-25 | 8/400 |
|
|---|---|---|---|---|
|
[考研] 一志愿哈爾濱工業(yè)大學(xué)材料與化工方向336分 +9 | 辰沐5211314 2026-03-26 | 9/450 |
|
|
[考研] 求調(diào)劑 +7 | 爭取九點(diǎn)睡 2026-03-28 | 8/400 |
|
|
[考研] 083000學(xué)碩274求調(diào)劑 +8 | Li李魚 2026-03-26 | 8/400 |
|
|
[考研] 壓國家一區(qū)線,求導(dǎo)師收留,有恩必謝! +7 | 迷人的哈哈 2026-03-28 | 7/350 |
|
|
[考研] 312,生物學(xué)求調(diào)劑 +3 | 小譯同學(xué)abc 2026-03-28 | 3/150 |
|
|
[考研] 285求調(diào)劑 +4 | AZMK 2026-03-27 | 7/350 |
|
|
[考研] 07化學(xué)280分求調(diào)劑 +10 | 722865 2026-03-23 | 10/500 |
|
|
[考博] 26申博 +3 | 加油沖! 2026-03-26 | 3/150 |
|
|
[考研] 322求調(diào)劑 +4 | 我真的很想學(xué)習(xí) 2026-03-23 | 4/200 |
|
|
[考研] 315調(diào)劑 +4 | 0860求調(diào)劑 2026-03-26 | 5/250 |
|
|
[考研] 292求調(diào)劑 +4 | 求求了收下我吧?/a> 2026-03-26 | 4/200 |
|
|
[考研] 0703化學(xué)338求調(diào)劑! +6 | Zuhui0306 2026-03-26 | 7/350 |
|
|
[考研] 336材料求調(diào)劑 +7 | 陳瀅瑩 2026-03-26 | 9/450 |
|
|
[考研] 085601求調(diào)劑總分293英一數(shù)二 +4 | 鋼鐵大炮 2026-03-24 | 4/200 |
|
|
[考研] 081700 調(diào)劑 267分 +11 | 迷人的哈哈 2026-03-23 | 11/550 |
|
|
[考研] 一志愿 南京郵電大學(xué) 288分 材料考研 求調(diào)劑 +3 | jl0720 2026-03-26 | 3/150 |
|
|
[考研] 打過很多競賽,085406控制工程300分,求調(diào)劑 +3 | askeladz 2026-03-26 | 3/150 |
|
|
[考研] 一志愿上海交大生物與醫(yī)藥專碩324分,求調(diào)劑 +6 | jiajunX 2026-03-22 | 6/300 |
|
|
[考研] 一志愿北化315 求調(diào)劑 +3 | akrrain 2026-03-24 | 3/150 |
|