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

📄 min.m

📁 一些用matlab编写的经典遗传算法算例 挺有用的
💻 M
字号:
function varargout = min(chr)
% MIN - Returns the value of the worst member in the population. Also returns
% the member and the index position in the vector if desired.
%   [val,mem,ind]=min(chr) The argument to the function is a vector
%   of type chrom, one generation.  The output is
%     mem - worst member.
%     val - fitness of worst member
%     ind - the index in the vector
%   
%   See also MAX,MEAN,MEDIAN,STD
[m n]=size(chr);
for k=1:m
  for l=1:n
    fit(l)=get(chr(k,l),'fitness');
  end
  [q f_ind]=min(fit);
  varargout{1}(k,1)=fit(f_ind);
  varargout{2}(k,1)=chr(k,f_ind);
  varargout{3}(k,1)=f_ind;
end


⌨️ 快捷键说明

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