⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 g_crossover.m

📁 real genetic algorithm matlab code
💻 M
字号:
%%%%%%%%% function g_crossover %%%%%%%%%%%%%%
function [new_pop]=g_crossover(mating_pool,Pc,N)
parent_num=randperm(N);
for j=1:2:N
    sec=rand;
    pointer1=parent_num(j);
    pointer2=parent_num(j+1);
    off1=mating_pool(pointer1,:);
    off2=mating_pool(pointer2,:);
    if rand<Pc
        off1=sec.*off1+(1-sec).*off2;
        off2=sec.*off2+(1-sec).*off1;
    end
    new_pop(j,:)=off1;
    new_pop(j+1,:)=off2;
end
return

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -