Journal of Signal Processing, Vol.20, No.4, pp.153-156, July 2016

SELECTED PAPER AT NCSP'16

Investigation of Optimal Ratio of Males to Females in Firefly Algorithm
Masaki Takeuchi1 , Haruna Matsushita2 , Yoko Uwate1 and Yoshifumi Nishio1
1

Department of Electrical and Electronic Engineering, Tokushima University
2-1 Minami-Josanjima, Tokushima 770–8506, Japan
E-mail: {masaki,uwate,nishio}@ee.tokushima-u.ac.jp

2

Department of Electronics and Information Engineering, Kagawa University
2217-20 Hayashi-cho, Takamatsu, Kagawa 761-0396, Japan
E-mail: haruna@eng.kagawa-u.ac.jp

Abstract

proposed a new FA that distinguishes the sex of fireflies [5].
This method is called the firefly algorithm distinguishing beWe have proposed a firefly algorithm that distinguishes be- tween males and females (FADMF). In FADMF, the movetween males and females. In this algorithm, both males and ments of males and females are defined from their physicalfemales exist. In this study, we investigate the features of our differences. Therefore, the movements of males and females
proposed algorithm by changing the parameters and the per- are different. We investigate the features of FADMF using
centage of females. We compare our proposed firefly algo- four well-known test functions. Numerical experiments indirithm with the conventional firefly algorithm using four well- cate that with increasing the percentage of females, FADMF
known test functions. Numerical experiments indicate that tends to increase randomness.
our proposed firefly algorithm is superior to the conventional
This study is organized as follows. First, we explain thefirefly algorithm under some conditions.
conventional firefly algorithm in Sect.2, and then, we describe
FADMF in detail in Sect.3. In Sect.4, we report the results ofnumerical experiments. Finally, we conclude this study.
1. Introduction
The solution of optimization problems has recently become
increasingly important. Most optimization problems are nonlinear with many constraints. Consequently, optimization algorithms must be efficient to find optimal solutions. Stochastic algorithms, one category of optimization algorithms, areefficient optimization algorithms. Stochastic algorithms havea deterministic component and a random component. Almost all algorithms having only a deterministic component
are local search algorithms, for which there is a risk of being
trapped at local optima. However, the random component of
stochastic algorithms makes it possible to escape from such
local optima.
One type of stochastic algorithm is swarm intelligence algorithms, which are based on the behavior of animals and insects. Representative examples are particle swarm optimization (PSO) [1], ant colony optimization (ACO), and the fireflyalgorithm (FA) [2–4].
In the conventional FA, all fireflies are unisex. However, inthe real world, there are males and females. Animals having
variation among individuals have a greater chance of surviving than those without variation. In the case of solving optimization problems, we also consider that variation amongindividuals will lead to a verity of solutions. These solutions
may include the global optimal solution. Therefore, we have

Journal of Signal Processing, Vol. 20, No. 4, July 2016

2. Conventional Firefly Algorithm (FA) [2]
The Firefly Algorithm (FA) was developed by Yang and isbased on the idealized behavior of the flashing characteristics
of fireflies. It is suitable for multipeak optimization problems.
The conventional FA idealizes these flashing characteristics
using the following three rules:• All fireflies are unisex so that one firefly is attracted toother fireflies regardless of their sex.
• Attractiveness is proportional to brightness; thus, for any
two flashing fireflies, the less brighter one will movetowards the brighter one. Both the attractiveness andbrightness stared above decrease as their distance increases. If no one is brighter than a particular firefly,
it moves randomly.
• The brightness or light intensity of a firefly is affected ordetermined by the landscape of the objective function tobe optimized.
The attractiveness of firefly β is defined by2β = β0 e−γrij

(1)

153

Algorithm 1 Conventional firefly algorithm (FA)Objective function f (x), x = (x1 , ..., xd )T
Initialize a population of fireflies xi (i = 1, 2, ..., n)
Define light absorption coefficient γ
while t < M axGeneration dofor i = 1 to n, all n fireflies dofor j = 1 to n, all n fireflies doLight intensity Ii at xi is determined by f (xi )if Ii > Ij thenMove firefly i towards j in all d dimensions
end ifAttractiveness varies with distance r via exp[−γr]Evaluate new solutions and update light intensity
end for j
end for i
Rank the fireflies and find the current best
end while
Postprocess results and visualization

