how can i correct the error regarding pareto optimal front?

%Function to be minimized
D=3;
Nobj=2;
objf=inline('[0.0076818+0.00017*x1+0.0009*x2 +0.00145*x3 -0.000405*x1^2+0.000295*x2^2+0.000495*x3^2+0.000187*x1*x2,5235.61+59.10*x1 +896.80*x2+833.10*x3-956.77*x2^2+595.73*x3^2-436.13*x2*x3]','x1','x2','x3');
objf=vectorize(objf);
%Initialization of DE parameters
N=20; %population size (total function evaluations will be itmax*N),
itmax=30;
c1=1.05; c2=1.05;
wmax=1; wmin=0.3; %set to same value for constant w
w=linspace(wmax,wmin,itmax); %linear variation of w
%Problem and velocity bounds
a(1:N,1)=-1.0;
b(1:N,1)=1.0;
%bounds on variable x1
a(1:N,2)=-1.0;
b(1:N,2)=1.0;
%bounds on variable x2
a(1:N,3)=-0.9;
b(1:N,3)=1.1;
%bounds on variable x3
d=(b-a);
m=a; n=b;
q=(n-m)/4; %initial velocities are 1/4 of parameter space size
%Random initialization of positions and velocities
x=a+d.*rand(N,D);
v=q.*rand(N,D);
%Evaluate objective for all particles
f=objf(x(:,1),x(:,2),x(:,3));
%Find gbest (random point on pareto front)
idx=findpareto(f);
igbest=idx(round(rand(1)*(size(idx,1)-1))+1);
fgbest=f(igbest,:);
gbest=x(igbest,:);
%Find pbest (update only if new f is on front and dominates old)
for i=1:N
if (find(idx==i))
if (domination(f(i,:),fpbest(i,:))==1)
fpbest(i,:)=f(i,:);
pbest(i,:)=x(i,:);
end
end
end
%Iterate
for it=1:itmax;
%Update velocities and positions
v(1:N,1:D)=w(it)*v(1:N,1:D)+c1*rand*(pbest(1:N,1:D)-x(1:N,1:D))+c2*rand *(repmat(gbest,N,1)-x(1:N,1:D))
x(1:N,1:D)=x(1:N,1:D)+v(1:N,1:D)
%Evaluate objectives
f=objf(x(:,1),x(:,2),x(:,3));
%Find gbest and pbest
[minf,iminf]=min(f);
if minf<= fgbest
fgbest=minf; gbest=x(iminf,:);
end
inewpb=find(f<=fpbest);
pbest(inewpb,:)=x(inewpb,:); fpbest(inewpb)=f(inewpb);
end %end loop on iterations
[gbest,fgbest]
pso= gbest;

Answers (0)

This question is closed.

Tags

Asked:

Jit
on 20 May 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!