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

📄 children.m

📁 一些用matlab编写的经典遗传算法算例。可以用于解决许多优化问题
💻 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 + -