calfitness.m

来自「粒子群优化程序」· M 代码 · 共 20 行

M
20
字号
% =====================================================================
%                 calfitness: sub-algorithm of pso
%         Start Date: 2006/9/1
%   Last Changed: 2006/11/20
%    Specification: MATLAB 7.01 Programing
%                           This is the subprogram of PSO algorithm, it is
%                           used to calculate the fitness of the particle,
%                           here, it is the value of function rosenbrock
%
% Copyright (c) Ji and Liao in 2006
% All rights Reserved
%==========================================================================

 % rosenbrock
 elise=particle(:,:,IndexIteration);
          x0=elise(:,1:end-1);
 x1=elise(:,2:end);

 out = sum( (100*(x1-x0.^2).^2 + (x0-1).^2) , 2);
 fitness(:,IndexIteration)=abs(out-denstination);

⌨️ 快捷键说明

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