function [lb,ub,dim,fobj] = Get_Functions_details(F)
switch F
case 'F1'
fobj = @F1;
lb=-100;
ub=100;
dim=30;
case 'F2'
fobj = @F2;
lb=-10;
ub=10;
dim=30;
case 'F3'
fobj = @F3;
lb=-100;
ub=100;
dim=30;
case 'F4'
fobj = @F4;
lb=-100;
ub=100;
dim=30;
case 'F5'
fobj = @F5;
lb=-30;
ub=30;
dim=30;
case 'F6'
fobj = @F6;
lb=-100;
ub=100;
dim=30;
case 'F7'
fobj = @F7;
lb=-1.28;
ub=1.28;
dim=30;
case 'F8'
fobj = @F8;
lb=-500;
ub=500;
dim=30;
case 'F9'
fobj = @F9;
lb=-5.12;
ub=5.12;
dim=30;
case 'F10'
fobj = @F10;
lb=-32;
ub=32;
dim=30;
case 'F11'
fobj = @F11;
lb=-600;
ub=600;
dim=30;
case 'F12'
fobj = @F12;
lb=-50;
ub=50;
dim=30;
case 'F13'
fobj = @F13;
lb=-50;
ub=50;
dim=30;
case 'F14'
fobj = @F14;
lb=-65.536;
ub=65.536;
dim=2;
case 'F15'
fobj = @F15;
lb=-5;
ub=5;
dim=4;
case 'F16'
fobj = @F16;
lb=-5;
ub=5;
dim=2;
case 'F17'
fobj = @F17;
lb=[-5,0];
ub=[10,15];
dim=2;
case 'F18'
fobj = @F18;
lb=-2;
ub=2;
dim=2;
case 'F19'
fobj = @F19;
lb=0;
ub=1;
dim=3;
case 'F20'
fobj = @F20;
lb=0;
ub=1;
dim=6;
case 'F21'
fobj = @F21;
lb=0;
ub=10;
dim=4;
case 'F22'
fobj = @F22;
lb=0;
ub=10;
dim=4;
case 'F23'
fobj = @F23;
lb=0;
ub=10;
dim=4;
case 'F24'
fobj = @F24;
lb=1;
ub=20;
dim=10;
case 'F25'
fobj = @F25;
lb=-1;
ub=1;
inputnum=20;
hiddennum=12;
outputnum=1;
dim=inputnum*hiddennum+hiddennum+hiddennum*outputnum+outputnum;
end
end
% F24
function o = F24(x)
y = zeros(1,19);
gs = [0,0,0,0,0,0,0,0,0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ij)
p0 = ij(jj,:);
d = abs(det(([p2-p1;p0-p1])))/norm(p2-p1);
if d<0.8
pan = pan+1;
break
end
end
if pan==0
y(ii) = sqrt((x(ii+1)-x(ii))^2+1);
else
y(ii) = sqrt((x(ii+1)-x(ii))^2+1)*10;
end
end
o = sum(y);
end
function error =F25(x)
%该函数用来计算适应度值
%x input 个体
%inputnum input 输入层节点数
%outputnum input 隐含层节点数
%net input 网络
%inputn input 训练输入数据
%outputn input 训练输出数据
%error output 个体适应度值
global inputnum
global hiddennum
global outputnum
global net
global inputn
global outputn
global inputn_test
global outputn_test
%提取
w1=x(1:inputnum*hiddennum);
B1=x(inputnum*hiddennum+1:inputnum*hiddennum+hiddennum);
w2=x(inputnum*hiddennum+hiddennum+1:inputnum*hiddennum+hiddennum+hiddennum*outputnum);
B2=x(inputnum*hiddennum+hiddennum+hiddennum*outputnum+1:inputnum*hiddennum+hiddennum+hiddennum*outputnum+outputnum);
net1 = net;
%net=newff(inputn,outputn,hiddennum);
%网络进化参数
net1.trainParam.epochs=10;
net1.trainParam.lr=0.1;
net1.trainParam.goal=0.00001;
%net.trainParam.show=200;
net1.trainParam.showWindow=false;
%网络权值赋值
net1.iw{1,1}=reshape(w1,hiddennum,inputnum);
%net.iw{1,1}=reshape(w1,hiddennum,1);
net1.lw{2,1}=reshape(w2,outputnum,hiddennum);
net1.b{1}=reshape(B1,hiddennum,1);
net1.b{2}=reshape(B2,outputnum,1);
%网络训练
% net1=train(net1,inputn,outputn);
an=sim(net1,inputn);
error=sum(abs(an(:)-outputn(:)));
end
function o=Ufun(x,a,k,m)
o=k.*((x-a).^m).*(x>a)+k.*((-x-a).^m).*(x<(-a));
end