Code covered by the BSD License

# ev-MOGA Multiobjective Evolutionary Algorithm

18 Apr 2011 (Updated )

This toolbox implements the ev-MOGA Multiobjective Evolutionary Algorithm.

[ParetoFront,ParetoSet]=Iteration_evMOGA(generacion)
```function [ParetoFront,ParetoSet]=Iteration_evMOGA(generacion)

global eMOGA
if (generacion==0)

CrtpReal();

eMOGA.coste_P = feval(eMOGA.objfun,eMOGA.ele_P);

for i=1:(eMOGA.Nind_P-1)
if eMOGA.mod(i)==1
continue
end
for j=(i+1):eMOGA.Nind_P
if eMOGA.mod(j)==1
continue
end
a=domina(eMOGA.coste_P(i,:),eMOGA.coste_P(j,:));
if (a==0)

elseif (a==3 || a==1)

eMOGA.mod(j)=1;
continue
elseif (a==2)

eMOGA.mod(i)=1;
break;
end
end
if (eMOGA.mod(i)==0)
eMOGA.mod(i)=2;
end
end
if (eMOGA.mod(eMOGA.Nind_P)==0)
eMOGA.mod(eMOGA.Nind_P)=2;
end
for j=1:eMOGA.Mfun
eMOGA.max_f(j)=-inf;
eMOGA.min_f(j)=inf;
end

for i=1:eMOGA.Nind_P
if (eMOGA.mod(i)==2)
for j=1:eMOGA.Mfun
if (eMOGA.coste_P(i,j)>eMOGA.max_f(j))
eMOGA.max_f(j)=eMOGA.coste_P(i,j);
elseif (eMOGA.coste_P(i,j)<eMOGA.min_f(j))
eMOGA.min_f(j)=eMOGA.coste_P(i,j);
end
end
end
end

for j=1:eMOGA.Mfun
eMOGA.epsilon(j)=(eMOGA.max_f(j)-eMOGA.min_f(j))/eMOGA.n_div(j);
end

for i=1:eMOGA.Nind_P
if(eMOGA.mod(i)==2)

eMOGA.box_P(i,:)=calcula_box(eMOGA.coste_P(i,:));

Archivar(eMOGA.ele_P(i,:),eMOGA.coste_P(i,:),eMOGA.box_P(i,:));
end
end

else

rellena_GA();

eMOGA.coste_GA = feval(eMOGA.objfun,eMOGA.ele_GA);

for i=1:eMOGA.Nind_GA

a=0;
b=0;
for j=1:eMOGA.Mfun
if (eMOGA.coste_GA(i,j)>=eMOGA.max_f(j))
a=a+1;
end
if (eMOGA.coste_GA(i,j)<=eMOGA.min_f(j))
b=b+1;
end
end
if (a==0) && (b==0)

eMOGA.box_GA(i,:)=calcula_box(eMOGA.coste_GA(i,:));
Archivar(eMOGA.ele_GA(i,:),eMOGA.coste_GA(i,:),eMOGA.box_GA(i,:));
elseif (a==eMOGA.Mfun) && (b==0)

elseif (a==0) && (b==eMOGA.Mfun)

eMOGA.Nind_A=1;

eMOGA.ele_A(1,:)=eMOGA.ele_GA(i,:);
eMOGA.coste_A(1,:)=eMOGA.coste_GA(i,:);

eMOGA.max_f=eMOGA.coste_GA(i,:);
eMOGA.min_f=eMOGA.coste_GA(i,:);
else

aux2=0;
for j=1:eMOGA.Nind_A
c=domina(eMOGA.coste_A(j,:),eMOGA.coste_GA(i,:));
if(c==1)
aux2=1;
break;
end
end
if (aux2>0)

continue;
end

j=1;
while j<=(eMOGA.Nind_A-1)
c=domina(eMOGA.coste_GA(i,:),eMOGA.coste_A(j,:));
if(c==1)

eMOGA.ele_A(j:eMOGA.Nind_A-1,:)=eMOGA.ele_A(j+1:eMOGA.Nind_A,:);
eMOGA.box_A(j:eMOGA.Nind_A-1,:)=eMOGA.box_A(j+1:eMOGA.Nind_A,:);
eMOGA.coste_A(j:eMOGA.Nind_A-1,:)=eMOGA.coste_A(j+1:eMOGA.Nind_A,:);
eMOGA.Nind_A=eMOGA.Nind_A-1;
j=j-1;
end
j=j+1;
end

if (domina(eMOGA.coste_GA(i,:),eMOGA.coste_A(eMOGA.Nind_A,:)))
eMOGA.Nind_A=eMOGA.Nind_A-1;
end

eMOGA.max_f=eMOGA.coste_GA(i,:);
eMOGA.min_f=eMOGA.coste_GA(i,:);
for j=1:eMOGA.Nind_A
for k=1:eMOGA.Mfun
if (eMOGA.coste_A(j,k)>eMOGA.max_f(k))
eMOGA.max_f(k)=eMOGA.coste_A(j,k);
elseif (eMOGA.coste_A(j,k)<eMOGA.min_f(k))
eMOGA.min_f(k)=eMOGA.coste_A(j,k);
end
end
end

for j=1:eMOGA.Mfun
eMOGA.epsilon(j)=(eMOGA.max_f(j)-eMOGA.min_f(j))/eMOGA.n_div(j);
end

for j=1:eMOGA.Nind_A
eMOGA.box_A(j,:)=calcula_box(eMOGA.coste_A(j,:));
end

Nind_A_temp=eMOGA.Nind_A;

copiaele=eMOGA.ele_A(1:eMOGA.Nind_A,:);
copiacos=eMOGA.coste_A(1:eMOGA.Nind_A,:);
copiabox=eMOGA.box_A(1:eMOGA.Nind_A,:);
eMOGA.Nind_A=1;
for j=2:Nind_A_temp
Archivar(copiaele(j,:),copiacos(j,:),copiabox(j,:));
end
eMOGA.box_GA(i,:)=calcula_box(eMOGA.coste_GA(i,:));
Archivar(eMOGA.ele_GA(i,:),eMOGA.coste_GA(i,:),eMOGA.box_GA(i,:));
end
Actualizar_P(eMOGA.ele_GA(i,:),eMOGA.coste_GA(i,:));
end
ParetoSet=eMOGA.ele_A(1:eMOGA.Nind_A,:);
ParetoFront=eMOGA.coste_A(1:eMOGA.Nind_A,:);
end
```