1.背景
2021年,I Ahmadianfar等人受到四阶龙格库塔数值方法启发,提出了龙格库塔优化算法(Runge Kutta optimizer, RUN)。
2.算法原理
2.1算法思想
RUN基于四阶龙格库塔法,以梯度作为搜索方向,并基于强化个体质量机制,建立种群的更新规则。
2.2算法过程
RUN基于四阶龙格库塔算法:
S
M
=
1
6
(
x
R
K
)
Δ
x
x
R
K
=
k
1
+
2
×
k
2
+
2
×
k
3
+
k
4
(1)
SM=\frac{1}{6}(x_{RK})\Delta x\\ x_{RK}=k_1+2\times k_2+2\times k_3+k_4\tag{1}
SM=61(xRK)ΔxxRK=k1+2×k2+2×k3+k4(1)
个体更新:
RUN 基于四阶龙格库塔法得到的SM进行更新:
X
n
+
1
=
{
(
X
p
+
r
×
S
F
×
g
×
X
p
)
+
S
F
×
S
M
+
μ
×
r
a
n
d
n
×
(
X
m
−
X
p
)
,
r
a
n
d
<
0.5
(
X
m
+
r
×
S
F
×
g
×
X
m
)
+
S
F
×
S
M
+
μ
×
r
a
n
d
n
×
(
X
A
−
X
B
)
,
r
a
n
d
≥
0.5
(2)
X_{n+1}=\begin{aligned}\\&\begin{cases}\left(X_p+r\times SF\times g\times X_p\right)+\\SF\times SM+\mu\times randn\times\left(X_m-X_p\right),rand<0.5\\\left(X_m+r\times SF\times g\times X_m\right)+\\SF\times SM+\mu\times randn\times\left(X_A-X_B\right),rand\geq0.5&\end{cases}\end{aligned}\tag{2}
Xn+1=⎩
⎨
⎧(Xp+r×SF×g×Xp)+SF×SM+μ×randn×(Xm−Xp),rand<0.5(Xm+r×SF×g×Xm)+SF×SM+μ×randn×(XA−XB),rand≥0.5(2)
其中,方向因子r是一个值为 1 或-1 的整数;Xp为勘探领导者;Xm为开发领导者;SF为平衡因子;SM为领导搜索因子。
位置增量为:
Δ
X
=
2
×
r
a
n
d
×
∣
S
t
p
∣
S
t
p
=
r
a
n
d
×
(
(
X
b
−
r
a
n
d
×
X
a
ν
g
)
+
γ
)
γ
=
r
a
n
d
×
(
X
n
−
r
a
n
d
×
(
u
b
−
l
b
)
)
×
e
(
−
4
×
i
M
a
x
i
)
(3)
\begin{gathered} \Delta X=2{\times}rand{\times}|Stp| \\ Stp=rand\times\left(\left(X_b-rand\times X_{a\nu g}\right)+\gamma\right) \\ \gamma=rand\times\left(X_{n}-rand\times\left(ub-lb\right)\right)\times\mathrm{e}^{\left(-4\times\frac{i}{Maxi}\right)} \end{gathered}\tag{3}
ΔX=2×rand×∣Stp∣Stp=rand×((Xb−rand×Xaνg)+γ)γ=rand×(Xn−rand×(ub−lb))×e(−4×Maxii)(3)
领导者为:
X
p
=
φ
×
X
n
+
(
1
−
φ
)
×
X
A
X
m
=
φ
×
X
b
e
s
t
+
(
1
−
φ
)
×
X
l
b
e
s
t
(4)
\begin{aligned}&X_{p}=\varphi\times X_{n}+(1-\varphi)\times X_{A}\\&X_{m}=\varphi\times X_{best}+(1-\varphi)\times X_{lbest}\end{aligned}\tag{4}
Xp=φ×Xn+(1−φ)×XAXm=φ×Xbest+(1−φ)×Xlbest(4)
平衡因子SF为:
S
F
=
2
⋅
(
0.5
−
r
a
n
d
)
×
a
×
e
(
−
b
×
r
a
n
d
×
i
M
a
x
i
)
(5)
SF=2\cdot(0.5-rand)\times a\times\mathrm{e}^{\left(-b\times rand\times\frac{i}{Maxi}\right)}\tag{5}
SF=2⋅(0.5−rand)×a×e(−b×rand×Maxii)(5)
强化个体质量:
为了提高个体质量,防止算法陷入局部最优,RUN使用强化个体质量 (Enhanced solution quality, ESQ)对更新后的个体进行质量增强:
x
n
e
w
2
=
{
x
n
e
w
1
+
r
w
∣
(
x
n
e
w
1
−
x
a
v
g
)
+
r
a
n
d
n
∣
,
r
a
n
d
<
0.5
,
w
<
1
(
x
n
e
w
1
−
x
a
v
g
)
+
r
w
∣
(
u
x
n
e
w
1
−
x
a
v
g
)
+
r
a
n
d
n
∣
,
r
a
n
d
<
0.5
,
w
≥
1
(6)
\mathrm{x_{new2}=\begin{cases}x_{new1}+rw|(x_{new_{1}}-x_{avg})+randn|,rand<0.5,w<1\\(x_{new1}-x_{avg})+rw|(ux_{new1}-x_{avg})+randn|,rand<0.5,w\geq1&&\end{cases}}\tag{6}
xnew2={xnew1+rw∣(xnew1−xavg)+randn∣,rand<0.5,w<1(xnew1−xavg)+rw∣(uxnew1−xavg)+randn∣,rand<0.5,w≥1(6)
其中,参数为:
w
=
r
a
n
d
(
0
,
2
)
∗
e
x
p
(
−
c
i
/
M
a
x
i
)
x
a
v
g
=
x
r
1
+
x
r
2
+
x
r
3
3
x
n
e
w
1
=
β
∗
x
a
v
g
+
(
1
−
β
)
x
b
e
s
t
(7)
\mathrm{w=rand(0,2)*exp(-ci/Max_i)}\\\mathrm{x_{avg}~=~\frac{x_{r1}~+x_{r2}~+x_{r3}}3}\\\mathrm{x_{new1}~=\beta*x_{avg}~+(1-\beta)x_{best}}\tag{7}
w=rand(0,2)∗exp(−ci/Maxi)xavg = 3xr1 +xr2 +xr3xnew1 =β∗xavg +(1−β)xbest(7)
为了增强解的质量,将生成另一个新解:
x
n
e
w
3
=
(
x
n
e
w
2
−
r
a
n
d
x
n
e
w
2
)
+
S
F
(
r
a
n
d
∗
x
R
K
+
(
v
x
b
−
x
n
e
w
2
)
)
(8)
\mathrm{x}_{{\mathrm{new}3}}=(\mathrm{x}_{{\mathrm{new}2}}-\mathrm{rand}\mathrm{x}_{{\mathrm{new}2}})+\mathrm{SF}\left(\mathrm{rand}*\mathrm{x}_{{\mathrm{RK}}}+(\mathrm{v}\mathrm{x}_{{\mathrm{b}}}-\mathrm{x}_{{\mathrm{new}2}})\right)\tag{8}
xnew3=(xnew2−randxnew2)+SF(rand∗xRK+(vxb−xnew2))(8)
伪代码:
流程图:
3.结果展示
4.参考文献
[1] Ahmadianfar I, Heidari A A, Gandomi A H, et al. RUN beyond the metaphor: An efficient optimization algorithm based on Runge Kutta method[J]. Expert Systems with Applications, 2021, 181: 115079.