Matlab + GA:模拟二进制交叉(SBX)无法生成所需的后代分布

时间:2017-03-24 06:21:52

标签: matlab genetic-algorithm evolutionary-algorithm

我在一些参考文献中发现,SBX的后代分布对于2d向量必须具有以下形状: enter image description here

然而,我的实现与该形状不同:

    par1 = [.2; .2];
par2 = [.8; .8];
eta = 15;
child1 = zeros(2,1);
child2 = child1;
hold on
for k = 1:100
    for i = 1:2
      u = rand;
      if (u<0.5)
          beta=(2*u)^(1/(eta+1));
      elseif (u>0.5)
          beta=(0.5/(1-u))^(1/(eta+1));
      elseif (u == .5)
          beta = 1;
      end
      c1(i) = 0.5*(par1(i)+par2(i)) - 0.5*beta*abs(par1(i)-par2(i));
      c2(i) = 0.5*(par1(i)+par2(i)) + 0.5*beta*abs(par1(i)-par2(i));

    end
    plot([c1(1), c2(1)], [c1(2), c2(2)], 'b.')

end

以下是我的输出:enter image description here 我认为我的实施是正确的,但我不知道为什么我无法达到那个理想的数字。

1 个答案:

答案 0 :(得分:-1)

原因是你需要实现反射,检查来自autor Deb的nsga-ii代码。 有两个附加行为:交换变量概率(0.5)并直接以一定概率继承父变量。 问候 JoelChacónCastillo