我已经能够编写1-point crossover
如下代码:
n_parents = length(parents);
randparents = randperm(n_parents);
parent1 = population.ind{parents(randparents(1))};
parent2 = population.ind{parents(randparents(2))};
cross_point = ceil(rand()*(size(parent1,2)-1));
child = [parent1(1:cross_point),parent2(cross_point+1:size(parent2,2))];
任何人都可以帮助将其转换为uniform crossover
请吗?