www.gusucode.com > CHPSO优化算法matlab源码程序 > CHPSO优化算法matlab源码程序/CHPSO/CHPSO.m
clc;clear all;close all % % ===================================================================== % % % Convergent Heterogenous Particle Swarm Optimization % % % ===================================================================== % % % % % % ===================================================================== % % % Author: Ngaam J. Cheung % % % Email: ngaam.ch@gmail.com % % % Release: 1.1 % % % Release Date: June 9, 2013. % % % Modified Date: April 29, 2014. % % % ===================================================================== % % % ===================================================================== % % % NOTE: % % 1) This source code is freely available to all academic users % % and not-for-profit institutions. % % 2) Commercial users wishing an evaluation copy should contact the author % % 3) Commercial users may license the CHPSO software after completing % % the license agreement and sending it to ngaam.ch@gmail.com. % % % % If you use CHPSO, please cite the following paper: % % Ngaam J. Cheung, Xue-Ming Ding, Hong-Bin Shen, % % OptiFel: A Convergent Heterogeneous Particle Swarm Optimization % % for Takagi-Sugeno Fuzzy Modeling. IEEE Trans. on Fuzzy System, % % 22(4): 919-933, Aug. 2014. doi: 10.1109/TFUZZ.2013.2278972 % % ===================================================================== % help CHPSO.m NGen = 1e3; gap = 1:(NGen/50):NGen; % Parameters of PSO sNP = 8; acc = [1.49445, 1.49445]; iwt = [0.9, 0.35]; % interia weight for funcNum = 1 [Lb, Ub,dim] = funcRange(funcNum); % for objFunc: twenty-three benchmark functions param = struct( 'ParicleNumber', sNP,... 'AccelerationConstants', acc,... 'InteriaWeight', iwt,... 'Dimension', dim,... 'Ub', Ub,... 'Lb', Lb); for run = 1:3 rand('state',sum(100*clock)) tic BestChart = CHPSO_func('objFunc',NGen,param,funcNum); t = toc; eval(['CHPSO_F',num2str(funcNum),'(:,run) = BestChart;']); figure(1) semilogy(gap,BestChart(gap),'-ok','linewidth',1.4,'Markersize',3); title({strcat('\fontsize{12}\bf Function: F',num2str(funcNum));strcat('Currunt run time: ',num2str(run))}); xlabel('\fontsize{12}\bf Generation'); ylabel('\fontsize{12}\bf Best-so-far'); legend('\fontsize{10}\bf CHPSO',1); fprintf('R = %2d, time = %5.2f, best-so-far = %.4e\n', run, t, BestChart(end)) end end