1 简介

黏菌优化算法(Slime mould algorithm,SMA)由 Li等于 2020 年提出,其灵感来自于黏菌的扩散和觅食行为,属于元启发算法。具有收敛速度快,寻优能力强的特点。黏菌优化算法用数学模型模仿黏菌觅食行为和形态变化, SMA 包括三个阶段,分别为接近食物阶段、包围食物阶段和抓取食物阶段。

【黏菌优化算法】精英反向与二次插值改进的黏菌算法(ISMA)求解单目标优化问题含Matlab源码_优化算法

【黏菌优化算法】精英反向与二次插值改进的黏菌算法(ISMA)求解单目标优化问题含Matlab源码_lua_02

【黏菌优化算法】精英反向与二次插值改进的黏菌算法(ISMA)求解单目标优化问题含Matlab源码_优化算法_03

【黏菌优化算法】精英反向与二次插值改进的黏菌算法(ISMA)求解单目标优化问题含Matlab源码_参考文献_04

2 部分代码


          
          
%
% "MOSMA: Multi-objective Slime Mould Algorithm Based on Elitist Non-dominated Sorting,"
%
function f = MOSMA(dim,M,lb,ub,N,Max_iter,ishow)
X = zeros(N,dim);
Sol = zeros(N,dim);
weight = ones(N,dim);%fitness weight of each slime mold
%% Initialize the population
for i=1:N
x(i,:)=lb+(ub-lb).*rand(1,dim);
f(i,1:M) = evaluate_objective(x(i,:), M);
end
new_Sol=[x f];
new_Sol = solutions_sorting(new_Sol, M, dim);
for i = 1 : Max_iter
[SmellOrder,SmellIndex] = sort(Sol);
worstFitness = SmellOrder(N);
bestFitness = SmellOrder(1);
S=bestFitness-worstFitness+eps; % plus eps to avoid denominator zero
for k=1:N
if k<=(N/2)
weight(SmellIndex(k),:) = 1+rand()*log10((bestFitness-SmellOrder(k))/(S)+1);
else
weight(SmellIndex(k),:) = 1-rand()*log10((bestFitness-SmellOrder(k))/(S)+1);
end
end
a = atanh(-(i/Max_iter)+1);
b = 1-i/Max_iter;
for j=1:N
best=(new_Sol(j,1:dim) - new_Sol(1,(1:dim)));
if rand<0.03
X(j,:) = (ub-lb).*rand+lb;
else
p =tanh(abs(f(j)-best));
vb = unifrnd(-a,a,1,dim);
vc = unifrnd(-b,b,1,dim);
r = rand();
A = randi([1,N]);
B = randi([1,N]);
if r<p
X(j,:) = best+ vb.*(weight(j,:).*X(A,:)-X(B,:));
else
X(j,:) = best+ vc.*(weight(j,:).*X(A,:)-X(B,:));
end
end
Sol(j,1:dim) = X(j,1:dim);
Flag4ub=Sol(j,1:dim)>ub;
Flag4lb=Sol(j,1:dim)<lb;
Sol(j,1:dim)=(Sol(j,1:dim).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb;
%% Evalute the fitness/function values of the new population
Sol(j, dim+1:M+dim) = evaluate_objective(Sol(j,1:dim),M);
if Sol(j,dim+1:dim+M) <= new_Sol(1,(dim+1:dim+M))
new_Sol(1,1:(dim+M)) = Sol(j,1:(dim+M));
end
end
%% ! Very important to combine old and new bats !
Sort_bats(1:N,:) = new_Sol;
Sort_bats((N + 1):(2*N), 1:M+dim) = Sol;
%% Non-dominated sorting process (a separate function/subroutine)
Sorted_bats = solutions_sorting(Sort_bats, M, dim);
%% Select npop solutions among a combined population of 2*npop solutions
new_Sol = cleanup_batspop(Sorted_bats, M, dim, N);
if rem(i, ishow) == 0
fprintf('Generation: %d\n', i);
end
end
f=new_Sol;
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.

3 仿真结果

【黏菌优化算法】精英反向与二次插值改进的黏菌算法(ISMA)求解单目标优化问题含Matlab源码_优化算法_05

4 参考文献

[1]郭雨鑫, 刘升, 张磊,等. 精英反向与二次插值改进的黏菌算法[J]. 计算机应用研究, 2021, 38(12):6.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

【黏菌优化算法】精英反向与二次插值改进的黏菌算法(ISMA)求解单目标优化问题含Matlab源码_lua_06