2013 International Symposium on Nonlinear Theory and its Applications
NOLTA2013, Santa Fe, USA, September 8-11, 2013

Network-Structured Firefly Algorithm and its Behavior
Haruna Matsushita† , Daiki Matsumoto and Yoshifumi Nishio ‡†Department of Electronics and Information Engineering, Kagawa University
Email: haruna@eng.kagawa-u.ac.jp‡Department of Electrical and Electronic Engineering, Tokushima University
Email: nishio@ee.tokushima-u.ac.jp
Abstract—This paper proposes a network-structured
firefly algorithm (NS-FA). The standard firefly algorithm(FA) consists of multiple fireflies. An attractiveness of thefirefly is proportional to its brightness, and for any two fireflies, the less brighter one will be attracted by the brighter
one at every generation step. However, the fireflies of the
NS-FA have a network structure that changes with generation step, and they move depending on its network structure. That is to say, the firefly of the NS-FA is not aﬀectedby brighter firefly if there is no connection between the two
fireflies. In other words, even if there is brighter firefly inthe firefly swarm, the firefly is not always attracted to thebrighter firefly. We apply the NS-FA to various optimization benchmarks and confirm its eﬀectiveness.

Objective function f (x), x = (x1 , · · · , xD )T .
Initialize positions of fireflies xi (i = 1, 2, · · · , M).
Light intensity Ii is determined by f (xi ), Ii = f (xi ).
Generation step t = 0.
while (t < MaxGeneration tmax ) do
for i = 1 to M, all M fireflies dofor j = 1 to M, all M fireflies do
if Ii > I j thenMove firefly i toward j according toEq.(1).
end ifend for j
end for i
Evaluate new solutions f (xi ),Rank the fireflies and find the current global bestg∗ .
end while

1. Introduction
Nature-inspired algorithms are among the most powerfulalgorithms for optimization. Among these biology-derived
algorithms, the multi-agent metaheuristic algorithms suchas the particle swarm optimization (PSO) [1] are hot research topics. The firefly algorithm (FA) [2] is an optimization algorithm based on a swarm intelligence as PSO.
The FA is inspired by the flashing behavior of fireflies.
The primary purpose for a firefly’s flash is to act as a signal system to attract other fireflies. In this study, we propose a network-structured firefly algorithm (NS-FA). The
most important feature of the NS-FA is that fireflies of the
NS-FA have network structure. In the standard FA, an attractiveness is proportional to their brightness, and for any
two fireflies, the less brighter one will be attracted by thebrighter one at every generation step. However, the fireflyof the NS-FA is not aﬀected by brighter firefly if there is noconnection between the two fireflies. It is stochastically decided whether the fireflies of the NS-FA are connected withbrighter fireflies and are disconnected from less brighter
one. In other words, even if the brighter fireflies exist, thefirefly is not always attracted to brighter one. We apply the
NS-FA to various optimization benchmarks and compare
the NS-FA with the PSO and the standard FA. Simulation
results show that both the FAs can obtain better results than
the PSO for the multimodal functions, and the NS-FA improves the optimization performance from the standard FA.

Figure 1: Pseudo code of the Firefly Algorithm (FA) for
minimum optimization problems.

2. Firefly Algorithm(FA)The FA is inspired by the flashing behavior of fireflies.
The FA is assumed as follows: (1) All fireflies are unisex, so that one firefly will be attracted to all other fireflies. (2) Attractiveness is proportional to their brightness,and for any two fireflies, the less brighter one will be attracted by the brighter one. However, the brightness candecrease as their distance increases. If there are no fireflies
brighter than a given firefly, it will move randomly. (3)The brightness of a firefly is aﬀected or determined by thelandscape of the objective function. For a minimum optimization problem f (x) as this study, the light intensity Ii ofa firefly i is determined by Ii = f (xi ).
Based on these three rules, the basic steps of the FA canbe summarized as the pseudo code shown in Fig. 1. The
initial positions of fireflies are generated at random (xi ∈[xmin , xmax ]D ).
The movement of a firefly i is attracted by another more
attractive firefly j, which has better solution, is determined- 310 -

