PDA

查看完整版本 : [求助]遗传算法代码疑难


jiandan
2009-03-30, 11:17
%将30个变量分为五个范围,相临两个染色体分别从五位进行交叉
crb1=round(rand*(bn/5-1))+1; %在[1,6]范围内随机产生一个交叉位
cross(i,crb1:crb1)=0.1*select(i,crb1:crb1)+0.9*select(i+1,crb1:crb1);
cross(i+1,crb1:crb1)=0.1*select(i,crb1:crb1)+0.9*select(i+1,crb1:crb1);
cross(i,2*crb1:2*crb1)=0.1*select(i,2*crb1:2*crb1)+0.9*select(i+1,2*crb1:2*crb1);
cross(i+1,2*crb1:2*crb1)=0.1*select(i,2*crb1:2*crb1)+0.9*select(i+1,2*crb1:2*crb1);
cross(i,3*crb1:3*crb1)=0.1*select(i,3*crb1:3*crb1)+0.9*select(i+1,3*crb1:3*crb1);
cross(i+1,3*crb1:3*crb1)=0.1*select(i,3*crb1:3*crb1)+0.9*select(i+1,3*crb1:3*crb1);
cross(i,4*crb1:4*crb1)=0.1*select(i,4*crb1:4*crb1)+0.9*select(i+1,4*crb1:4*crb1);
cross(i+1,4*crb1:4*crb1)=0.1*select(i,4*crb1:4*crb1)+0.9*select(i+1,4*crb1:4*crb1);
cross(i,5*crb1:5*crb1)=0.1*select(i,5*crb1:5*crb1)+0.9*select(i+1,5*crb1:5*crb1);
cross(i+1,5*crb1:5*crb1)=0.1*select(i,5*crb1:5*crb1)+0.9*select(i+1,5*crb1:5*crb1);
end
上面是遗传算法用MATLAB编写的程序,我想问一下它是怎么来的,特别是那个0.1、0.9是什么?