Algorithm 2 Firefly algorithm distinguishing between males
and females (FADMF)
Objective function f (x), x = (x1 , ..., xd )T
Initialize a population of male fireflies xi (i = 1, 2, ..., n)
Initialize a population of female fireflies yi (i = 1, 2, ..., m)
Define light absorption coefficient γ
while t < M axGeneration dofor i = 1 to n, all n male fireflies dofor j = 1 to n, all n male fireflies doLight intensity Ixi at xi is determined by f (xi )if Ixi > Ixj thenMove male firefly i towards j in all d dimensions
end ifend for j
for k = 1 to m, all m female fireflies doLight intensity Iyk at yk is determined by f (yk )if Ixi > Iyk thenMove male firefly i towards k in all d dimensions
else
Move female firefly k towards i in all d dimensions
where γ is the light absorption coefficient, β0 is the attracend
iftiveness at rij = 0 and rij is the distance between any twoendfork
fireflies i and j located at xi and xj , respectively. Firefly i
Attractiveness varies with distance r via exp[−γr]is attracted to another more attractive firefly j, and the moveEvaluate new solutions and update light intensity
ment of firefly i is determined byend for ixi = xi + ∆x(2)Rank the fireflies and find the current bestend
while(3)∆x = β(xj − xi ) + αϵi
Postprocess results and visualization
where xi is the position vector of firefly i, ϵi is the vector of arandom variable and α(t) is a randomization parameter. α(t)The female parameters α(t) and β and the female moveis defined byment x determined with parameters V and W are given by( −4 )t/tmax
10( 4 )t/2tmax
α(t) = α(0)(4)
100.9α(t) = α(0)
(5)
0.9
2
where t is the iteration number.
(6)β = β0 e−γrij /W
Algorithm 1 shows pseudo code of the conventional FA forx = x + ∆x/V(7)minimum optimization problems.
where ∆x is given by Eq.(3).
In the proposed method, males are attracted to all fireflies,
while females are attracted to only males. Males move inthe same way as fireflies in the conventional FA. Algorithm
In this section, we explain our proposed method [5]. One of
2 shows pseudo code of FADMF for minimum optimization
the rules of the conventional FA is that all fireflies are unisex.
problems.
However, males and females exist in the real world. Therefore, we distinguish the sex of fireflies, that is, there are twosexes in our proposed method. The movement of females is 4. Numerical Experiments on FADMF
modeled from the physical characteristics. In the real world,
We compare FADMF with the conventional FA using four
females are larger than males and female eyes are smaller
test
functions (see Table 1). Their optimal solutions arethan male eyes. Thus, in our proposed method, females movef(x)= 0 at x = 0.
slower than males, and females have more difficulty detectIn
thecase of solving minimum problems, the Sphere anding the flashes of other distant fireflies. In addition, we give
Ackleyfunctions
are used in monopeak optimization probmales and females a different randomization parameter.
3. Firefly Algorithm Distinguishing between Males andFemales (FADMF) [5]154

Journal of Signal Processing, Vol. 20, No. 4, July 2016

NameSphere
Rastrigin

Table 1: Test functions

Formulan∑f (x) =x2i
f (x) =i=1n∑
i=1GriewankAckley(x2i − 10 cos (2πxi ) + 10)

nn1 ∑ 2 ∏xif (x) =xi −cos ( √ ) + 1
4000 i=1ii=1�� d�∑11�2x f (x) = −20 exp −5 d i=1 i( d)1∑− exp
cos (2πxi ) + 20 + ed i=1

Range[-5.12, 5.12][-5.12, 5.12][-600, 600][-30, 30]

ventional FA according to the numerical experimental results
for the Rastrigin and Griewank functions.
5. Conclusions
In this study, we investigated the features of our proposed
firefly algorithm (FADMF) by applying it to four well-known
test functions. Numerical experiments indicated that FADMF
is superior to the conventional FA under some conditions.
FADMF escapes from local optima more easily than the conventional FA, while it has a lower convergence speed.
In future work, we will improve our proposed FADMF.

