粒子群优化算法(Particle Swarm Optimization,PSO)是IEEE神经网络国际会议论文集中的智能优化算法

01.引言
粒子群优化算法是一种非常模糊的算法,似乎可以有效地优化范围广泛的函数。我们将其视为生命或生物衍生算法的中级形式,占据了自然界中需要亿万年的进化搜索和以毫秒为单位的神经处理之间的空间。社交优化发生在普通体验的时间框架内——事实上,它就是普通体验。粒子群优化除了与生命相关外,还与进化计算有明显的联系。从概念上讲,它似乎介于遗传算法和进化规划之间。它高度依赖于随机过程,比如进化规划。粒子群优化器对pbest和gbest的调整在概念上类似于遗传算法所使用的交叉操作。它使用了混沌的概念,就像所有进化计算范式一样。
02.部分代码
%% Particle Swarm Optimization - PSO
function [gBestScore,gBest,cg_curve]=PSO(noP,Max_iteration,lb,ub,dim,fobj)
% Define the PSO's paramters
ub = ub.*ones(1,dim);
lb = lb.*ones(1,dim);
wMax=0.9;
wMin=0.2;
c1=2;
c2=2;
vMax = (ub - lb) * 0.2;
vMin = -vMax;
% Initializations
iter=Max_iteration;
vel=zeros(noP,dim);
pBestScore=zeros(noP);
pBest=zeros(noP,dim);
gBest=zeros(1,dim);
cg_curve=zeros(1,iter);
vel=zeros(noP,dim);
pos=zeros(noP,dim);
%Initialization
for i=1:size(pos,1)
for j=1:size(pos,2)
pos(i,j)=(ub(j)-lb(j))*rand()+lb(j);
vel(i,j)=rand();
end
end
for i=1:noP
pBestScore(i)=inf;
end
% Initialize gBestScore for a minimization problem
gBestScore=inf;
for t=1:iter
for i=1:size(pos,1)
% Return back the particles that go beyond the boundaries of the search
% space
Flag4ub=pos(i,:)>ub;
Flag4lb=pos(i,:)fitness)
pBestScore(i)=fitness;
pBest(i,:)=pos(i,:);
end
if(gBestScore>fitness)
gBestScore=fitness;
gBest=pos(i,:);
end
end
%Update the W of PSO
w=wMax-t*((wMax-wMin)/iter);
%Update the Velocity and Position of particles
for i=1:size(pos,1)
for j=1:size(pos,2)
vel(i,j)=w*vel(i,j)+c1*rand()*(pBest(i,j)-pos(i,j))+c2*rand()*(gBest(j)-pos(i,j));
if vel(i,j)>vMax(j)
vel(i,j)=vMax(j);
end
if vel(i,j)<-vMax(j)
vel(i,j)=-vMax(j);
end
pos(i,j)=pos(i,j)+vel(i,j);
end
end
cg_curve(t)=gBestScore;
end
end
03.代码效果图
