智能优化算法:蜜獾算法
文章目录
摘要:蜜獾算法(Honey Badger Algorithm,HBA)是于2021年提出的一种新型智能优化算法,该算法主要通过模拟蜜獾智能觅食行为来进行寻优,具有寻优能力强,收敛速度快等特点。
1.算法原理
1.1 种群初始化
与其他优化算法一样,种群初始化在设定的边界范围内随机初始化,具体如表达式(1)所示:
x
i
=
l
b
i
+
r
1
∗
(
u
b
i
−
l
b
i
)
(1)
x_i=lb_i+r_1*(ub_i-lb_i)\tag{1}
xi=lbi+r1∗(ubi−lbi)(1)
其中,
l
b
lb
lb和
u
b
ub
ub为搜索的下边界和上边界。
r
1
r_1
r1为[0,1]之间的随机数。
x
i
x_i
xi为种群里面的第
i
i
i个个体。
1.2 强度(I)的定义
强度的定义如式(2)所示。强度和猎物的集中力以及和蜜獾之间的距离有关。
I
i
I_i
Ii是猎物的气味强度;如果气味高,则运动速度快,反之亦然。
{
I
i
=
r
2
S
4
π
d
i
2
S
=
(
x
i
−
x
i
+
1
)
2
d
i
=
x
p
r
e
y
−
x
i
(2)
\begin{cases} I_i=r_2\frac{S}{4\pi d_i^2}\\ S=(x_i-x_{i+1})^2\\ d_i=x_{prey}-x_i \end{cases}\tag{2}
⎩⎪⎨⎪⎧Ii=r24πdi2SS=(xi−xi+1)2di=xprey−xi(2)
其中,
S
S
S是源强度或集中强度;
d
i
d_i
di表示猎物与当前蜜獾个体的距离。
1.3 密度因子更新
密度因子
α
\alpha
α控制时变随机化,以确保从勘探到开采的平稳过渡。如式(3)所示:
α
=
C
∗
e
x
p
(
−
t
t
m
a
x
)
(3)
\alpha = C*exp(\frac{-t}{t_{max}})\tag{3}
α=C∗exp(tmax−t)(3)
其中,
t
m
a
x
t_{max}
tmax为最大迭代次数;
C
≥
1
C\geq 1
C≥1(默认为2)。
1.4 跳出局部最优
这一步和接下来的两步用于跳出局部最优区域。在这种情况下,所提出的算法使用了一个改变搜索方向的标志F FF,以利用大量机会让搜索个体严格扫描搜索空间。
1.5更新个体位置
如前所述,HBA位置更新过程( x n e w x_{new} xnew)分为两个部分,即“挖掘阶段”和“采蜜阶段”。
1.5.1 挖掘阶段
在挖掘阶段,蜜獾执行类似于心脏线形状的动作。心形运动可通过式(4)进行模拟:
x
n
e
w
=
x
p
r
e
y
+
F
∗
β
∗
I
∗
x
p
r
e
y
+
F
∗
r
3
∗
α
∗
d
i
∗
∣
c
o
s
(
2
∗
π
∗
r
4
)
∗
[
1
−
c
o
s
(
2
π
r
5
)
]
∣
(4)
x_{new}=x_{prey} + F*\beta*I*x_{prey}+F*r_3*\alpha*d_i*|cos(2*\pi*r_4)*[1-cos(2\pi r_5)]| \tag{4}
xnew=xprey+F∗β∗I∗xprey+F∗r3∗α∗di∗∣cos(2∗π∗r4)∗[1−cos(2πr5)]∣(4)
其中,
x
p
r
e
y
x_{prey}
xprey为全局最优位置;
β
≥
1
\beta\geq 1
β≥1代表蜜獾获取食物的能力;
d
i
d_i
di为猎物与当前蜜獾个体的距离见式(2);
r
3
,
r
4
,
r
5
r_3,r_4,r_5
r3,r4,r5是[0,1]之间的三个不同的随机数;F为改变搜索方向的标志,具体见表达式(5)
F
=
{
1
,
i
f
r
6
≤
0.5
−
1
,
e
l
s
e
(5)
F=\begin{cases} 1,if\,r_6\leq0.5\\ -1,else \end{cases}\tag{5}
F={1,ifr6≤0.5−1,else(5)
1.5.2 采蜜阶段
蜂蜜獾跟随蜂蜜向导獾到达蜂巢的情况可模拟为式(6):
x
n
e
w
=
x
p
r
e
y
+
F
∗
r
7
∗
α
∗
d
i
(6)
x_{new}=x_{prey}+F*r_7*\alpha*d_i \tag{6}
xnew=xprey+F∗r7∗α∗di(6)
其中,
x
n
e
w
x_{new}
xnew为更新后的蜜獾个体位置;
x
p
r
e
y
x_{prey}
xprey为猎物位置;
F
F
F和
α
\alpha
α分别由式(5)和式(3)确定;
r
7
r_7
r7为(0,1)之间的随机数。从式(6)可以观察到,根据距离信息
d
i
d_i
di,蜜獾在猎物位置
x
p
r
e
y
x_{prey}
xprey附近进行搜索。在这一阶段,搜索受到随迭代变化的搜索行为
α
\alpha
α的影响。此外,一只蜜獾可能会受到
F
F
F干扰。
算法伪代码如下:
Algorithm 1 Pseudo code of HBA.
Set parameters t max , N,β,C.
Initialize population with random positions.
Evaluate the fitness of each honey badger position x i using objective function and assign to f i , i ∈ [1,2,..., N].
Save best position x prey and assign fitness to f prey .
while t ≤ t max do
Update the decreasing factor α using (3).
for i = 1 to N do
Calculate the intensity I i using Eq. (2).
if r < 0.5 then ▷ r is random number between 0 and 1
Update the position x new using Eq. (4).
else
Update the position x new using Eq. (6).
end if
Evaluate new position and assign to f new .
if f new ≤ f i then
Set x i = x new and f i = f new .
end if
if f new ≤ f prey then
Set x prey = x new and f prey = f new .
end if
end for
end while Stop criteria satisfied.
Return x prey
2.实验结果
3.参考文献
[1] Fatma A. Hashim, Essam H. Houssein, Kashif Hussain, Mai S. Mabrouk, Walid Al-Atabany. Honey Badger Algorithm: New metaheuristic algorithm for solving optimization problems[J]. Mathematics and Computers in Simulation, 2021: 84-110.