💥1 概述
在本文中,Slime-Mould-Algorithm(SMA)的性能得到了提高,这是一种当前的元启发式搜索算法。为了在SMA算法中更有效地对搜索过程生命周期过程进行建模,使用适应度-距离平衡(FDB)方法确定了指导搜索过程的候选解决方案。虽然SMA算法的性能被接受,但可以看出,由于应用FDB方法而开发的FDB-SMA算法的性能要好得多。CEC 2020 当前存在基准问题,用于测试开发的 FDB-SMA 算法的性能。从CEC 2020中选取的10个不同的无约束比较问题,将它们按30-50-100个维度排列,进行了设计。使用设计的比较问题进行实验研究,并用Friedman和Wilcoxon统计测试方法进行分析。根据分析结果,已经看到FDB-SMA变体在所有实验研究中都优于基本算法(SMA)。
📚2 运行结果
部分代码:
% Max_iter: maximum iterations, N: populatoin size, Convergence_curve: Convergence curve % To run SMA: [Destination_fitness,bestPositions,Convergence_curve]=SMA(N,Max_iter,lb,ub,dim,fobj) %function [Destination_fitness,bestPositions,Convergence_curve]=sma(N,Max_iter,lb,ub,dim,fobj) function[] = FDB_sma_case_1() disp('SMA is now tackling your problem') [N,dim,Max_iter ,lb,ub]=problem_terminate(); %fhd=cec20so; % initialize position bestPositions=zeros(1,dim); Destination_fitness=inf;%change this to -inf for maximization problems AllFitness = inf*ones(N,1);%record the fitness of all slime mold weight = ones(N,dim);%fitness weight of each slime mold %Initialize the set of random solutions X=initialization(N,dim,ub,lb); Convergence_curve=zeros(1,Max_iter); it=1; %Number of iterations lb=ones(1,dim).*lb; % lower boundary ub=ones(1,dim).*ub; % upper boundary z=0.03; % parameter % Main loop while it <= Max_iter disp(it) fdbindex = fitnessDistanceBalance( X, Destination_fitness ); %sort the fitness for i=1:N % Check if solutions go outside the search space and bring them back Flag4ub=X(i,:)>ub; Flag4lb=X(i,:)<lb; X(i,:)=(X(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb; %AllFitness(i) = fobj(X(i,:)); AllFitness(i)=problem( X(i,:)' ); it=it+1; end [SmellOrder,SmellIndex] = sort(AllFitness); %Eq.(2.6) worstFitness = SmellOrder(N); bestFitness = SmellOrder(1); S=bestFitness-worstFitness+eps; % plus eps to avoid denominator zero %calculate the fitness weight of each slime mold 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);%fdb else weight(SmellIndex(i),j) = 1-rand()*log10((bestFitness-SmellOrder(i))/(S)+1);%fdb end end end %update the best fitness value and best position 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; % Update the Position of search agents for i=1:N if rand<z %Eq.(2.7) X(i,:) = (ub-lb)*rand+lb; else if(rand<0.5) p =tanh(abs(AllFitness(fdbindex)-Destination_fitness)); %Eq.(2.2)%fdb else p =tanh(abs(AllFitness(i)-Destination_fitness)); %Eq.(2.2)%fdb end 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) if(rand<0.5) X(i,j) = bestPositions(j)+ vb(j)*(weight( fdbindex,j)*X(fdbindex,j)-X(fdbindex,j));%fdb else X(i,j) = bestPositions(j)+ vb(j)*(weight( i,j)*X(A,j)-X(B,j));%fdb end else X(i,j) = vc(j)*X(fdbindex,j);%fdb end end end end Convergence_curve(it)=Destination_fitness; %it=it+1; end bestSolution=bestPositions; bestFitness= Destination_fitness; iteration=it; disp(it) end function Positions=initialization(SearchAgents_no,dim,ub,lb) Boundary_no= size(ub,2); % numnber of boundaries % If the boundaries of all variables are equal and user enter a signle % number for both ub and lb if Boundary_no==1 Positions=rand(SearchAgents_no,dim).*(ub-lb)+lb; end % If each variable has a different lb and ub if Boundary_no>1 for i=1:dim ub_i=ub(i); lb_i=lb(i); Positions(:,i)=rand(SearchAgents_no,1).*(ub_i-lb_i)+lb_i; end end end
🌈3 Matlab代码实现
🎉4 参考文献
部分理论来源于网络,如有侵权请联系删除。
[1]SUİÇMEZ, Ç., KAHRAMAN, H., YILMAZ, C., IŞIK, M. F., & CENGİZ, E. Improved Slime-Mould-Algorithm with Fitness Distance Balance-based Guiding Mechanism for Global Optimization Problems. Duzce University Journal of Science and Technology, 9(6), 40-54.