Acknowledgmentlem, while the Rastrigin and Griewank functions are multipeak optimization problems. The graphic form of the Sphere This work was partly supported by JSPS Grant-in-Aid forfunction is very simple, whereas the graphic form of the Ack- Scientific Research 16K06357.
ley function is more complex because there are many local
References
minima and local maxima. There are also many local minima
and local maxima in the Rastrigin and Griewank functions.
The graph of the Griewank function has a gentler gradient [1] J. Kennedy and R. Eberhart: Particle swarm optimization, Proceedings of the IEEE International Conference
than that of the Rastrigin function.
on Neural Networks, pp. 1942-1948, 1995.
The results of numerical experiments are shown in Table
2. Each numerical experiment is run 100 times. For each [2] S. Lukasik and S. Zak: Firefly algorithm for continuous
test function, we define the number of dimensions N = 30,
constrained optimization tasks, Computational Collectmax = 1000, V = 3 and W = 4. In this study, we change
tive Intelligence. Semantic Web, Social Networks andthe female percentage from 10% to 90% in increments ofMultiagent Systems, Vol. 5796, Lecture Notes in Com10%.
puter Science, pp. 97-106, 2009.
Almost all the results of the conventional FA for the Sphereand Griewank functions are better than those of FADMF.
[3] X. S. Yang: Nature-Inspired Metaheuristic Algorithms
When 10% of fireflies are females, FADMF obtains betterSecond Edition, Luniver Press, 2010.
results for the average and minimum. In the case of the Ras[4] H. Matsushita: Firefly algorithm with dynamicallytrigin function, FADMF obtains better results except for thechanging connections, Proceedings of International
minimum when 90% of the swarm are females. FADMF obSymposium on Nonlinear Theory and its Applications,tains better results for the Ackley function for the average andpp. 906-909, 2014.
maximum, while the conventional FA obtains better resultsfor the minimum. Therefore, our proposed method is suitable[5] M. Takeuchi, H. Matsushita, Y. Uwate and Y. Nishio:
for the Rastrigin and Ackley functions.
Firefly algorithm distinguishing between males and feWe formed line graphs in which the vertical axis shows themales for minimum optimization problems, submitted
average value of solutions (log scale) and the horizontal axis
for publication.
shows the female percentage (see Fig.1).
With increasing female percentage, the average value ofsolutions for the Sphere, Griewank and Ackley functions continuously increase. On the other hand, the graph for the Rastrigin function decreases slowly from 10% to 30%, then increases slightly from 30%. According to Fig.1, FADMF issuitable for the Rastrigin and Ackley functions. Numerical experiments for the Sphere function show that fireflies ofthe conventional FA converge faster than those of FADMF.
FADMF obtains better results than the conventional FA for
the Ackley function. Therefore, we find that the fireflies ofFADMF easily escape from local optima. In addition, when
the graph has a gentle gradient, FADMF is inferior to the con-Journal of Signal Processing, Vol. 20, No. 4, July 2016

155

namefemale percentage
aveSphereminmax
ave
Rastrigin min
max
ave
Griewank min
max
ave
Ackleyminmax

conventional FA
2.80 × 10−7
1.69 × 10−7
3.90 × 10−7
2.63 × 101
1.21 × 101
4.66 × 101
3.71 × 10−4
1.29 × 10−4
8.59 × 10−3
6.35 × 100
9.82 × 10−4
2.00 × 101

Table 2: Numerical experimental results of FADMF
10
2.79 × 10−7
1.53 × 10−7
4.08 × 10−7
2.22 × 101
9.95 × 100
4.28 × 101
2.83 × 10−4
1.23 × 10−4
7.68 × 10−3
2.29 × 10−3
1.83 × 10−3
2.80 × 10−3

20
3.03 × 10−71.83 × 10−7
4.12 × 10−7
2.07 × 101
1.09 × 101
3.68 × 101
5.23 × 10−4
1.21 × 10−4
7.65 × 10−3
2.41 × 10−3
1.83 × 10−3
2.84 × 10−330
3.33 × 10−7
2.21 × 10−7
4.43 × 10−7
1.83 × 101
7.96 × 100
2.79 × 101
7.39 × 10−4
1.41 × 10−4
1.02 × 10−2
2.49 × 10−3
1.80 × 10−3
2.97 × 10−340
3.55 × 10−7
2.30 × 10−7
5.13 × 10−7
1.93 × 101
1.09 × 101
3.48 × 101
1.00 × 10−3
1.50 × 10−3
7.75 × 10−3
2.58 × 10−3
2.11 × 10−3
3.21 × 10−3

FADMF50
4.04 × 10−7
1.88 × 10−7
6.01 × 10−7
1.90 × 101
7.96 × 100
3.18 × 101
1.02 × 10−3
1.58 × 10−4
1.51 × 10−2
2.68 × 10−3
1.74 × 10−3
3.26 × 10−360
4.36 × 10−7
2.50 × 10−7
6.78 × 10−7
1.88 × 101
1.09 × 101
2.98 × 101
1.97 × 10−3
2.07 × 10−4
1.27 × 10−2
2.83 × 10−3
2.01 × 10−3
3.54 × 10−370
5.64 × 10−7
3.21 × 10−7
8.24 × 10−7
1.97 × 101
1.09 × 101
3.28 × 101
2.82 × 10−3
1.77 × 10−4
2.00 × 10−2
3.16 × 10−3
2.47 × 10−3
4.00 × 10−3(a) Sphere function(b) Rastrigin function(c) Griewank function(d) Ackley function

80
7.09 × 10−7
3.67 × 10−7
1.10 × 10−6
2.10 × 101
1.19 × 101
3.48 × 101
5.13 × 10−3
3.75 × 10−4
2.55 × 10−2
1.72 × 10−2
2.86 × 10−3
1.34 × 10090
2.90 × 10−6
1.35 × 10−6
5.85 × 10−6
2.34 × 101
1.39 × 101
4.08 × 101
1.04 × 100
1.03 × 100
1.06 × 100
4.39 × 100
2.66 × 100
5.62 × 100

Figure 1: Examples of results of numerical experiments

156

Journal of Signal Processing, Vol. 20, No. 4, July 2016