家用电脑搭建网站广州市口碑好的网站制作排名
web/
2025/9/26 13:05:04/
文章来源:
家用电脑搭建网站,广州市口碑好的网站制作排名,网页设计与制作教学设计,南江县规划和建设局网站目录 1.背景2.算法原理2.1算法思想2.2算法过程 3.代码实现4.参考文献 1.背景
2020年#xff0c;Chou 等人受到水母运动行为启发#xff0c;提出了人工水母搜索算法(Artificial Jellyfish Search Optimizer, JS)。
2.算法原理
2.1算法思想
JS模拟了水母的搜索行为#xf… 目录 1.背景2.算法原理2.1算法思想2.2算法过程 3.代码实现4.参考文献 1.背景
2020年Chou 等人受到水母运动行为启发提出了人工水母搜索算法(Artificial Jellyfish Search Optimizer, JS)。
2.算法原理
2.1算法思想
JS模拟了水母的搜索行为包括追随海流、水母群内的主动和被动运动、时间控制机制以及群聚过程。
2.2算法过程
洋流 海洋中蕴含着大量的营养物质这些物质会吸引水母。洋流的方向是通过对每个水母到处于最佳位置的水母适应度度量所有向量进行平均。 t r e n d → 1 n P o p ∑ t r e n d → i 1 n P o p ∑ ( X ∗ − e c X i ) X ∗ − e c ∑ X i n P o p X ∗ − e c μ \overrightarrow{\mathrm{trend}}\frac{1}{\mathrm{n}_{\mathrm{Pop}}}\sum\overrightarrow{\mathrm{trend}}_{\mathrm{i}}\frac{1}{\mathrm{n}_{\mathrm{Pop}}}\sum\left(X^{*}-\mathrm{e}_{\mathrm{c}}X_{\mathrm{i}}\right)X^{*}-\mathrm{e}_{\mathrm{c}}\frac{\sum X_{\mathrm{i}}}{\mathrm{n}_{\mathrm{Pop}}}X^{*}-\mathrm{e}_{\mathrm{c}}\mu trend nPop1∑trend inPop1∑(X∗−ecXi)X∗−ecnPop∑XiX∗−ecμ 这里令 d f e c μ \mathbf{df}\mathbf{e}_{\mathbf{c}}\mu dfecμ则洋流方向可以描述为 t r e n d → X ∗ − d f \overrightarrow{\mathrm{trend}}\mathrm{X}^{*}-\mathrm{df} trend X∗−df 假设水母在所有维度上分布服从正态空间分布 因此可以进行简化 d f β × r a n d ( 0 , 1 ) × μ \mathrm{df}\beta\times\mathrm{rand}(0,1)\times\mu dfβ×rand(0,1)×μ 每只水母位置更新 X i ( t 1 ) X i ( t ) r a n d ( 0 , 1 ) × ( X ∗ − β × r a n d ( 0 , 1 ) × μ \mathrm{X_i(t1)X_i(t)rand(0,1)\times(X^*-\beta\times rand(0,1)\times\mu} Xi(t1)Xi(t)rand(0,1)×(X∗−β×rand(0,1)×μ 水母群体运动 在群集中水母分别表现出被动类型A和主动类型B的运动 。最初当群集刚形成时大多数水母表现出类型A的运动。随着时间的推移它们逐渐表现出类型B的运动。类型A运动是水母围绕自身位置的运动全局探索每个水母的相应更新位置由: X i ( t 1 ) X i ( t ) γ × r a n d ( 0 , 1 ) × ( U b − L b ) \mathrm{X_i(t1)X_i(t)\gamma\times rand(0,1)\times(U_b-L_b)} Xi(t1)Xi(t)γ×rand(0,1)×(Ub−Lb) B类型运动可以看作种群间根据食物数量适应度衡量进行互相迁移比如当水母 i i i处食物数量大于水母 j j j处则水母 j j j向水母 i i i移动反之亦然。此阶段为局部探索 S t e p X i ( t 1 ) − X i ( t ) Direction → X j ( t ) − X i ( t ) i f f ( X i ) ≥ f ( X j ) X i ( t ) − X j ( t ) i f f ( X i ) f ( X j ) \mathrm{Step}\mathrm{X_i(t1)-X_i(t)} \\ \overrightarrow{\text{Direction}}\begin{matrix}\mathsf{X_j(t)-X_i(t)~if~f(X_i)\geq f(X_j)}\\\mathsf{X_i(t)-X_j(t)~if~f(X_i)f(X_j)}\end{matrix} StepXi(t1)−Xi(t)Direction Xj(t)−Xi(t) if f(Xi)≥f(Xj)Xi(t)−Xj(t) if f(Xi)f(Xj) 其中 S t e p → r a n d ( 0 , 1 ) × D i r e c t i o n → \overrightarrow{\mathrm{Step}}\mathrm{rand}(0,1)\times\overrightarrow{\mathrm{Direction}} Step rand(0,1)×Direction 因此整体可表述为 X i ( t 1 ) X i ( t ) S t e p → \mathrm{X_i(t1)X_i(t)\overrightarrow{Step}} Xi(t1)Xi(t)Step 时间控制机制 海洋流富含营养食物吸引了水母的聚集形成水母群。随着温度或风向变化水母群会转移至新的海洋流形成新的群体。水母群内的水母表现出被动和主动两种运动其偏好会随着时间变化。引入时间控制机制来调节水母在海洋流和群内移动之间的转换。这里是对全局与局部平衡收敛性考虑 c ( t ) ∣ ( 1 − t M a x i t e r ) × ( 2 × r a n d ( 0 , 1 ) − 1 ) ∣ \mathbf{c(t)}\left|\left(1-\frac{\mathbf{t}}{\mathbf{Max}_{\mathrm{iter}}}\right)\times(2\times\mathrm{rand}(0,1)-1)\right| c(t) (1−Maxitert)×(2×rand(0,1)−1) 伪代码
3.代码实现
% 水母搜索算法
function [Best_pos, Best_fitness, Iter_curve, History_pos, History_best] JS(pop, maxIter,lb,ub,dim,fobj)
%input
%pop 种群数量
%dim 问题维数
%ub 变量上边界
%lb 变量下边界
%fobj 适应度函数
%maxIter 最大迭代次数
%output
%Best_pos 最优位置
%Best_fitness 最优适应度值
%Iter_curve 每代最优适应度值
%History_pos 每代种群位置
%History_best 每代最优个体位置
%% 初始化种群
X initialization(pop,dim,ub,lb);
VarSize [1 dim];
%% 计算适应度
popCost zeros(1,pop);
for i1:poppopCost(i) fobj(X(i,:));
end
%% 迭代
for it1:maxIterMeanvlmean(X,1);[value,index]sort(popCost);Best_posX(index(1),:);BestCostpopCost(index(1));for i1:pop% Calculate time control c(t) using Eq. (17);Ar(1-it*((1)/maxIter))*(2*rand-1);if abs(Ar)0.5%% Folowing to ocean current using Eq. (11)newsol X(i,:) rand(VarSize).*(Best_pos - 3*rand*Meanvl);% Check the boundary using Eq. (19)newsol simplebounds(newsol,lb,ub);% EvaluationnewsolCost fobj(newsol);% Comparisonif newsolCostpopCost(i)X(i,:) newsol;popCost(i)newsolCost;if popCost(i) BestCostBestCostpopCost(i);Best_pos X(i,:);endendelse%% Moving inside swarmif rand(1-Ar)% Determine direction of jellyfish by Eq. (15)ji;while jijrandperm(pop,1);endStep X(i,:) - X(j,:);if popCost(j) popCost(i)Step -Step;end% Active motions (Type B) using Eq. (16)newsol X(i,:) rand(VarSize).*Step;else% Passive motions (Type A) using Eq. (12)newsol X(i,:) 0.1*(ub-lb)*rand;end% Check the boundary using Eq. (19)newsol simplebounds(newsol, lb,ub);% EvaluationnewsolCost fobj(newsol);% Comparisonif newsolCostpopCost(i)X(i,:) newsol;popCost(i)newsolCost;if popCost(i) BestCostBestCostpopCost(i);Best_pos X(i,:);endendendend%% Store Record for Current IterationIter_curve(it)BestCost;Best_fitness BestCost;History_best{it} Best_pos;History_pos{it} X;
end
end
%% This function is for checking boundary by using Eq. 19
function ssimplebounds(s,Lb,Ub)
ns_tmps;
Ins_tmpLb;
% Apply to the lower bound
while sum(I)~0ns_tmp(I)Ub(I)(ns_tmp(I)-Lb(I));Ins_tmpLb;
end
% Apply to the upper bound
Jns_tmpUb;
while sum(J)~0ns_tmp(J)Lb(J)(ns_tmp(J)-Ub(J));Jns_tmpUb;
end
% Check results
sns_tmp;
end
%%
function popinitialization(num_pop,nd,Ub,Lb)if size(Lb,2)1LbLb*ones(1,nd);UbUb*ones(1,nd);
end
x(1,:)rand(1,nd);
a4;
for i1:(num_pop-1)x(i1,:)a*x(i,:).*(1-x(i,:));
end
for k1:ndfor i1:num_poppop(i,k)Lb(k)x(i,k)*(Ub(k)-Lb(k));end
end
end4.参考文献
[1] Chou J S, Truong D N. A novel metaheuristic optimizer inspired by behavior of jellyfish in ocean[J]. Applied Mathematics and Computation, 2021, 389: 125535.
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/82205.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!