# BAS: Beetle Antennae Search Algorithm for Optimization Problems

###### 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 well-known test functions, in which the numerical results validate the efficacy of the proposed BAS algorithm.

## I Introduction

Meta-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 meta-heuristic 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 Beetle Antennae Search Algorithm Design

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 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 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 at th time instant () and denote the concentration of odour at position to be known as a fitness function, where a maximum value of 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,

(1) |

where denotes a random function, and represents the dimensions of position. Further more, we present the searching behaviors of both right-hand and left-hand sides respectively to imitate the activities of the beetle’s antennae:

(2) |

where denotes a position lying in the searching area of right-hand side, and denotes that of the left-hand side. 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,

(3) |

where is the step size of searching which accounts for the convergence speed following a decreasing function of instead of an increasing function or a constant. The initialization of should be equivalent to the searching area. represents a sign function.

In terms of searching parameters i.e., antennae length and step size , examples of update rules are presented for the designer as follows,

(4) | |||||

(5) |

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

## Iii Benchmark 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

(6) |

where and , the minimized value satisfies locating in in dimension. The performance of BAS algorithm shows in Fig. 2 along time step from to under the parameter configuration that sensing length updates following rule 4 with initialized value , and step size follows rule 5 with initialization . It can be observed from Fig. 2 that BAS algorithm could find the global minimum of function (6). Numerically, the solution of function (6) is approximate to at the corresponding points .

We also consider the Goldstein-Price function:

(7) | |||||

where the input domain is usually on the square .

There are several local minima for function (7) whose global minimum is at . By taking 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 at approaching at . Results of the simulation substantiate the effectiveness of the proposed BAS algorithm sufficiently.

## Iv Conclusion

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 Appendix

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.

## References

- [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 L¨¦vy 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.