【智能算法改进】基于多策略的改进白鲸优化算法求解工程问题


在这里插入图片描述

1.算法原理

【智能算法】白鲸优化算法(BWO)原理及实现

——复现文章:基于多策略的改进白鲸优化算法求解工程问题(Modified beluga whale optimization with multi-strategies for solving engineering problems)

2.改进点

分组聚合策略(Group aggregation strategy)

在集体聚集和觅食时,白鲸会搜索或直接接近种群中的最佳食物源。随着它们靠近,聚集的程度逐渐增加,白鲸的活动范围也会相应减小:
A d = arctan ⁡ ( 2 π ( E v / E v max ⁡ ) 0.5 ) arctan ⁡ ( 2 π ) S s t e p j = ( ( 1 − A d ) ( E v / E v max ⁡ ) 0.5 ) × ( 2 × r a n d − 1 ) { X i T + 1 = A d × ( m e a n T − X i T ) + X i T + S s t e p , r a n d < 0.5 X i T + 1 = A d × ( X b e s t T − X i T ) + X i T , e l s e (1) \begin{gathered} Ad={\frac{\arctan\left(2\pi\left(Ev/Ev_{\max}\right)^{0.5}\right)}{\arctan\left(2\pi\right)}} \\ Sstep_{j}=\left((1-Ad)^{(Ev/Ev_{\max})^{0.5}}\right)\times(2\times rand-1) \\ \begin{cases}X_{i}^{T+1}=Ad\times\left(mean^{T}-X_{i}^{T}\right)+X_{i}^{T}+Sstep,&rand<0.5\\X_{i}^{T+1}=Ad\times\left(X_{\mathrm{best}}^{T}-X_{i}^{T}\right)+X_{i}^{T} ,&else\end{cases} \end{gathered}\tag{1} Ad=arctan(2π)arctan(2π(Ev/Evmax)0.5)Sstepj=((1Ad)(Ev/Evmax)0.5)×(2×rand1){XiT+1=Ad×(meanTXiT)+XiT+Sstep,XiT+1=Ad×(XbestTXiT)+XiT,rand<0.5else(1)
其中 Ev 是当前的评估次数,Evmax 是最大评估次数,Ad 是聚集程度,随着评估次数的增加,聚集程度逐渐从 0 接近 1。

在这里插入图片描述

迁移策略(Migration strategy)

假设白鲸迁移的概率模拟了白鲸迁移的不确定性,即在寻找食物源的连续迁移过程中,白鲸的种群数量随着种群数量的增加而逐渐增加,而种群数量随着种群数量的增加而增加,从而导致白鲸迁移的概率降低。白鲸位置更新:
m f = ( 1 − ( E v / E v m a x ) ) E v E v m a x X i , j T + 1 = ( cos ⁡ ( 2 π r 8 ) 2 ( X i , j T − 1 − X i , j T ) + sin ⁡ ( 2 π r 9 ) 2 ( X r , j T − X i , j T ) ) u r + X i , j T + ( 2 × r 10 − 1 ) , r 11 < m f (2) \begin{gathered} m f=(1-(Ev/Ev_{\mathrm{max}}))^{\frac{Ev}{Ev_{\mathrm{max}}}} \\ X_{i,j}^{T+1}=\left(\cos\left(2\pi r_{8}\right)^{2}\left(X_{i,j}^{T-1}-X_{i,j}^{T}\right)+\sin\left(2\pi r_{9}\right)^{2}\left(X_{r,j}^{T}-X_{i,j}^{T}\right)\right)u_{r} \\ +X_{i,j}^{T}+(2\times r_{10}-1) ,\quad r_{11}<m f \end{gathered}\tag{2} mf=(1(Ev/Evmax))EvmaxEvXi,jT+1=(cos(2πr8)2(Xi,jT1Xi,jT)+sin(2πr9)2(Xr,jTXi,jT))ur+Xi,jT+(2×r101),r11<mf(2)
mf 是迁移概率,随着评估次数的增加,该概率会逐渐从 1 变为 0;这表明白鲸逐渐接近最佳食物源,迁移概率相应减小。vr 是移动速度的大小,是一个取值范围在 (3,9) 内的随机数。

在这里插入图片描述

伪代码

在这里插入图片描述

3.结果展示

CEC2005测试

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

定性分析:种群分布,多样性,探索开发比
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

工程应用

拉/压弹簧设计问题

在这里插入图片描述
压力容器设计问题

在这里插入图片描述

4.参考文献

[1] Jia H, Wen Q, Wu D, et al. Modified beluga whale optimization with multi-strategies for solving engineering problems[J]. Journal of Computational Design and Engineering, 2023, 10(6): 2065-2093.

5.代码获取

以下是一个简单的白鲸优化算法的 Python 实现示例: ```python import numpy as np # 定义目标函数 def objective_function(x): return np.sum(np.square(x)) # 定义白鲸优化算法 def whale_optimization_algorithm(obj_func, num_iterations=100, num_whales=10, search_space=(-100, 100), a=2): # 初始化鲸群 search_min, search_max = search_space dimensions = len(search_min) whales = [] for i in range(num_whales): whale = np.random.uniform(search_min, search_max, dimensions) whales.append(whale) # 开始优化 for t in range(num_iterations): # 计算当前最优解 current_best_whale = None current_best_score = None for whale in whales: score = obj_func(whale) if current_best_score is None or score < current_best_score: current_best_score = score current_best_whale = whale # 遍历所有鲸 for i, whale in enumerate(whales): # 随机选择一个领袖鲸 leader_index = np.random.randint(num_whales) leader = whales[leader_index] # 计算距离和方向 distance = np.abs(leader - whale) direction = leader - whale # 更新位置 a = 2 - t * ((2) / num_iterations) # 动态线性降温参数 b = 1 l = np.random.uniform(-1, 1, dimensions) p = np.random.uniform(0, 1, dimensions) A = a * np.multiply(np.multiply(2 * b, p) - b, np.abs(a * current_best_whale - whale)) C = np.multiply(2 * l, distance) new_whale = whale + A - C # 边界处理 new_whale = np.clip(new_whale, search_min, search_max) # 更新鲸 whales[i] = new_whale return current_best_whale, current_best_score ``` 使用示例: ```python search_min = np.array([-5, -5, -5]) search_max = np.array([5, 5, 5]) best_whale, best_score = whale_optimization_algorithm(objective_function, num_iterations=100, num_whales=10, search_space=(search_min, search_max)) print('Best solution: ', best_whale) print('Best objective function value: ', best_score) ``` 注:以上代码仅作为示例,实际应用中可能需要根据具体情况进行调整和优化。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小O的算法实验室

谢谢大佬的肯定!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值