网站404网页界面psd源文件模板,湖南app开发,WordPress古腾堡插件,商城网站的模块设计一. 真菌生长优化算法#xff08;FGO#xff09;
真菌生长优化算法#xff08;Fungal Growth Optimizer#xff0c;FGO#xff09;是一种新型的自然启发式元启发式算法#xff0c;其灵感来源于自然界中真菌的生长行为。该算法通过模拟真菌的菌丝尖端生长、分支和孢子萌发…一. 真菌生长优化算法FGO
真菌生长优化算法Fungal Growth OptimizerFGO是一种新型的自然启发式元启发式算法其灵感来源于自然界中真菌的生长行为。该算法通过模拟真菌的菌丝尖端生长、分支和孢子萌发等行为提供了一系列的探索和开发操作符以解决复杂的优化问题。FGO算法在多个领域展现出了良好的性能尤其是在解决高维问题和避免陷入局部最优方面具有显著优势。
1、算法原理
FGO算法的核心在于模拟真菌的三种主要生长行为菌丝尖端生长、分支和孢子萌发。这些行为在算法中分别对应不同的搜索策略以实现对解空间的有效探索和开发。 菌丝尖端生长Hyphal Tip Growth 菌丝尖端生长是真菌寻找营养物质的主要方式。在FGO算法中这一行为通过模拟菌丝在搜索空间中的线性生长来实现。菌丝会根据环境中的营养浓度调整其生长方向以找到营养丰富的区域。这种行为在算法中提供了主要的探索能力帮助算法在解空间中广泛搜索。 分支Branching 分支行为允许真菌从现有的菌丝侧枝上生长出新的菌丝以进一步探索周围的环境。在FGO算法中分支行为通过在现有解的基础上生成新的解来实现从而增强了算法的探索能力。这种机制有助于算法在解空间中发现更多的潜在最优解。 孢子萌发Spore Germination 孢子萌发是真菌繁殖的重要方式。在FGO算法中孢子萌发行为通过在搜索空间中随机生成新的解来实现。这些新的解在算法的早期阶段具有较高的随机性随着算法的进行它们的位置会逐渐调整到更接近当前最优解的区域。这种机制有助于算法在保持种群多样性的同时逐步收敛到最优解。
2、算法流程
输入种群规模 N N N最大迭代次数 t max t_{\max} tmax随机数 r 0 , r 10 , r 2 , r 8 r_0, r_{10}, r_2, r_8 r0,r10,r2,r8以及其他相关参数。
输出最优解 S ∗ S^* S∗。 初始化 使用公式 (1) 初始化 N N N 个菌丝个体 S i t S_i^t Sit。评估每个 S i t S_i^t Sit 的适应度值并确定适应度值最高的个体作为当前最优解 S ∗ S^* S∗。设置迭代计数器 t 1 t 1 t1。 迭代过程 当 t t max t t_{\max} ttmax 时执行以下步骤 生成两个随机数 r 0 r_0 r0 和 r 10 r_{10} r10取值范围为 [0, 1]。如果 r 0 r 10 r_0 r_{10} r0r10执行菌丝尖端生长行为 对于每个菌丝个体 i 1 i 1 i1 到 N N N 根据公式 (24) 和 (23) 计算能量 E i E_i Ei 和概率 p i p_i pi。如果 p i E i p_i E_i piEi探索阶段 I 使用公式 (8) 更新 S i t 1 S_i^{t1} Sit1。 否则开发阶段 I 使用公式 (22) 更新 S i t 1 S_i^{t1} Sit1。 如果新解 S i t 1 S_i^{t1} Sit1 的适应度值小于当前解 S i t S_i^t Sit 的适应度值 更新当前解 S i t S i t 1 S_i^t S_i^{t1} SitSit1。 迭代计数器加 1 t t 1 t t 1 tt1。 否则执行菌丝分支和孢子萌发行为 对于每个菌丝个体 i 1 i 1 i1 到 N N N 生成两个随机数 r 2 r_2 r2 和 r 8 r_8 r8取值范围为 [0, 1]。如果 r 2 0.5 r_2 0.5 r20.5菌丝分支 使用公式 (30) 更新 S i t 1 S_i^{t1} Sit1。 否则孢子萌发 使用公式 (31) 更新 S i t 1 S_i^{t1} Sit1。 如果新解 S i t 1 S_i^{t1} Sit1 的适应度值小于当前解 S i t S_i^t Sit 的适应度值 更新当前解 S i t S i t 1 S_i^t S_i^{t1} SitSit1。 迭代计数器加 1 t t 1 t t 1 tt1。 结束条件 当迭代次数 t t t 达到最大迭代次数 t max t_{\max} tmax 时算法结束。输出最优解 S ∗ S^* S∗。
3、 详细步骤说明 初始化 随机生成 N N N 个初始菌丝个体每个个体代表一个潜在的解。评估每个个体的适应度值找到当前最优解 S ∗ S^* S∗。 菌丝尖端生长行为 通过比较随机数 r 0 r_0 r0 和 r 10 r_{10} r10决定是否执行菌丝尖端生长行为。对于每个菌丝个体计算其能量 E i E_i Ei 和概率 p i p_i pi。根据 p i p_i pi 和 E i E_i Ei 的关系决定是进行探索阶段 I 还是开发阶段 I。使用相应的公式更新菌丝个体的位置。如果新位置的适应度值更好则接受新位置。 菌丝分支和孢子萌发行为 如果不执行菌丝尖端生长行为则执行菌丝分支和孢子萌发行为。对于每个菌丝个体生成随机数 r 2 r_2 r2 和 r 8 r_8 r8。根据 r 2 r_2 r2 的值决定是进行菌丝分支还是孢子萌发。使用相应的公式更新菌丝个体的位置。如果新位置的适应度值更好则接受新位置。 迭代更新 每次更新后检查是否满足终止条件达到最大迭代次数。如果满足条件则输出最优解否则继续下一次迭代。 参考文献 [1]Abdel-Basset M, Mohamed R, Abouhawwash M. Fungal growth optimizer: A novel nature-inspired metaheuristic algorithm for stochastic optimization[J]. Computer Methods in Applied Mechanics and Engineering, 2025, 437: 117825.
二、核心MATLAB代码
% The Fungal Growth Optimizer
function [Gb_Fit,Gb_Sol,Conv_curve]FGO(N,Tmax,ub,lb,dim,Fun_No,fhd)
%%%%-------------------Definitions--------------------------%%
%%
Gb_Solzeros(1,dim); % A vector to include the best-so-far solution
Gb_Fitinf; % A Scalar variable to include the best-so-far score
Conv_curvezeros(1,Tmax);
%%-------------------Controlling parameters--------------------------%%
%%
M0.6; %% Determines the tradeoff percent between exploration and exploitation operators.
Ep0.7; %% Determines the probability of environmental effect on hyphal growth
R0.9; %% Determines the speed of convergence to the best-so-far solution
%%---------------Initialization----------------------%%
%%
Sinitialization(N,dim,ub,lb); % Initialize the S of crested porcupines
t0; %% Function evaluation counter
%%---------------------Evaluation-----------------------%%
for i1:N%% Test suites of CEC-2014, CEC-2017, CEC-2020, and CEC-2022fit(i)feval(fhd, S(i,:),Fun_No);
end
% Update the best-so-far solution
[Gb_Fit,index]min(fit);
Gb_SolS(index,:);
%% A new vector to store the best-so-far position for each hyphae
SpS;
optFun_No*100; %% Best-known fitness
%% Optimization Process of FGO
while tTmax opt~Gb_Fit%% ----------------------------------------------------------------------------- %%if t Tmax/2 %% Compute the the nutrient allocation according to (12)nutrients rand(N); % Allocate more randomly to encourage fluctuation exploitationelsenutrients fit; % Exploitation phase: allocate based on fitnessendnutrients nutrients / sum(nutrients)2*rand; % Normalize nutrient allocation according to (13)%% ----------------------------------------------------------------------------- %%if randrand %% Hyphal tip growth behavior %%for i1:Narandi(N);brandi(N);crandi(N);while ai | ab | cb | ca ||ci |biarandi(N);brandi(N);crandi(N);endp(fit(i)-min(fit))/(max(fit)-min(fit)eps); %%% Compute p_i according to (23)ErM(1-t/(Tmax)).*(1-M); %%% Compute Er according to (24)if pErF(fit(i)/(sum(fit))).*rand*(1-t/(Tmax))^(1-t/(Tmax)); %% Calculate F according to (5) and (6)Eexp(F); %% Calculate E according to (4)r1rand(1,dim);r2rand;U1r1r2; %% Binary vectorS(i,:) (U1).*S(i,:)(1-U1).*(S(i,:)E.*(S(a,:)-S(b,:))); %% Generate the new hyphal growth according to (9)elseEc (rand(1, dim) - 0.5) .* rand.*(S(a,:)-S(b,:)); % Compute the additional exploratory step using (17)if randrand %% Hypha growing in the opposite direction of nutrient-rich areas %De2 rand(1,dim).* (S(i,:) - Gb_Sol).*(rand(1,dim)rand); %% Compute De2 according to (16) %%S(i,:) S(i,:) De2 .* nutrients(i)Ec*(randrand); %% Compute the new growth for the ith hyphal using (15)else %% Growth direction toward nutrient-rich areaDe rand.* (S(a, :) - S(i, :)) rand(1,dim).* ((randrand*2-1).*Gb_Sol - S(i, :)).*(rand()R); %% Compute De according to (11) %%S(i,:) S(i,:) De .* nutrients(i)Ec*(randEp); %% Compute the new growth for the ith hyphal using (14)endend%% Return the search agents that exceed the search spaces boundsfor j1:size(S,2)if S(i,j)ub(j)S(i,j)lb(j)rand*(ub(j)-lb(j));elseif S(i,j)lb(j)S(i,j)lb(j)rand*(ub(j)-lb(j));endend% Calculate the fitness value of the newly generated solutionnFfeval(fhd, S(i,:),Fun_No);%% update Global Local best solutionif fit(i)nFS(i,:)Sp(i,:); % Update local best solutionelseSp(i,:)S(i,:);fit(i)nF;%% update Global best solutionif fit(i)Gb_FitGb_SolS(i,:); % Update global best solutionGb_Fitfit(i);endendtt1; % Move to the next generationif tTmaxbreakendConv_curve(t)Gb_Fit;endif tTmaxbreak;endelser5rand;for i1:Nrrrand(1,dim);arandi(N);brandi(N);crandi(N);while ai | ab | cb | ca ||ci |biarandi(N);brandi(N);crandi(N);endif rand0.5 %% Hyphal branchingEL1exp(fit(i)/(sum(fit)))*(randrand); %% Compute the growth rate of the hypha produced via lateral branching using (29)Dep1(S(b,:)-S(c,:)); %% Compute Dep1 using (26)Dep2(S(a,:)-Gb_Sol); %% Compute Dep1 using (27)r1rand(1,dim);r2rand;U1r1r2; %% Binary vectorS(i,:) S(i,:).*U1(S(i,:) r5.*Dep1.*EL (1-r5).*Dep2.*EL).*(1-U1); % Generate the new branch for the ith hyphal using (30)else %% Spore germinationsig(randrand*2-1); %% 1 or -1F(fit(i)/(sum(fit))).*rand*(1-t/(Tmax))^(1-t/(Tmax)); %% Calculate F according to (5) and (6)Eexp(F); %% Calculate E according to (4)for j1:size(S,2)musig.*rand.*E;if randrandS(i,j)(((t/(Tmax))*Gb_Sol(j)(1-t/(Tmax))*S(a,j))S(b,j))/2.0 mu * abs((S(c,j)S(a,j)S(b,j))/3.0-S(i,j)); % Eq. (31)endendend%% Return the search agents that exceed the search spaces boundsfor j1:size(S,2)if S(i,j)ub(j)S(i,j)lb(j)rand*(ub(j)-lb(j));elseif S(i,j)lb(j)S(i,j)lb(j)rand*(ub(j)-lb(j));endend% Calculate the fitness value of the newly generated solutionnFfeval(fhd, S(i,:),Fun_No);%% update Global Local best solutionif fit(i)nFS(i,:)Sp(i,:); % Update local best solutionelseSp(i,:)S(i,:);fit(i)nF;%% update Global best solutionif fit(i)Gb_FitGb_SolS(i,:); % Update global best solutionGb_Fitfit(i);endendtt1; % Move to the next generationif tTmaxbreakendConv_curve(t)Gb_Fit;end %% End for iend %% End Ifif tTmaxbreak;end
end%% End while
end
%_________________________________________________________________________%
% Fungal Growth Optimizer source code demo 1.0 %
% Developed in MATLAB R2019A %
% %
% %
% Main paper: Fungal Growth Optimizer: A Novel Nature-inspired Metaheuristic Algorithm for Stochastic Optimization %
% %
% %
%_________________________________________________________________________%
% This function initialize the first population of search agents
function Positionsinitialization(SearchAgents_no,dim,ub,lb)
Boundary_no length(ub); % numnber of boundaries
% If the boundaries of all variables are equal and user enter a signle
% number for both ub and lb
if Boundary_no1Positionsrand(SearchAgents_no,dim).*(ub-lb)lb;
end
% If each variable has a different lb and ub
if Boundary_no1for i1:dimub_iub(i);lb_ilb(i);Positions(:,i)rand(SearchAgents_no,1).*(ub_i-lb_i)lb_i; end
end
文章转载自: http://www.morning.gjlml.cn.gov.cn.gjlml.cn http://www.morning.nrtpb.cn.gov.cn.nrtpb.cn http://www.morning.bbgr.cn.gov.cn.bbgr.cn http://www.morning.ttryd.cn.gov.cn.ttryd.cn http://www.morning.rswfj.cn.gov.cn.rswfj.cn http://www.morning.lqlhw.cn.gov.cn.lqlhw.cn http://www.morning.lizpw.com.gov.cn.lizpw.com http://www.morning.dpsyr.cn.gov.cn.dpsyr.cn http://www.morning.zrgdd.cn.gov.cn.zrgdd.cn http://www.morning.mqffm.cn.gov.cn.mqffm.cn http://www.morning.lynkz.cn.gov.cn.lynkz.cn http://www.morning.hdqqr.cn.gov.cn.hdqqr.cn http://www.morning.tbjtp.cn.gov.cn.tbjtp.cn http://www.morning.qswws.cn.gov.cn.qswws.cn http://www.morning.gwhjy.cn.gov.cn.gwhjy.cn http://www.morning.qlwfz.cn.gov.cn.qlwfz.cn http://www.morning.bpmdr.cn.gov.cn.bpmdr.cn http://www.morning.sjli222.cn.gov.cn.sjli222.cn http://www.morning.rqhbt.cn.gov.cn.rqhbt.cn http://www.morning.hrnrx.cn.gov.cn.hrnrx.cn http://www.morning.schwr.cn.gov.cn.schwr.cn http://www.morning.qcwck.cn.gov.cn.qcwck.cn http://www.morning.nrjr.cn.gov.cn.nrjr.cn http://www.morning.wnmdt.cn.gov.cn.wnmdt.cn http://www.morning.cnvlog.cn.gov.cn.cnvlog.cn http://www.morning.rfjmy.cn.gov.cn.rfjmy.cn http://www.morning.nrfrd.cn.gov.cn.nrfrd.cn http://www.morning.mqwnp.cn.gov.cn.mqwnp.cn http://www.morning.sqskm.cn.gov.cn.sqskm.cn http://www.morning.rlkgc.cn.gov.cn.rlkgc.cn http://www.morning.kmqjx.cn.gov.cn.kmqjx.cn http://www.morning.gfhng.cn.gov.cn.gfhng.cn http://www.morning.yqzyp.cn.gov.cn.yqzyp.cn http://www.morning.plqkz.cn.gov.cn.plqkz.cn http://www.morning.lmknf.cn.gov.cn.lmknf.cn http://www.morning.fhlfp.cn.gov.cn.fhlfp.cn http://www.morning.rtbhz.cn.gov.cn.rtbhz.cn http://www.morning.sbyhj.cn.gov.cn.sbyhj.cn http://www.morning.tjwlp.cn.gov.cn.tjwlp.cn http://www.morning.xkwrb.cn.gov.cn.xkwrb.cn http://www.morning.dbddm.cn.gov.cn.dbddm.cn http://www.morning.mfcbk.cn.gov.cn.mfcbk.cn http://www.morning.wjrtg.cn.gov.cn.wjrtg.cn http://www.morning.qxrct.cn.gov.cn.qxrct.cn http://www.morning.csznh.cn.gov.cn.csznh.cn http://www.morning.rbgwj.cn.gov.cn.rbgwj.cn http://www.morning.knpmj.cn.gov.cn.knpmj.cn http://www.morning.zlhbg.cn.gov.cn.zlhbg.cn http://www.morning.nqmdc.cn.gov.cn.nqmdc.cn http://www.morning.spkw.cn.gov.cn.spkw.cn http://www.morning.yxwcj.cn.gov.cn.yxwcj.cn http://www.morning.fslxc.cn.gov.cn.fslxc.cn http://www.morning.clccg.cn.gov.cn.clccg.cn http://www.morning.mjqms.cn.gov.cn.mjqms.cn http://www.morning.gwjsm.cn.gov.cn.gwjsm.cn http://www.morning.cklgf.cn.gov.cn.cklgf.cn http://www.morning.kpgms.cn.gov.cn.kpgms.cn http://www.morning.nyhtf.cn.gov.cn.nyhtf.cn http://www.morning.rkkh.cn.gov.cn.rkkh.cn http://www.morning.dwrjj.cn.gov.cn.dwrjj.cn http://www.morning.cyysq.cn.gov.cn.cyysq.cn http://www.morning.dpsyr.cn.gov.cn.dpsyr.cn http://www.morning.ynbyk.cn.gov.cn.ynbyk.cn http://www.morning.qljxm.cn.gov.cn.qljxm.cn http://www.morning.rhpy.cn.gov.cn.rhpy.cn http://www.morning.chgmm.cn.gov.cn.chgmm.cn http://www.morning.ckcjq.cn.gov.cn.ckcjq.cn http://www.morning.skbhl.cn.gov.cn.skbhl.cn http://www.morning.qyqdz.cn.gov.cn.qyqdz.cn http://www.morning.mkczm.cn.gov.cn.mkczm.cn http://www.morning.hflrz.cn.gov.cn.hflrz.cn http://www.morning.syqtt.cn.gov.cn.syqtt.cn http://www.morning.qhkx.cn.gov.cn.qhkx.cn http://www.morning.zymgs.cn.gov.cn.zymgs.cn http://www.morning.zsgbt.cn.gov.cn.zsgbt.cn http://www.morning.fpbj.cn.gov.cn.fpbj.cn http://www.morning.lcqrf.cn.gov.cn.lcqrf.cn http://www.morning.ltksw.cn.gov.cn.ltksw.cn http://www.morning.nxfwf.cn.gov.cn.nxfwf.cn http://www.morning.chjnb.cn.gov.cn.chjnb.cn