基本信息
源码名称:智能算法之黏菌算法
源码大小:2.56KB
文件格式:.m
开发语言:MATLAB
更新时间:2021-09-22
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
for i=1:N
for j=1:dim
if i<=(N/2) %Eq.(2.5)
weight(SmellIndex(i),j) = 1 rand()*log10((bestFitness-SmellOrder(i))/(S) 1);
else
weight(SmellIndex(i),j) = 1-rand()*log10((bestFitness-SmellOrder(i))/(S) 1);
end
end
end
if bestFitness < Destination_fitness
bestPositions=X(SmellIndex(1),:);
Destination_fitness = bestFitness;
end
a = atanh(-(it/Max_iter) 1); %Eq.(2.4)
b = 1-it/Max_iter;
for i=1:N
if rand<z %Eq.(2.7)
X(i,:) = (ub-lb)*rand lb;
else
p =tanh(abs(AllFitness(i)-Destination_fitness)); %Eq.(2.2)
vb = unifrnd(-a,a,1,dim); %Eq.(2.3)
vc = unifrnd(-b,b,1,dim);
for j=1:dim
r = rand();
A = randi([1,N]); % two positions randomly selected from population
B = randi([1,N]);
if r<p %Eq.(2.1)
X(i,j) = bestPositions(j) vb(j)*(weight(i,j)*X(A,j)-X(B,j));
else
X(i,j) = vc(j)*X(i,j);
end
end
for i=1:N
for j=1:dim
if i<=(N/2) %Eq.(2.5)
weight(SmellIndex(i),j) = 1 rand()*log10((bestFitness-SmellOrder(i))/(S) 1);
else
weight(SmellIndex(i),j) = 1-rand()*log10((bestFitness-SmellOrder(i))/(S) 1);
end
end
end
if bestFitness < Destination_fitness
bestPositions=X(SmellIndex(1),:);
Destination_fitness = bestFitness;
end
a = atanh(-(it/Max_iter) 1); %Eq.(2.4)
b = 1-it/Max_iter;
for i=1:N
if rand<z %Eq.(2.7)
X(i,:) = (ub-lb)*rand lb;
else
p =tanh(abs(AllFitness(i)-Destination_fitness)); %Eq.(2.2)
vb = unifrnd(-a,a,1,dim); %Eq.(2.3)
vc = unifrnd(-b,b,1,dim);
for j=1:dim
r = rand();
A = randi([1,N]); % two positions randomly selected from population
B = randi([1,N]);
if r<p %Eq.(2.1)
X(i,j) = bestPositions(j) vb(j)*(weight(i,j)*X(A,j)-X(B,j));
else
X(i,j) = vc(j)*X(i,j);
end
end