Single point ordered crossover in matlab

泪湿孤枕 提交于 2019-12-01 09:20:34

To find the crossover point, use a logical AND operator on the second line of the parents:

idx = find(P1(2, :) & P2(2, :));

Then we create the offsprings by switching values between parents after the crossover point:

O1 = [P1(:, 1:idx), P2(:, idx + 1:end)];
O2 = [P2(:, 1:idx), P1(:, idx + 1:end)];

Hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!