📄 sexuallyproduce.m
字号:
% Sexually produce a child
function child = SexuallyProduce(P1, P2, Pc, Pm)
% Crossover
child = P1;
indpc = rand(1, length(P1));
idx = find(indpc>Pc);
child(idx) = P2(idx);
% Mutation
indmu = rand(1, length(P1));
idx = find(indmu<Pm);
child(idx) = ~child(idx);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -