1

BAS: Beetle Antennae Search Algorithm for
Optimization Problems

arXiv:1710.10724v1 [cs.NE] 30 Oct 2017

Xiangyuan Jiang, Shuai Li

Abstract—Meta-heuristic algorithms have become very popular because of powerful performance on the optimization problem. A new algorithm called beetle antennae search algorithm
(BAS) is proposed in the paper inspired by the searching behavior
of longhorn beetles. The BAS algorithm imitates the function
of antennae and the random walking mechanism of beetles in
nature, and then two main steps of detecting and searching are
implemented. Finally, the algorithm is benchmarked on 2 wellknown test functions, in which the numerical results validate the
efficacy of the proposed BAS algorithm.

I. I NTRODUCTION

M

ETA-HEURISTIC algorithms have attracted an amount
of attention over the last decades because of their
simplicity, flexibility and local optimum avoidance. Specially,
some of them play an fairly important role in not only
academic society mainly concluding computer science but also
many other practical engineering fields. Mirjalili et al. [1]
propose a grey wolf optimizer by mimicking the leadership
and prey of grey wolves in nature. Inspired by some cuckoo
species’ brood parasitism, Yang and Deb [2] develop a metaheuristic algorithm called cuckoo search which could be
applied to optimization and optimal search. Dorigo et al.
[3] propose an ant colony optimization, which is inspired by
the foraging movement of some ant species, to exploit for
solutions of optimization problems. Two essential common
characteristics of these different meta-heuristics are exploration and exploitation. This paper design a new meta-heuristic
algorithm, which is named as beetle antennae search algorithm
(BAS) to solve the optimization problems, taking inspiration
from detecting and searching behavior of longhorn beetles.
II. B EETLE A NTENNAE S EARCH A LGORITHM D ESIGN
Longhorn beetles shown in Fig.1(a) are a family of beetles,
characterized by extremely long antennae, which are often as
long as or even longer than the beetle’s body. The family is
large with over 26,000 species described. Slightly most of
them having long antennae. The pattern of antennae, which
usually consists of many kinds of olfactory receptor cells, is
often unique in particular species, and the functions of such
sensing systems are still debating. However, two fundamental
functions of such large antennaes are to bind to odours of prey,
and to obtain the sex pheromone of potential suitable mate,
in which large antennae could enlarge the detecting area. In
addition, large antennae may also act as a protective warning
mechanism.
We know that a beetle wobbles each antennae in one side
of the body to receive the odour when it is preying or finding

(a)

(b)
Fig. 1. Longhorn beetle and its searching behavior with long antennae. (a)
Longhorn beetle by Siga, used under the Creative Commons Attribution 3.0
Unported license [4]. (b) Searching behavior of longhorn beetle with long
antennae [5], where the line in black denotes the propagation of odour and
the line in blue represents the trajectory of the beetle.

mates. That is to say, the beetle explores nearby area randomly
using both antennae. Further more, when the antennae in one
side detects a higher concentration of odour, the beetle would
turn to the direction towards the same side, otherwise, it would
turn to the other side. These two combined factors make most
beetles to prey or seek for a mate as demonstrated in Fig.1(b),
which inspire us to design a meta-heuristic optimization algorithm. Based on these two aspects, the basic steps of the
proposed BAS algorithm can be summarized as the pseudo

2

Algorithm 1: BAS algorithm for global minimum searching
Input: Establish an objective function f (xt ), where
variable xt = [x1 , · · · , xi ]T , initialize the
parameters x0 , d0 , δ 0 .
Output: xbst , fbst .
while (t < Tmax ) or (stop criterion) do
→
−
Generate the direction vector unit b according to (1);
Search in variable space with two kinds of antennae
according to (2);
Update the state variable xt according to (3);
if f (xt ) < fbst then
fbst = f (xt ), xbst = xt .
Update sensing diameter d and step size δ with
decreasing functions (4) and (5) respectively, which
could be further studied by the designers.
return xbst , fbst .
0.5

0

−
→
rnd(k, 1)
b =
,
krnd(k, 1)k

(1)

0

3
-0.5

-0.5

2.5

where rnd(.) denotes a random function, and PSfrag
k represents
the
replacements
dimensions of position. Further more, we present the searching
behaviors of both right-hand and left-hand sides respectively fbst
f (xt )
to imitate the activities of the beetle’s antennae:
xr
xl

-1

= x +d b,
→
−
= xt − dt b ,

where xr denotes a position lying in the searching area of
right-hand side, and xl denotes that of the left-hand side. d
is the sensing length of antennae corresponding to the exploit
ability, which should be large enough to cover an appropriate
searching area to be cable of jumping out of local minimum
points at the beginning and then attenuate as time elapses.
Secondly, to formulate the behavior of detecting, we further
generate iterative model as follows to associate with the odour
detection by considering the searching behavior,

-1.5
1.5
1

1.5

(3)

where δ is the step size of searching which accounts for the
convergence speed following a decreasing function of t instead
of an increasing function or a constant. The initialization of δ
should be equivalent to the searching area. sign(.) represents
a sign function.
In terms of searching parameters i.e., antennae length d and
step size δ, examples of update rules are presented for the
designer as follows,
dt
δ

t

= 0.95dt−1 + 0.01,
= 0.95δ

t−1

.

-1.5
-2

2

iteration
0

(4)
(5)

It is worth pointing out that both of the parameters could be
designated as constants if necessary.

20

40

60

80

100

(b)

Fig. 2. Performances of the proposed BAS algorithm to search the global
optimum of Michalewicz function (6) through 100 iteration steps. (a) The
searching trajectory of BAS algorithm when x lays in a 2-D space. (b)
Convergence of the minimum value along iteration step t.

III. B ENCHMARK VALIDATION
To verify the efficacy of the proposed BAS algorithm, we
use various benchmarks [6] to validate the new algorithm.
At first, considering the Michalewicz function
f (x) =

d
X
i=1

→
−
xt = xt−1 + δ t b sign(f (xr ) − f (xl )),

-1

(a)

(2)

fbst
f (xt )

PSfrag replacements

2

→
t−

t

minimum value

code shown in Algorithm 1.
Searching behavior of beetles with two antennae could be
formulated in such a way that it is associated with an objective
function to be optimized, which makes it possible to formulate
new optimization algorithms. In the following sections, we will
first outline the formulation of the BAS algorithm and then
discuss the implementation as well as the analysis in detail.
For the sake of illustration, we denote the position of the
beetle as a vector xt at tth time instant (t = 1, 2, · · · ) and
denote the concentration of odour at position x to be f (x)
known as a fitness function, where a maximum value of f (x)
corresponds to the source point of the odour.
For simplicity in describing our BAS algorithm, we now
use the following two rules inspired by the behavior of beetle
searching with antennae, which includes searching behavior
and detecting behavior. Note that the beetle searches randomly
to explore an unknown environment.
Firstly, to model the searching behavior, we propose describing a random direction of beetle searching as follows,

sin(xi )[sin(

ix2i 2m
)] ,
π

(6)

where m = 10 and i = 1, 2, · · · , the minimized value
satisfies f∗ ≈ −1.801 locating in x∗ ≈ (2.20319, 1.57049) in
i = 2 dimension. The performance of BAS algorithm shows
in Fig. 2 along time step from 0 to 100 under the parameter
configuration that sensing length d updates following rule
4 with initialized value d0 = 2, and step size δ follows
rule 5 with initialization δ 0 = 0.5. It can be observed from
Fig. 2 that BAS algorithm could find the global minimum
of function (6). Numerically, the solution of function (6)
fbst = −1.8008 is approximate to f∗ at the corresponding
points xbst = [2.1997, 1.5679]T.
We also consider the Goldstein-Price function:
f (x) =

[1 + (x1 + x2 + 1)2 (19 − 14x1 + 3x21 − 14x2
+6x1 x2 + 3x22 )][30 + (2x1 − 3X2 )2 (18 − 32x1
+12x21 + 48x2 − 36x1 x2 + 27x22 )]

(7)

3

3500
6000

-0.4

5000

2500

4000

-0.6

replacements
fbst
f (xt )

fbst
f (xt )

minimum value

0
-0.2

3000

-0.8

1500

2000
PSfrag replacements

-1

1000

-1.2

500
iteration

-1

-0.5

0

0

0

(a)

20

40

60

80

100

(b)

Fig. 3. Performances of simulation results for the proposed BAS algorithm
to solve the Goldstein and Price problem (7) through 100 iteration steps. (a)
The searching trajectory of BAS algorithm when x lays in a 2-D space. (b)
Convergence of the minimum value along iteration step t.

where the input domain is usually on the square {x|xi ∈
[−2, 2], i = 1, 2}.
There are several local minima for function (7) whose global
minimum is f (x∗ ) = 3 at x∗ = [0, −1]T. By taking 100
iterative steps and the parameters configurations the same as
those in the aforementioned simulation, the visualization of
simulation result of proposed BAS algorithm is demonstrated
in Fig. 3, in which (a) denotes the searching trajectory to seek
the global optimum and (b) presents the convergence of the
minimum along movement steps. The solution achieved in
numerical experiment by the algorithm is fbst = 3.0064 at
xbst = [0.0052507, −0.99933]T approaching f∗ at x∗ . Results
of the simulation substantiate the effectiveness of the proposed
BAS algorithm sufficiently.
IV. C ONCLUSION
This work presents a novel nature-inspired BAS algorithm
to solve the optimization problem. This method mimics the
detecting and searching behaviors of beetles and further
parameter selections could be studied for the convergence
of the algorithm. Two typical test functions are considered
to benchmark performances of the algorithm in terms of
convergence and local minimum avoidance. Both visualization
results and numerical solutions validate the efficacy of the
proposed algorithm.
V. A PPENDIX
A numerical experiment of the proposed BAS
algorithm in Matlab could be found at https://
www.mathworks.com/matlabcentral/fileexchange/
64881-bas-beetle-antennae-search-algorithm-for-optimization.
R EFERENCES
[1] S. Mirjalili, S. M. Mirjalili, A. Lewis, “Grey wolf optimizer,” Adv. Eng.
Software, vo. 69, no. 3, pp. 46-61, 2014.
[2] X. S. Yang, and S. Deb, “Cuckoo search via Lvy flights,” In World
Cong. Nat. Biol. Insp. Comput., 2009, pp. 210-214, 2009.
[3] M. Dorigo and L. M. Gambardella, “Ant colony system: Acooperative
learning approach to the traveling salesman problem,” IEEE Trans. Evol.
Comput., vol. 1, no. 1, pp. 53-66, 1997.
[4] https://en.wikipedia.org/wiki/Antenna (biology)#/media/File:Rosalia
alpina side.JPG
[5] A. Slipinski, and H. Escalona, Australian Longhorn Beetles (Coleoptera:
Cerambycidae) Volume 1: Introduction and Subfamily Lamiinae. CSIRO
Publishing, 2013.
[6] Y. Y. Zhang, and S. Li, “PSA: A novel optimization algorithm based on
survival rules of porcellio scaber,” arXiv:1709.09840v1.

