资 源 简 介
clear all;
close all;
min=-2.048;max=2.0458;
Vmax=1;Vmin=-0.1;
c1=1.3;c2=1.7;
wmin=0.1;wmax=0.9;
G=100;
Size=50;
for i=1:G
w(i)=wmax-((wmax-wmin)/G)*i;
end
for i=1:Size
for j=1:2
x(i,j)=min+(max-min)*rand(1);
v(i,j)=Vmin+(Vmax-Vmin)*rand(1);
end
end
%(2)
for i=1:Size
p(i)=chap8_8func(x(i,:));
y(i,:)=x(i,:);
if i==1
plocal(i,:)=chap8_8lbest(x(Size,:),x(i,:),x(i+1,:));
elseif i==Size
plocal(i,:)=chap8_8lbest(x(i-1,:),x(i,:),x(i,:));
else
plocal(i,: