%% %%%%%%%%%%%%%%%%多目标测试函数%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%SCH、FON、POL、KUR、ZDT来自文献---A Fast and Elitist Multiobjective Genetic Algorithm:NSGA-II
%DTLZ来自文献--Scalable Multi-Objective Optimization Test Problems
%MOP来自文献---Decomposition of a Multiobjective Optimization Probleminto a Number of Simple Multiobjective Subproblems
function y=muti_fun(x,type)
global D
if type==1 %SCH----维度1---边界范围[-10^3,10^3]
y(1)=x.^2;
y(2)=(x-2).^2;
elseif type==2 %FON-------维度3----边界范围[-4,4]
L=3;
sumFON1=0;
sumFON2=0;
for i=1:L
sumFON1=sumFON1+(x(i)-1/sqrt(3)).^2;
sumFON2=sumFON2+(x(i)+1/sqrt(3)).^2;
end
y(1)=1-exp(-sumFON1);
y(2)=1-exp(-sumFON2);
elseif type==3 %POL-----维度2-----边界范围[-pi,pi]
A1=0.5*sin(1)-2*cos(1)+sin(2)-1.5*cos(2);
A2=1.5*sin(1)-cos(1)+2*sin(2)-0.5*cos(2);
B1=0.5*sin(x(1))-2*cos(x(1))+sin(x(2))-1.5*cos(x(2));
B2=1.5*sin(x(1))-cos(x(1))+2*sin(x(2))-0.5*cos(x(2));
y(1)=1+(A1-B1).^2+(A2-B2).^2;
y(2)=(x(1)+3).^2+(x(2)+1).^2;
elseif type==4 %KUR-----------维度3-----边界范围[-5,5]
sumKUR1=0;
sumKUR2=0;
for i=1:D-1
sumKUR1=sumKUR1+(-10*exp(-0.2*sqrt(x(i).^2+x(i+1).^2)));
end
for i=1:D
sumKUR2=sumKUR2+abs(x(i)).^(0.8)+5*sin(x(i).^3);
end
y(1)=sumKUR1;
y(2)=sumKUR2;
elseif type==5 %ZDT1----维度30----边界范围[0,1]
y(1)=x(1);
y(2)=1-sqrt(y(1)/g(x));
elseif type==6 %ZDT2----维度30----边界范围[0,1]
y(1)=x(1);
y(2)=1-(y(1)/g1(x)).^2;
elseif type==7 %ZDT3----维度30----边界范围[0,1]
y(1)=x(1);
y(2)=1-sqrt(y(1)/g1(x))-(y(1)/g1(x))*sin(10*pi*y(1));
elseif type==8 %ZDT4----维度10----边界范围x1=[0,1],x(2,...,10)=[-5,5]
y(1)=x(1);
y(2)=1-sqrt(y(1)/g2(x));
elseif type==9 %ZDT6----维度10----边界范围[0,1]
y(1)=1-exp(-4*x(1))*sin(6*pi*x(1)).^6;
y(2)=1-(y(1)/g3(x)).^2;
elseif type==10 %MOP1----维度10----边界范围[0,1]
y(1)=(1+g4(x))*x(1);
y(2)=(1+g4(x))*(1-sqrt(x(1)));
elseif type==11 %MOP2----维度10----边界范围[0,1]
y(1)=(1+g5(x))*x(1);
y(2)=(1+g5(x))*(1-x(1).^2);
elseif type==12 %MOP3----维度10----边界范围[0,1]
y(1)=(1+g6(x))*cos((pi*x(1))/2);
y(2)=(1+g6(x))*sin((pi*x(1))/2);
elseif type==13 %MOP4----维度10----边界范围[0,1]
y(1)=(1+g7(x))*x(1);
y(2)=(1+g7(x))*(1-x(1).^2*cos(2*pi*x(1)).^2);
elseif type==14 %MOP5----维度10----边界范围[0,1]
y(1)=(1+g8(x))*x(1);
y(2)=(1+g8(x))*(1-sqrt(x(1)));
elseif type==15 %MOP6----三目标----维度10----边界范围[0,1]
y(1)=(1+g9(x))*x(1)*x(2);
y(2)=(1+g9(x))*x(1)*(1-x(2));
y(3)=(1+g9(x))*(1-x(1));
elseif type==16 %MOP7----三目标----维度10----边界范围[0,1]
y(1)=(1+g10(x))*cos((x(1)*pi)/2)*cos((x(2)*pi)/2);
y(2)=(1+g10(x))*cos((x(1)*pi)/2)*sin((x(2)*pi)/2);
y(3)=(1+g10(x))*sin((x(1)*pi)/2);
elseif type==17 %DTLZ1----三目标----维度7----边界范围[0,1]---定义k=5
y(1)=(1/2)*x(1)*x(2)*(1+g11(x));
y(2)=(1/2)*x(1)*(1-x(2))*(1+g11(x));
y(3)=(1/2)*(1-x(1))*(1+g11(x));
elseif type==18 %DTLZ2----三目标----维度7----边界范围[0,1]---定义k=10
y(1)=(1+g12(x))*cos((pi/2)*x(1))*cos((pi/2)*x(2));
y(2)=(1+g12(x))*cos((pi/2)*x(1))*sin((pi/2)*x(2));
y(3)=(1+g12(x))*sin((pi/2)*x(1));
elseif type==19 %DTLZ3----三目标----维度12----边界范围[0,1]---定义k=5--k=n-m+1
y(1)=(1+g11(x))*cos((pi/2)*x(1))*cos((pi/2)*x(2));
y(2)=(1+g11(x))*cos((pi/2)*x(1))*sin((pi/2)*x(2));
y(3)=(1+g11(x))*sin((pi/2)*x(1));
elseif type==20 %DTLZ4----三目标----维度12----边界范围[0,1]---定义k=10
a=100;
y(1)=(1+g12(x))*cos((pi/2)*x(1).^a)*cos((pi/2)*x(2).^a);
y(2)=(1+g12(x))*cos((pi/2)*x(1).^a)*sin((pi/2)*x(2).^a);
y(3)=(1+g12(x))*sin((pi/2)*x(1).^a);
elseif type==21 %DTLZ5----三目标----维度12----边界范围[0,1]---定义k=10
y(1)=(1+g12(x))*cos(x(1)*(pi/2))*cos((pi/(4*(1+g12(x))))*(1+2*g12(x)*x(2))*(pi/2));
y(2)= (1+g12(x))*cos(x(1)*(pi/2))*sin((pi/(4*(1+g12(x))))*(1+2*g12(x)*x(2))*(pi/2));
y(3)=(1+g12(x))*sin(x(1)*(pi/2));
elseif type==22 %DTLZ6----三目标----维度12----边界范围[0,1]---定义k=20
y(1)=(1+g13(x))*cos(x(1)*(pi/2))*cos((pi/(4*(1+g13(x))))*(1+2*g13(x)*x(2))*(pi/2));
y(2)= (1+g13(x))*cos(x(1)*(pi/2))*sin((pi/(4*(1+g13(x))))*(1+2*g13(x)*x(2))*(pi/2));
y(3)=(1+g13(x))*sin(x(1)*(pi/2));
elseif type==23 %DTLZ7--三目标---边界范围[0,1]---k=28
y(1)=x(1);
y(2)=x(2);
y(3)=(1+g14(x))*h(x);
end
end
%% 下面是各测试集函数子函数
function f=g(x)
global D
f=1+9*(sum(x(2:D))/(D-1));
end
function f=g1(x)
global D
f=1+9*(sum(x(2:D))/(D-1));
end
function f=g2(x)
global D
D=10;
f=0;
for i=2:D
f=f+x(i).^2-10*cos(4*pi*x(i));
end
f=f+1+10*(D-1);
end
function f=g3(x)
global D
f=1+9*(sum(x(:,2:D))/(D-1)).^0.25;
end
function f=g4(x) %MOP1
global D
f=0;
for i=2:D
t(i)=x(i)-sin(0.5*pi*x(1));
f=-0.9*t(i).^2+abs(t(i)).^0.6+f;
end
f=f*2*sin(pi*x(1));
end
function f=g5(x) %MOP2
global D
f=0;
for i=2:D
t(i)=x(i)-sin(0.5*pi*x(1));
f=(abs(t(i))/(1+exp(5*abs(t(i)))))+f;
end
f=f*10*sin(pi*x(1));
end
function f=g6(x) %MOP3
global D
f=0;
for i=2:D
t(i)=x(i)-sin(0.5*pi*x(1));
f=(abs(t(i))/(1+exp(5*abs(t(i)))))+f;
end
f=f*10*sin(pi*x(1)*(1/2));
end
function f=g7(x) %MOP4
global D
f=0;
for i=2:D
t(i)=x(i)-sin(0.5*pi*x(1));
f=(abs(t(i))/(1+exp(5*abs(t(i)))))+f;
end
f=f*10*sin(pi*x(1));
end
function f=g8(x) %MOP5
global D
f=0;
for i=2:D
t(i)=x(i)-sin(0.5*pi*x(1));
f=-0.9*t(i).^2+abs(t(i)).^0.6+f;
end
f=f*2*abs(cos(pi*x(1)));
end
function f=g9(x) %MOP6
global D
f=0;
for i=2:D
t(i)=x(i)-x(1)*x(2);
f=-0.9*t(i).^2+abs(t(i)).^0.6+f;
end
f=f*2*sin(pi*x(1));
end
function f=g10(x) %MOP7
global D
f=0;
for i=3:D
t(i)=x(i)-x(1)*x(2);
f=-0.9*t(i).^2+abs(t(i)).^0.6+f;
end
f=f*2*sin(pi*x(1));
end
function f=g11(x) %DTLZ1 DTLZ3
global D k
f=0;
for i=3:D
f=(x(i)-0.5).^2-cos(20*pi*(x(i)-0.5))+f;
end
f=(f+k)*100;
end
function f=g12(x) %DTLZ2 DTLZ4 DTLZ5
global D
f=0;
for i=3:D
f=f+(x(i)-0.5).^2;
end
end
function f=g13(x) % DTLZ6
global D
f=0;
for i=3:D
f=f+x(i).^0.1;
end
end
function f=g14(x) %DTLZ7
global D k
f=0;
for i=3:D
f=f+x(i);
end
f=1+(9/k)*f;
end
function g=h(x)
global f_num
g=0;
for i=1:f_num-1
g=g+(x(i)/(1+g14(x)))*(1+sin(3*pi*x(i)));
end
g=f_num-g;
end
- 1
- 2
前往页