24小时热门版块排行榜    

查看: 735  |  回复: 2

shu_fyh

新虫 (初入文坛)

[求助] 求大神帮忙用matlab写一个关于遗传算法的小程序

本人matlab刚学习不久,写的程序无法运行,求大神帮忙修改至可以运行
目标函数: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:种群数量
chromosome:染色体(每组染色体即代表一个解)
r:[0,1]间的随机数
j:不同堆垛方案所决定的决定变量(stckopile length、stockpile height、stacker speed、stockpile type)
xupp、xlow分别表示各个变量的上下限
过程: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
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

chfyh

银虫 (初入文坛)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
shu_fyh: 金币+30, ★★★★★最佳答案 2013-11-11 10:03:38
你好,我已经写好了,可以发你邮箱,咱们私聊
加油!
2楼2013-11-11 10:02:37
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

shu_fyh

新虫 (初入文坛)

引用回帖:
2楼: Originally posted by chfyh at 2013-11-11 10:02:37
你好,我已经写好了,可以发你邮箱,咱们私聊

多谢帮助!
3楼2013-11-11 10:03:53
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 shu_fyh 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 生物学学硕求调剂 +7 小羊睡着了? 2026-03-23 10/500 2026-03-25 02:24 by 清风拂扬。 m
[考研] 上海电力大学材料防护与新材料重点实验室招收调剂研究生(材料、化学、电化学,环境) +4 我爱学电池 2026-03-23 4/200 2026-03-25 00:59 by 1027_324
[考研] 311求调剂 +3 冬十三 2026-03-24 3/150 2026-03-24 21:31 by peike
[有机交流] 有机合成求助 20+3 FENGSHUJEI 2026-03-23 5/250 2026-03-24 19:31 by 88817753
[考研] 085602 289分求调剂 +5 WWW西西弗斯 2026-03-24 5/250 2026-03-24 18:51 by jhhcooi
[考研] 299求调剂 +7 某某某某位 2026-03-21 7/350 2026-03-24 15:24 by cuifj
[考研] 277分求调剂,跨调材料 +3 考研调剂lxh 2026-03-24 3/150 2026-03-24 13:52 by JourneyLucky
[考研] 335求调剂 +4 yuyu宇 2026-03-23 5/250 2026-03-23 23:49 by Txy@872106
[考研] 291求调剂 +8 hhhhxn.. 2026-03-23 8/400 2026-03-23 23:15 by peike
[考研] 361求调剂 +3 Glack 2026-03-22 3/150 2026-03-23 22:03 by fuyu_
[考研] 070300,一志愿北航320求调剂 +3 Jerry0216 2026-03-22 5/250 2026-03-23 09:16 by 。。堂堂
[考研] 317求调剂 +12 申子申申 2026-03-19 18/900 2026-03-22 22:23 by luoyongfeng
[考研] 280分求调剂 一志愿085802 +4 PUMPT 2026-03-22 7/350 2026-03-22 22:13 by 星空星月
[考研] 319求调剂 +4 小力气珂珂 2026-03-20 4/200 2026-03-22 15:53 by ColorlessPI
[考研] 269专硕求调剂 +6 金恩贝 2026-03-21 6/300 2026-03-22 14:31 by ColorlessPI
[考研] 材料学硕301分求调剂 +7 Liyouyumairs 2026-03-21 7/350 2026-03-21 22:31 by peike
[考研] 307求调剂 +3 余意卿 2026-03-18 3/150 2026-03-21 17:31 by ColorlessPI
[考研] 一志愿中海洋材料工程专硕330分求调剂 +8 小材化本科 2026-03-18 8/400 2026-03-20 23:16 by JourneyLucky
[考研] 材料与化工 322求调剂 +4 然11 2026-03-19 4/200 2026-03-20 22:12 by luoyongfeng
[考研] 085410人工智能专硕317求调剂(0854都可以) +4 xbxudjdn 2026-03-18 4/200 2026-03-20 09:07 by 不168
信息提示
请填处理意见