bywhile (t < MaxGeneration tmax ) do
for i = 1 to M, all M fireflies dofor j = 1 to M, all M fireflies do
if Ii > I j thenif Ci, j = 1 thenMove firefly i toward j.
else if Randi ≤ C p(t) then
Connect firefly i to j; Ci, j = 1.
end ifelse if Ii ≤ I j AND firefly i is not the brightest firefly k thenif Randi ≤ C p(t) thenDisconnect firefly i from j; Ci, j = 0.
end ifend ifend for j
end for i
Evaluate new solutions f (xi ),Rank the fireflies and find the current global bestg∗ and the brightest firefly k.
end while

1
old
xnew
= xoldi + βi, j (x j (t) − xi ) + α(t)(Random() − )L,i(1)2
where the second term is due to the attraction. The attractiveness β is determined by
βi, j = (β0 − βmin )e−γri, j + βmin ,2(2)

where β0 is the attractiveness at r = 0, βmin is the minimum
value of β, and an absorption coeﬃcient γ is crucially important in determining the speed of the convergence. Thus,
the attractiveness will vary with the distance ri, j between
firefly i and j;√Dri, j = kxold
−
x
(t)k
=
Σd=1
(xi,d − x j,d )2 .
(3)
ji
The third term of Eq. (1) is randomization with α(t) being
the randomization parameter;( −4 )1/tmax 


10
 ,
α(t) = α(0) 1 −(4)
0.9
where Random() is a random number generator uniformly
distributed in [0, 1], and L is the average scale of the problem, |xmax − xmin |. The brightest firefly k moves randomly
according to1
xk (t + 1) = xk (t) + α(t)(Random() − )L.
2(5)

3. Network-Structured Firefly Algorithm (NS-FA)
We explain the NS-FA in detail. The most importantfeature of the NS-FA is that fireflies of the NS-FA have
network structure. The firefly of the standard FA moves toward brighter fireflies. However, the fireflies of the NS-FA
are attracted to only directly connected fireflies. Therefore,
the firefly of the NS-FA is not aﬀected by brighter firefly
if there is no connection between the two fireflies. In addition, the network structure is changed with generation.
The firefly of the NS-FA is stochastically connected withbrighter fireflies and is disconnected from less brighter fireflies. The pseudo code of the NS-FA is shown in Fig. 2.
An initial network structure of the NS-FA is assumed as
ring-topology. The connection among the fireflies is denoted by a connection matrix C. If the firefly i is connectedto the firefly j, Ci, j = 1, otherwise, Ci, j = 0.
The algorithm of the NS-FA is based on the standard FA.
However, the fireflies of the NS-FA move depending on the
network structure. A firefly i is attracted to more attractive
firefly j. However, if there is no connection between fireflyi and j, i is not aﬀected by j. Eq. (6) is the update equationof the NS-FA.
xnew
=
i

1
old


xold

i + β(x j (t) − xi ) +α(t)(Random() − 2 )L,
Ci, j = 1 AND Ii > I j





 xold ,otherwisei(6)

Figure 2: Pseudo code of the NS-FA for minimum optimization problems.
Next, we update connections between the firefly i andothers. The firefly i is stochastically connected to thebrighter fireflies. If Randi ≤ C p(t), i is connected to j according toCi, j = 1, Ii > I j .
(7)
The firefly i, except the brightest firefly k, is stochasticallydisconnected from less brighter fireflies. If Randi ≤ C p(t),i is disconnected from j according toCi, j = 0, Ii ≤ I j , i , k,(8)where Randi is a random number generator uniformly distributed in [0, 1] and C p(t) is a connection probability determined byt
C p(t) =.
(9)tmax
By repeating these process, the network structure keeps onchanging, and the fireflies converge to the optimum solution.
4. Simulation
We apply the NS-FA to 6 benchmark optimization problems summarized in Table 1. f1 – f3 are unimodal functions,and f4 – f6 are multimodal functions with numerous local
minima. The optimum solution x∗ of all the functions except f2 are [0, 0, . . . , 0] and for f2 is [1, 1, . . . , 1], and its optimum value f (x∗ ) is 0. All the functions have D variables,- 311 -

Table 1: Benchmark objective functions.
Function nameSphere;Test FunctionD∑
f1 (x) =xd2 ,Initialization Space

Rosenbrock;

D−1 (
)
∑
(
)2
f2 (x) =100 xd2 − xd+1 + (1 − xd )2 ,x ∈ [−5.12, 5.12]D

d=1

x ∈ [−2.048, 2.048]D

d=1

3rd De Jong;

f3 (x) =D∑|xd |,x ∈ [−2.048, 2.048]D

d=1
D (
∑

)
xd2 − 10 cos (2πxd ) + 10 ,Rastrigin;f4 (x) =Ackley;

D−1 (
)
√ 2 2
∑
f5 (x) =20 + e − 20e−0.2 0.5(xd +xd+1 ) − e0.5(cos(2πxd )+cos(2πxd+1 )) ,x ∈ [−5.12, 5.12]D

d=1

Stretched V;

f6 (x) =

d=1
D−1
∑

(
)
2
2
(xd2 + xd+1)0.25 1 + sin2 (50(xd2 + xd+1
)0.1 ) ,x ∈ [−30, 30]Dx ∈ [−10, 10]D

d=1

modal functions which have few local optima. However,both the FAs also obtained enough results as the optimization result, and the results of the NS-FA were better than
the standard FA. The proposed NS-FA improved the optimization performance from the standard FA by 98.49%,
0.75% and 56.72% on f1 , f2 and f3 , respectively. For thisreason, in the late stage of learning, the firefly of the NS-FA
is connected to only brightest firefly k. In other words, thefirefly of the NS-FA is aﬀected by only k. By this eﬀect,
the fireflies of the NS-FA can converge more quickly than
the standard FA.

Table 2: Comparison results.
f
f1
f2
f3
f4
f5
f6

Mean
Min
Mean
Min
Mean
Min
Mean
Min
Mean
Min
Mean
Min

PSO
9.093 × 10−14
4.647 × 10−1926.86
0.44260.006017
4.401 × 10−8
66.63
32.83
107.0
10.31
26.49
13.60

FA
4.693 × 10−4
4.027 × 10−4
28.41
27.12
0.12720.07035
26.12
12.10
8.213
0.7439
4.951
3.242

NS-FA
7.043 × 10−6
7.765 × 10−7
28.20
26.64
0.05504
0.01203
23.53
13.93
3.174
0.2124
4.499
3.205

in this study, D = 30. The initialization space corresponds
to the scale of the problem [xmin , xmax ]D .
The NS-FA is compared with the PSO and the standard
FA. For all the optimization algorithms in all the simulations, the population size M is set to 30 (=D). For bothFAs, the parameters are set as β0 = 1, βmin = 0.2, γ = 1
and α(0) = 0.5. For the PSO, the inertia weight w andthe acceleration coeﬃcients c are set as w = 0.729 andc1 = c2 = 1.494, respectively. These parameters are defined according to [1] and [2]. The maximum generation
tmax are set to 1000 and 500 for the PSO and the FAs, respectively. Results are evaluated by average over 100 trials.
Table 2 summarizes the mean result f (g∗ ), and the best
result of the PSO, the standard FA and the proposed NS-FA,
over 100 trials. We can see that in the unimodal functions
f1 – f3 , the PSO obtained the best results. This is becausethat the PSO can quickly converge and the optimization
speed, namely convergence speed, is important for the uni-

In the results of the multimodal functions f4 – f6 , both
FAs significantly improved the results from the PSO although the total number of function evaluations of FAs
is 500 which is much less than 1000 of the PSO. Furthermore, the proposed NS-FA improved the optimization
performance from the standard FA by 9.92%, 61.35% and9.14% on f4 , f5 and f6 , respectively. The network structureof the NS-FA changes with generation, and it products thediversity of the fireflies. Therefore, it is hard for the fireflies of the NS-FA to be trapped into the local optima. Fromthese results, we can conclude that the NS-FA is eﬀective
for the multimodal problems than the standard FA and the
PSO.
Next, we investigate the changes of connection relationship of NS-FA and the behavior of the fireflies to confirm
the improvement of diversification of NS-FA. Figures 3 and4 show the convergence process for Ackley’s function of 30
fireflies in the conventional FA and NS-FA, respectively.
From these figures, we can see that the fireflies of NS-FA
are scattered over wider range than that of FA. Although thefireflies of FA tend to quickly converge in the early stages,
the fireflies of NS-FA slowly converge. This is because thefireflies of NS-FA are not necessarily connected with the- 312 -

30

20

20

10

10

10

10

0
-10

0
-10

-20
-20

-10

0
x1

10

20

-30
-30

30

0
-10

-20

-30
-30

x2

30

20

x2

30

20

x2

x2

30

-20
-20

-10

(a)

0
x1

10

20

-30
-30

30

0
-10
-20

-20

-10

(b)

0
x1

10

20

-30
-30

30

-20

-10

(c)

0
x1

10

20

30

(d)

30

30

20

20

20

10

10

10

10

0
-10

0
-10

-20
-20

-10

0
x1

10

20

-30
-30

30

0
-10

-20

-30
-30

x2

30

20

x2

30

x2

x2

Figure 3: Convergence process of FA for Ackley’s function. (a) t = 0 (b) t = 10 (c) t = 100 (d) t = 500(= tmax )

-20
-20

(a)

-10

0
x1

10

20

30

-30
-30

(b)

0
-10
-20

-20

-10

0
x1

10

20

30

-30
-30

(c)

-20

-10

0
x1

10

20

30

(d)

Figure 4: Convergence process of NS-FA for Ackley’s function. (a) t = 0 (b) t = 10 (c) t = 100 (d) t = 500(= tmax )best firefly, and the power of influence of the brighter firefly to others is not so much, as shown in Fig. 5(a) which is amagnified figure of Fig. 4. However, in the rate stages, NSFA converges to the optimum solution. This is because all
the fireflies receive only the influence of the brightest firefly (Fig. 5(b)) and the local search was strengthened. Fromthese results, we can conclude that because the behavior
and convergence speed of the fireflies of NS-FA changewith the iteration, its diversity was improved from FA.
1

0.007
0.006

0.5
x2

x2

0.005
0

not always attracted to brighter firefly.
We have applied the NS-FA to various optimization
benchmarks and have compared the NS-FA with the PSO
and the standard FA. From simulation results, for the unimodal functions, the PSO can obtain the best results among
three algorithms. Both the FAs obtained the enough results
as the optimization results although they are worse than the
PSO.
For the multimodal functions, both the FAs obtained better results than the PSO. In addition, the NS-FA improved
the optimization performance from the standard FA. Fromthese results, the NS-FA is eﬀective for the multimodal
problems than the standard FA and the PSO.

0.004
0.003

-0.5

Acknowledgment

0.002
-1
-1

-0.5

0
x1

(a)

0.5

1

0.001
-0.01

-0.009 -0.008 -0.007 -0.006 -0.005
x1This work was supported by KAKENHI 24700226.

(b)

Figure 5: Connection relationship of NS-FA. (a) t = 200.
(b) t = 500.

References[1] J. Kennedy and R. C. Eberhart, “Particle swarm optimization,” in Proc. of IEEE. Int. Conf. on Neural Netw.,
pp. 1942–1948, 1995.
[2] Yang. X. S., “Nature-Inspired Metaheuristic Algorithms”, Luniver Press, 2008.

5. Conclusions
We have proposed the novel FA, the NS-FA. In the standard FA, an attractiveness is proportional to their brightness, and for any two fireflies, the less brighter one will be
attracted by the brighter one at every generation step. However, the firefly of the NS-FA is not aﬀected by brighter
firefly if there is no connection between the two fireflies.
In other words, even if there is brighter firefly, the firefly is- 313 -