A Hybrid Bat Algorithm: Iztok Fister JR., Du San Fister, Xin-She Yang
A Hybrid Bat Algorithm: Iztok Fister JR., Du San Fister, Xin-She Yang
Abstract. Swarm intelligence is a very powerful technique appropriate to optimization. In this paper, we present
a new swarm intelligence algorithm, which is based on the bat algorithm. Bat algorithm has been hybridized
with differential evolution strategies. This hybridization showed very promising results on standard benchmark
functions and also significantly improved the original bat algorithm.
Keywords: swarm intelligence, bat algorithm, differential evolution, optimization
Hibridni algoritem na osnovi obnašanja netopirjev and differential evolution [29], [3], [6] work on real-
valued solutions, genetic programming [21] acts on pro-
Inteligenca rojev, (angl. Swarm Intelligence) postaja zelo
grams in Lisp, while the evolutionary programming [13]
pomembna optimizacijska tehnika. V članku predstavljamo
nov algoritem inteligence rojev, ki temelji na osnovi obnašanja behaves with finish state automata. Evolutionary algo-
netopirjev, (angl. Bat Algorithm) in je hibridiziran s strategi- rithms have been applied to a wide range of areas
jami diferencialne evolucije. Poleg zelo obetavnih rezultatov of optimization, modeling, and simulation. Essentially,
na testnih primerih, (angl. Benchmark Functions), hibridizacija differential evolution has sucessfully been employed
prav tako občutno izboljša originalni netopirski algoritem.
in the following areas of optimization: function opti-
mization [28], large-scale global optimization [4], graph
1 I NTRODUCTION coloring [8], chemical process optimization [1].
Swarm intelligence is the collective behaviour of
Nature has always been an inspiration for researchers. decentralized, self-organized systems, either natural or
In the past, many new nature-inspired algorithms have artificial. Swarm intelligence was introduced by Beny
been developed to solve hard problems in optimization. in 1989. A lot of algorithms were proposed since then.
In general, there are two main concepts developed in Swarm intelligence algorithms were applied on continu-
bio-inspired computation: ous as well as combinatorial optimization problems [25].
1) evolutionary algorithms, The most well-known classes of swarm intelligence
2) swarm intelligence algorithms. algorithms are as follows: particle swarm optimization,
Evolutionary algorithms are optimization tech- ant colony optimization, artificial bee colony, firefly
niques [7] that base on Darwin’s principle of survivor of algorithm, cuckoo search and bat algorithm.
the fittest [5]. It states that in nature, the fittest individ- Particle swarm optimization has been successfully
uals have the greater chances to survive. Evolutionary applied in problems of antenna design [17] and electro-
algorithms consist of the following disciplines: genetic magnetics [27]. Ant colony algorithms were also used
algorithms, evolution strategies, genetic programming, in many areas of optimization [20] [26] [22].Artificial
evolutionary programming, differential evolution. bee colony showed good performance in numerical
Although all these algorithms or methods were de- optimization [18] [19], in large-scale global optimiza-
veloped independently, they share similar characteristics tion [10], and also in combinatorial optimization [24]
(like variation operators, selection operators), when solv- [9] [30].
ing problems. In fact, the evolutionary algorithms are Cuckoo search algorithm is a very strong method
distinguished by their representation of solutions. For for function optimization and also for engineering op-
example, genetic algorithms [15], [16] support the binary timization problems[34] [33]. Firefly algorithm showed
representation of solution, evolution strategies [2], [11] promising results in function optimization and it showed
good results also in combinatorial optimization [12].
Received 12 April 2013 Echolocation is an important feature of bat behaviour.
Accepted 26 April 2013 That means, bats emit a sound pulse and listen to
2 FISTER, FISTER, YANG
the echo bouncing back from obstacles whilst flying. 2) Bats fly randomly with velocity vi at position xi
This phenomenon has been inspired Yang [36] to de- with a fixed frequency fmin , varying wavelength
velop the Bat Algorithm (BA). The algorithm obtained λ and loudness A0 to search for prey. They can
good results where dealing with lower-dimensional op- automatically adjust the wavelength (or frequency)
timization problems, but may become problematic for of their emitted pulses and adjust the rate of pulse
higher-dimensional problems because it tends to con- emission r ∈ [0, 1], depending on the proximity
verge very fast initially. On the other hand, differential of their target.
evolution [23] is a typical evolutionary algorithm with 3) Although the loudness can vary in many ways,
differential mutation, crossover and selection that was we assume that the loudness varies from a large
successfully applied to continuous function optimiza- (positive) A0 to a minimum constant value Amin .
tion.
In order to improve bat algorithm behaviour for Algorithm 1 Original Bat Algorithm
higher-dimensional problems, the original bat algorithm
1: Objective function f (x), x = (x1 , ..., xd )T
were hybridized with differential-evolution strategies, in 2: Initialize the bat population xi and vi for i = 1 . . . n
this paper. This Hybrid Bat Algorithm (HBA) has been 3: Define pulse frequency Qi ∈ [Qmin , Qmax ]
tested on a standard set of benchmark functions taken 4: Initialize pulse rates ri and the loudness Ai
from literature. Our results of numerical experimental 5: while (t < Tmax ) // number of iterations
6: Generate new solutions by adjusting frequency, and
show that the proposed HBA can significantly improve
7: updating velocities and locations/solutions [Eq.(2) to (4)]
the performance of the original bat algorithm, which can 8: if(rand(0, 1) > ri )
be very useful for the future. 9: Select a solution among the best solutions
The structure of the paper is as follows. In Section 10: Generate a local solution around the best solution
2, the original bat algorithm together with differential 11: end if
12: Generate a new solution by flying randomly
evolution algorithm are introduced. In line with this,
13: if(rand(0, 1) < Ai and f (xi ) < f (x))
some biological foundations of bat behaviour are ex- 14: Accept the new solutions
plained. Section 3 describes our proposed novel ap- 15: Increase ri and reduce Ai
proach of hybridizing the bat algorithm with differential 16: end if
evolution strategies. Section 4 illustrates experiments 17: Rank the bats and find the current best
18: end while
and discusses the results. At the end of the paper, we
19: Postprocess results and visualization
conclude with future directions and developments with
HBA.
The original bat algorithm is illustrated in Algo-
2 BAT ALGORITHM rithm 1. In this algorithm bat behaviour is captured into
fitness function of problem to be solved. It consists of
Bat algorithm has been developed by Xin-She Yang the following components:
in 2010 [35]. The algorithm exploits the so called
• initialization (lines 2-4),
echolocation of bats. Bats use sonar echoes to detect
• generation of new solutions (lines 6-7),
and avoid obstacles. It is generally known, that sound
• local search (lines 8-11),
pulses are transformed to frequency which reflects from
• generation of a new solution by flying randomly
obstacle. Bats can use time delay from emission to
(lines 12-16),
reflection and use it for navigation. They typically emit
• find the current best solution.
short loud, sound impulses. The pulse rate is usually
defined as 10 to 20 times per second. After hitting Initialization of the bat population is performed ran-
and reflecting, bats transform their own pulse to useful domly. Generating the new solutions is performed by
information to gauge how far away the prey is. Bats are moving virtual bats according the following equations:
using wavelengths, that vary from range [0.7,17] mm or (t)
Qi = Qmin + (Qmax − Qmin )U (0, 1),
inbound frequencies [20,500] kHz. By implementation, (t+1) (t)
pulse frequency and rate has to be defined. Pulse rate vi = vit + (xti − best)Qi , (1)
can be simply determined from range 0 to 1, where 0 (t+1) (t) (t)
xi = xi + vi ,
means there is no emission and by 1, bats are emitting
maximum [14], [31], [37]. where U (0, 1) is a uniform distribution. A random walk
This behaviour can be used to formulate the new bat with direct exploitation is used for local search that
algorithm. Yang [35] used three generalized rules for bat modifies the current best solution according to equation:
algorithms: (t)
x(t) = best + Ai (2U (0, 1) − 1), (2)
1) All bats use echolocation to sense distance, and
(t)
they also guess the difference between food/prey where is the scaling factor, and Ai the loudness. The
and background barriers in a some magical way. local search is launched with the proximity depending
HYBRID BAT ALGORITHM 3
on the pulse rate ri . The term in line 13 is similar to the In technical sense, crossover and mutation can be
simulated annealing behavior, where the new solution is performed on many ways in differential evolution.
accepted with some proximity depending on parameter Therefore, a specific notation was used to describe a
Ai . In line with this, the rate of pulse emission ri variety of these methods (also strategies) in general. For
increases and the loudness Ai decreases. Both charac- example, ”DE/rand/1/bin” denotes that the base vector is
teristics imitate natural bats, where the rate of pulse randomly selected, 1 vector difference is added to it, and
emission increases and the loudness decreases when a the number of modified parameters in mutation vector
bat finds a prey. Mathematically, these characteristics are follows binomial distribution.
captured with following equations:
Ai
(t+1)
= αAi ,
(t) (t) (0)
ri = ri [1 − exp(−γ)], (3) 4 H YBRID BAT A LGORITHM
where α and γ are constants. Actually, the α parameter As we mentioned before, a new bat algorithm, called
plays a similar role as the cooling factor in simulated Hybrid Bat Algorithm (HBA) is proposed in this paper.
annealing algorithm that controls the convergence rate That is, the original bat algorithm was hybridized using
of this algorithm. the differential evolution strategies. The pseudo-code of
the HBA is illustrated in Algorithm 2.
3 D IFFERENTIAL EVOLUTION
Algorithm 2 Hybrid Bat Algorithm
Differential evolution(DE)[29][6] is a technique for op-
1: Objective function f (x), x = (x1 , ..., xd )T
timization which was introduced by Storn and Price in 2: Initialize the bat population xi and vi for i = 1 . . . n
1995. DE optimizes a problem by maintaining a popu- 3: Define pulse frequency Qi ∈ [Qmin , Qmax ]
lation of candidate solutions and creating new candidate 4: Initialize pulse rates ri and the loudness Ai
solutions by combining existing ones according to its 5: while (t < Tmax ) // number of iterations
6: Generate new solutions by adjusting frequency, and
simple formulae, and then keeping whichever candidate
7: updating velocities and locations/solutions [Eq.(2) to (4)]
solution has the best score or fitness on the optimization 8: if(rand(0, 1) > ri )
problem at hand. 9: Modify the solution using ”DE/rand/1/bin”
DE supports a differential mutation, a differential 10: end if
crossover and a differential selection. In particular, the 11: Generate a new solution by flying randomly
12: if(rand(0, 1) < Ai and f (xi ) < f (x))
differential mutation randomly selects two solutions and
13: Accept the new solutions
adds a scaled difference between these to the third 14: Increase ri and reduce Ai
solution. This mutation can be expressed as follows: 15: end if
16: Rank the bats and find the current best
(t) (t) (t) (t) 17: end while
ui = wr0 + F · (wr1 − wr2 ), for i = 1 . . . N P, (4) 18: Postprocess results and visualization
where F ∈ [0.1, 1.0] denotes the scaling factor as a
positive real number that scales the rate of modification As a result, HBA differs from the original BA in lines
while r0, r1, r2 are randomly selected vectors in the 9, where solution is modified using ”DE/rand/1/bin”
interval 1 . . . N P . strategy.
Uniform crossover is employed as a differential
crossover by the DE. The trial vector is built out
of parameter values that have been copied from two
5 E XPERIMENTS AND RESULTS
different solutions. Mathematically, this crossover can A goal of experiments was to show that HBA sig-
be expressed as follows: nificantly improves the results of the original BA. In
( line with this, two bat algorithms were implemented
(t) according to specifications in Algorithms 1 and 2 so
ui,j randj (0, 1) ≤ CR ∨ j = jrand ,
zi,j = (t) (5) that a well-selected set of test functions in the literature
wi,j otherwise,
are used for optimization benchmarks.
where CR ∈ [0.0, 1.0] controls the fraction of parame- Parameters of both bat algorithms were the same.
ters that are copied to the trial solution. Note, the relation Dimension of the problem has a crucial impact on
j = jrand assures that the trial vector is different from the results of optimization. In order to test how the
the original solution Y (t) . dimension influences on the results, three different sets
Mathematically, differential selection can be ex- of dimensions were taken into account, i.e., D = 10,
pressed as follows: D = 20, and D = 30. The functions with dimension
(
(t) (t) D = 10 were limited to 1,000 maximal number of
(t+1) zi if f (Z (t) ) ≤ f (Yi ), generations, the functions with dimension D = 20 twice
wi = (t) (6)
wi otherwise . as much, while the functions with dimension D = 30 to
4 FISTER, FISTER, YANG
3,000. The initial loudness was set to A0 = 0.5 same as able to cross the valley among the optima and achieve
the initial pulse rate (r0 = 0.5). The frequency was taken better results.
from interval Qi ∈ [0.0, 2.0]. Algorithms optimized each n−1 q
−0.2 0.5(x2 2
i+1 +xi )
X
function 25 times and results were measured according f5 (x) = [20+e − 20e −
(11)
to the best, worst, mean, and medium values in these i=1
0.5(cos(2πxi+1 )+cos(2πxi ))
runs. In addition, the standard deviation of mean values e ],
were calculated as well. where −32.00 ≤ xi ≤ 32.00. The global minimum of
5.1 Test suite this function is at 0.
1.0e-02
1.0e+02
1.0e-04
1.0e+00
Mean value
1.0e-06
1.0e-02
1.0e-08 BA
1.0e-04 HBA
1.0e-10
1.0e-06 D=10 D=20 D=30
1.0e-08 BA
HBA Dimensions
1.0e-10
D=10 D=20 D=30 Figure 3. Mean value of function f5 with various dimensions.
Dimensions
When comparing the results of the BA with the HBA,
Figure 2. Mean value of function f3 with various dimensions. it can be observed that results of HBA significantly
Interestingly, the mean value of a function f5 with outperformed the results of the original BA algorithm
dimension D = 10 is the most difficult for the HBA by optimizing the functions f1 , f3 , and f5 . Functions
algorithm, while the same function with dimension f2 and f4 by HBA are also better, but the difference is
D = 20 is the easiest to solve. In contrast, the results not outstanding.
of the original BA algorithm showed that increasing the
dimensions also the results become worse. 6 C ONCLUSION
As can be seen from Fig. 2, difficulty to solve the
function f3 is increased with increasing the dimensional- In this paper, we have improved the bat algorithm by
ity of the problem. As a result, the most difficult function developing a new variant, called hybrid bat algorithm.
to solve is the function f3 with dimension D = 30. This new HBA is a hybrid of BA with DE strategies.
6 FISTER, FISTER, YANG
Experiments has shown that this algorithm improves [21] John R. Koza. Genetic programming 2 - automatic discovery
significantly the original version of the bat algorithm. of reusable programs. Complex adaptive systems. MIT Press,
1994.
In the future, hybrid bat algorithm would be tested on
large-scale global optimization. We will also do more [22] D. Merkle, M. Middendorf, and H. Schmeck. Ant colony
extensive testing using more diverse test function sets, optimization for resource-constrained project scheduling. Evo-
lutionary Computation, IEEE Transactions on, 6(4):333–346,
together with a detailed parametric study. 2002.
Iztok Fister Jr. was born in 1989, received his B.Sc. from Computer
Science in 2011. Currently, he is working towards his M.Sc. degree.
His research activities encompasses swarm intelligence, pervasive
computing and programming languages.