一个简化的群搜索优化算法表示为大规模全局优化“SGSO” 提出了获得一个简单的算法性能优越在高维问题。SGSO采用一种改进的共享策略,使用一个简单的搜索方法搜索的角度。【优化求解】改进的萤火虫算法matlab源码_matlab

function [fbestval,bestmember,Best] = SGSOforLS(fname,NDim,MaxIter)

% function [fbestval,bestmember,Best] = SGSOforLS(fname,NDim,MaxIter)
% Simplified Group Search Optimizer Algorithm for Large Scale Global Optimization
% Input Arguments: 
%   fname       - the name of the evaluation .m function
%   NDim        - dimension of the evalation function
%   MaxIter     - maximum iteration
% Example:  


PopSize=51;     % population of members

% Defined lower bound and upper bound.
Bound=eval(fname); 
LowerBound=zeros(NDim,1)+Bound(:,1);
UpperBound=zeros(NDim,1)+Bound(:,2);

basestep=0.5*(UpperBound-LowerBound); 

% Initialize swarm population
population=rand(NDim, PopSize).*(repmat(UpperBound-LowerBound,1,PopSize)) + repmat(LowerBound,1,PopSize);    

for iteration=1:MaxIter


    if (iteration)/5000==floor((iteration)/5000) 
        fprintf(1,'%e   ',fSequence(1));
        if (iteration)/25000==floor((iteration)/25000)
           fprintf(1,'\n');
        end
    end
end

fbestval=fSequence(1);
% bestmember
% population
% fn=strcat(fname,'n',num2str(floor(rand(1)*1000)));
% dlmwrite(strcat(fn,'.txt'),Best);
plot(log10(Best))
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.

【优化求解】改进的萤火虫算法matlab源码_优化求解_02