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

📄 crossover.m

📁 遗传算法matlab实现
💻 M
字号:
function res=crossover(grp,parent,p_cross,numSVM)
%GA crossover function
%The return value refers to postcrossover the group
%The mother refers to the original group
res=zeros(99,numSVM);
for i=1:99
    first=parent(i,1);
    second=parent(i,2);
    if Bernoulli(p_cross)
        
        pos=round(numSVM*rand(1));
        while pos==0
            pos=round(numSVM*rand(1));
        end
        
     res(i,:)=exchange(grp(first,:),grp(second,:),pos);
     
    else
        res(i,:)=grp(first,:);
    end
     
    
end



⌨️ 快捷键说明

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