Page 174 - Read Online
P. 174
Li et al. Intell Robot 2024;4(3):230-43 I http://dx.doi.org/10.20517/ir.2024.15 Page 234
Key1 Key2 Key3 Key4
Query F(Q,K) F(Q,K) F(Q,K) F(Q,K) Phase I
s1 s2 s3 s4
Class SoftMax() normalization Phase II
a1 a2 a3 a4
Attention * * + * + * Phase III
Value +
Value1 Value2 Value3 Value4
Figure 3. Attention calculation flow.
2.2.3 Whale optimization algorithm
Whale optimization algorithm (WOA) is a group intelligence optimization algorithm proposed by Mirjalili
and Lewis in 2016, which originates from the simulation of the hunting behavior of whale groups in nature.
The whole algorithm process includes three stages: encircling prey, bubble netting and searching for prey [14] .
(a) Surround the prey
Assuming that in k-dimensional space, there is already a whale that finds the best position to surround its
prey [15] , other whales will choose this position to approach, and the mathematical model equation is estab-
lished as follows:
+1 = best − · (8)
= · − (9)
where denotes the current optimal individual whale position; denotes represents the current individ-
ual whale position [16] ; The position that the whale individual affected by the position of the optimal whale
is the kth component of +1.
individual will reach in the next moment is set to be +1. +1
= 2 1 , = · (2 · 2 − 1) = 2 · (1 − ) (10)
max
where 1 and 2 are random variables in the interval [0, 1]; the value of a decreases linearly from 2 to 0 as the
number of iterations increases; and max denotes the maximum number of iterations.
(b) Bubble net predation
Whales have two ways to contract the envelope and swim spirally toward their prey when they drive the encir-
cling prey. The spiral wanders toward the prey using the spiral to update the position to represent this roundup
behavior. The mathematical model equation is established as follows:
+1
= · · (2 ) + (11)
= (12)
−
where denotes the optimal whale-to-prey spacing; represents the logarithmic spiral shape constant; and
indicatesarandomnumberuniformlydistributedintheinterval[-1, 1]. Thecontractionsurroundmechanism,
which is basically the same as the formula of the mathematical model to surround the prey [17] , differs in that
the value interval of is adjusted from [-a, a] to [-1, 1]. Then, one of these two methods is chosen with a 50%