毕业设计matlab程序,完整的遗传算法函数Matlab程序【精品毕业设计】(完整版)

完整的遗传算法函数Matlab程序

function [x,endPop,bPop,traceInfo] = ga(bounds,eevalFN,eevalOps,startPop,opts,... termFN,termOps,selectFN,selectOps,xOverFNs,xOverOps,mutFNs,mutOps)

n=nargin;

if n<2 | n==6 | n==10 | n==12

disp('Insufficient arguements')

end

if n<3 %Default eevalation opts.

eevalOps=[];

end

if n<5

opts = [1e-6 1 0];

end

if isempty(opts)

opts = [1e-6 1 0];

end

if any(eevalFN<48) %Not using a .m file

if opts(2)==1 %Float ga

e1str=['x=c1; c1(xZomeLength)=', eevalFN ';'];

e2str=['x=c2; c2(xZomeLength)=', eevalFN ';'];

else %Binary ga

e1str=['x=b2f(endPop(j,:),bounds,bits); endPop(j,xZomeLength)=',...

eevalFN ';'];

end

else %Are using a .m file

if opts(2)==1 %Float ga

e1str=['[c1 c1(xZomeLength)]=' eevalFN '(c1,[gen eevalOps]);'];

e2str=['[c2 c2(xZomeLength)]=' eevalFN '(c2,[gen eevalOps]);'];

else %Binary ga

e1str=['x=b2f(endPop(j,:),bounds,bits);[x v]=' eevalFN ...

'(x,[gen eevalOps]); endPop(j,:)=[f2b(x,bounds,bits) v];'];

end

end

if n<6 %Default termination information

termOps=[100];

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值