📄 crossover.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 + -