📄 children.m
字号:
function childs = children(parent,method,pmut)
% CHILDREN - Creates the children from the parentpool
%
% c=children(parent,'method',pmut) The function returns a
% vector with the children created from the supplied matrix of
% parents. The methods allowed is described below, the argument
% 'pmut' is the probability of mutation.
%
% 'uform' - uniform crossover
% 'npoint' - n points crossover a number with the desired
% points. NOT IMPLEMENTED YET
%
% See also PARENTS,UI_MUTATE,MUTATE
ind=1;
switch method
case 'uform'
[m n]=size(parent);
for k=1:m
c1=parent(k,1)+parent(k,2);
c1=morph(c1,parent(k,2),pmut);
childs(ind)=c1;
ind=ind+1;
c2=parent(k,2)+parent(k,1);
c2=morph(c2,parent(k,1),pmut);
childs(ind)=c2;
ind=ind+1;
end
otherwise
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -