# Self-Adaptive Step Firefly Algorithm

Authors: Shuhao Yu; Shanlin Yang; Shoubao Su
Journal: Journal of Applied Mathematics
 (2013)

---

## Abstract

In the standard firefly algorithm, each firefly has the same step settings and its values decrease from iteration to iteration. Therefore, it may fall into the local optimum. Furthermore, the decreasing of step is restrained by the maximum of iteration, which has an influence on the convergence speed and precision. In order to avoid falling into the local optimum and reduce the impact of the maximum of iteration, a self-adaptive step firefly algorithm is proposed in the paper. Its core idea is setting the step of each firefly varying with the iteration, according to each firefly’s historical information and current situation. Experiments are made to show the performance of our approach compared with the standard FA, based on sixteen standard testing benchmark functions. The results reveal that our method can prevent the premature convergence and improve the convergence speed and accurateness.


---

## Body

## 1. Introduction

Firefly algorithm (FA) is inspired by biochemical and social aspects of real fireflies [1]. It could handle multimodal problems of combinational and numerical optimization more naturally and efficiently [2–5]. Owing to its few parameters to adjust, easy to understand, realize, and compute, it was applied to various fields, such as codebook of vector quantization [6], in-line spring-mass systems [7], mixed variable structural optimization [8], nonlinear grayscale image enhancement [9], travelling salesman problems [10], continuously cast steel slabs [11], promoting products online [12], nonconvex economic dispatch problems [13], chiller loading for energy conservation [14], stock market price forecasting [15], and multiple objectives optimization [16].Despite these advantages, the FA is also a metaheuristic algorithm; the standard FA can easily get trapped in the local optima when solving complex multimodal problems. These weaknesses have restricted wider applications of the FA. Therefore, avoiding the local optima and accelerating convergence speed have become the two most important and appealing goals in the FA research. To overcome these disadvantages, many researchers have proposed a variety of modifications to the original FA [17–19].Compared with other evolutionary algorithms, such as Genetic Algorithm and Simulated Annealing, standard FA has the following problem: it is not rational that each firefly uses the same step or the linear step just depends on maximum iteration not related to experience of fireflies, which may impact on the balance between the global and local search. Based on the above problem, a self-adaptive step firefly algorithm (SASFA) is proposed in the paper, which considers the historical information and current situation of each firefly.The rest of this paper is organized as follows. Section2 shows a brief review of the updating process of the standard FA and analyzes some problems about the linear step approach. In Section 3, a novel approach is proposed to set the step of each firefly self-adaptively. In Section 4, experimental settings and results compared with the two algorithms are presented. Finally, we make the conclusions in Section 5.


## 2. Firefly Algorithm Concepts

Firefly algorithm is based on the idealized behavior of the flashing feature of fireflies. The following three rules are idealized for the basic formulation of FA:(1) all fireflies are unisex so that fireflies will attract each other regardless of their sex; (2) attractiveness is proportional to their brightness, which decreases as distance increases between two flies; (3) the brightness of a firefly is determined by the objective function [1].


### 2.1. Standard Firefly Algorithm

In the FA, there are two critical issues: the formulation of the attractiveness and the variation of light intensity. We can always suppose that a firefly’s attractiveness is determined by its light intensity or brightness, which in turn is associated with the encoded objective function [5]. The light intensity I(r) varies with the distance r exponentially and monotonically. That is,
(1)I=I0e-γr,
where I0 is the initial light intensity and γ is the light absorption coefficient. As a firefly’s attractiveness is proportional to the light intensity seen by neighbor fireflies, we can now define the attractiveness β of a firefly by
(2)β=β0e-γr2,
where β0 is the attractiveness at r=0. The movement of a firefly i is attracted to another more attractive firefly j, which is determined by
(3)xi=xi+β0e-γ·rij2(xj-xi)+αε.The third term is the randomization with the stepα, being drawn from a Gaussian distribution. In [2], the Levy distribution was used instead of the Gaussian one. Based on the comments in [1] the implementation of standard FA was adopted β0=1 and α generated with uniform distribution in range [0,1]. The procedure for implementing the FA can be summarized as the pseudocode revealed in Pseudocode 1.Pseudocode 1:Pseudocode of the FA.
Begin
Objective functionf(x),x=(x1,…,xd)T
Generate initial population ofn fireflies xi,i=1,2,…,n
Formulate light intensityI so that it is associated with f(x)
While (t<MaxGeneration)
Define absorption coefficientγ
fori=1:n (n fireflies)
forj=1:n (n fireflies)
if (Ij>Ii),
move fireflyi towards j
end if
Vary attractiveness with distancer via exp(-γr∧2)
Evaluate new solutions and update light intensity
end forj
end fori
Rank the fireflies and find the current best
end while
Post-processing the results and visualization
end


### 2.2. Problems of Setting Step in Standard Firefly Algorithm

In standard FA, the third term of (3) is the randomization with step α. It generates with uniform distribution in range [0,1]. In general, the method of setting step is static or linear; step just depends on maximum generation, which cannot be adaptive to different fireflies. Firstly, each firefly has the same step settings, and its value decreases from iteration to iteration. Consequently, it may trap in the local optimum, resulting in premature convergence. Secondly, a large step can make the firefly skip the best optimal solution when it is in the neighborhood of the firefly, during the early stage of the search. Therefore, this may reduce the search performance.Finally, we can see from (3), that it is helpful for firefly to explore new search space with a large step, but it is not useful to the convergence of global optimum. If step has a small value, the result is contrary. For this reason, the step α has a great effect on the exploration and convergence of the algorithm. The value of α decreases slowly with the large number of iterations but decreases rapidly with the small number of iterations. To take into account the above issues, a new method based on self-adaptive step is introduced which considers the respective experience of each firefly.


## 2.1. Standard Firefly Algorithm

In the FA, there are two critical issues: the formulation of the attractiveness and the variation of light intensity. We can always suppose that a firefly’s attractiveness is determined by its light intensity or brightness, which in turn is associated with the encoded objective function [5]. The light intensity I(r) varies with the distance r exponentially and monotonically. That is,
(1)I=I0e-γr,
where I0 is the initial light intensity and γ is the light absorption coefficient. As a firefly’s attractiveness is proportional to the light intensity seen by neighbor fireflies, we can now define the attractiveness β of a firefly by
(2)β=β0e-γr2,
where β0 is the attractiveness at r=0. The movement of a firefly i is attracted to another more attractive firefly j, which is determined by
(3)xi=xi+β0e-γ·rij2(xj-xi)+αε.The third term is the randomization with the stepα, being drawn from a Gaussian distribution. In [2], the Levy distribution was used instead of the Gaussian one. Based on the comments in [1] the implementation of standard FA was adopted β0=1 and α generated with uniform distribution in range [0,1]. The procedure for implementing the FA can be summarized as the pseudocode revealed in Pseudocode 1.Pseudocode 1:Pseudocode of the FA.
Begin
Objective functionf(x),x=(x1,…,xd)T
Generate initial population ofn fireflies xi,i=1,2,…,n
Formulate light intensityI so that it is associated with f(x)
While (t<MaxGeneration)
Define absorption coefficientγ
fori=1:n (n fireflies)
forj=1:n (n fireflies)
if (Ij>Ii),
move fireflyi towards j
end if
Vary attractiveness with distancer via exp(-γr∧2)
Evaluate new solutions and update light intensity
end forj
end fori
Rank the fireflies and find the current best
end while
Post-processing the results and visualization
end


## 2.2. Problems of Setting Step in Standard Firefly Algorithm

In standard FA, the third term of (3) is the randomization with step α. It generates with uniform distribution in range [0,1]. In general, the method of setting step is static or linear; step just depends on maximum generation, which cannot be adaptive to different fireflies. Firstly, each firefly has the same step settings, and its value decreases from iteration to iteration. Consequently, it may trap in the local optimum, resulting in premature convergence. Secondly, a large step can make the firefly skip the best optimal solution when it is in the neighborhood of the firefly, during the early stage of the search. Therefore, this may reduce the search performance.Finally, we can see from (3), that it is helpful for firefly to explore new search space with a large step, but it is not useful to the convergence of global optimum. If step has a small value, the result is contrary. For this reason, the step α has a great effect on the exploration and convergence of the algorithm. The value of α decreases slowly with the large number of iterations but decreases rapidly with the small number of iterations. To take into account the above issues, a new method based on self-adaptive step is introduced which considers the respective experience of each firefly.


## 3. Proposed Firefly Algorithm

When we make a decision, two important messages are usually integrated, which is known by Boyd and Richerson, on the exploration of human decision-making process. One is the experience of themselves and their neighbors. The other is the current situation. Inspired by this idea, we use it to set the step of each firefly to guide its search in the search space [20].


### 3.1. Self-Adaptive Step Settings

To solve the problems mentioned in Section2, step settings should vary with the different problems, fireflies, and environment. Based on these considerations, a method is presented that sets the step of each firefly according to its respective experience and current situation. The step of firefly near the optimal solution should be set small. Similarly, the step of firefly far away from the optimal solution should be set large. Fireflies between the above two are used to balance the global search and local search. Therefore, the step of firefly should also be concerned with its historical information and current situation. In this paper, firefly’s history information includes its past two iteration’s optimum value. Based on the comments mentioned above and many experiments, the step α of each firefly is calculated by (4) and (5), respectively [21]. Consider
(4)hi(t)=1(fpi(t-1)-fpi(t-2))2+1,(5)αi(t+1)=1-1(fbest(t)-fi(t))2+hi(t)2+1,
where hi(t) is the past two iterations’ history information of ith firefly. fpi is the fitness value of the best solution of ith firefly. fbest is the fitness value of the best solution of population heretofore found, and fi is the fitness value of ith firefly, which reflects the current information. The next iteration step of each firefly is self-adaptive, determined by the difference between its current fitness value and the best fitness value of the population. So the step of each firefly can vary with the iteration, and the step of each firefly is also altered at the same iteration. Obviously, the step of each firefly is different for various problems, because different fitness functions are used.


### 3.2. Procedure of Self-Adaptive Step Firefly Algorithm

The implementation procedure of our proposed self-adaptive step firefly algorithm (SASFA) can be described as follows.Step 1.
Generate the initial population of fireflies,{x1,x2,…,xn}.Step 2.
Compute intensity for each firefly member,{I1,I2,…,In}.Step 3.
Update the step of each firefly. The step is calculated by (4) and (5).Step 4.
Move each fireflyi towards other brighter fireflies. The position of each firefly is updated by (3).Step 5.
Update the solution set.Step 6.
Terminate if a termination criterion is fulfilled; otherwise go to Step2.


## 3.1. Self-Adaptive Step Settings

To solve the problems mentioned in Section2, step settings should vary with the different problems, fireflies, and environment. Based on these considerations, a method is presented that sets the step of each firefly according to its respective experience and current situation. The step of firefly near the optimal solution should be set small. Similarly, the step of firefly far away from the optimal solution should be set large. Fireflies between the above two are used to balance the global search and local search. Therefore, the step of firefly should also be concerned with its historical information and current situation. In this paper, firefly’s history information includes its past two iteration’s optimum value. Based on the comments mentioned above and many experiments, the step α of each firefly is calculated by (4) and (5), respectively [21]. Consider
(4)hi(t)=1(fpi(t-1)-fpi(t-2))2+1,(5)αi(t+1)=1-1(fbest(t)-fi(t))2+hi(t)2+1,
where hi(t) is the past two iterations’ history information of ith firefly. fpi is the fitness value of the best solution of ith firefly. fbest is the fitness value of the best solution of population heretofore found, and fi is the fitness value of ith firefly, which reflects the current information. The next iteration step of each firefly is self-adaptive, determined by the difference between its current fitness value and the best fitness value of the population. So the step of each firefly can vary with the iteration, and the step of each firefly is also altered at the same iteration. Obviously, the step of each firefly is different for various problems, because different fitness functions are used.


## 3.2. Procedure of Self-Adaptive Step Firefly Algorithm

The implementation procedure of our proposed self-adaptive step firefly algorithm (SASFA) can be described as follows.Step 1.
Generate the initial population of fireflies,{x1,x2,…,xn}.Step 2.
Compute intensity for each firefly member,{I1,I2,…,In}.Step 3.
Update the step of each firefly. The step is calculated by (4) and (5).Step 4.
Move each fireflyi towards other brighter fireflies. The position of each firefly is updated by (3).Step 5.
Update the solution set.Step 6.
Terminate if a termination criterion is fulfilled; otherwise go to Step2.


## 4. Experiments and Results

The proposed SASFA and standard FA are tested on sixteen benchmark functions which are given in Table1. All simulations are run in Matlab 2010b with 2 GB of random access memory. To eliminate stochastic discrepancy, in each case study, it adopted 100 independent runs for each of the optimization methods, involving 100 different initial trial solutions for each optimization method. The number of fireflies was 30, and the maximum iteration number was 300.Table 1
Benchmark functions.
Functions
Formulations
Limits
f
1
min
f
(
x
)
=
e
-
(
x
1
-
4
)
2
-
(
x
2
-
4
)
2
+
e
-
(
x
1
+
4
)
2
-
(
x
2
-
4
)
2
+
2
e
-
x
1
2
-
(
x
2
+
4
)
2
+
2
e
-
x
1
2
-
x
2
2
x
i
∈
[
-
5,5
]
f
2
min
f
(
x
)
=
(
|
x
1
|
-
5
)
2
+
(
|
x
2
|
+
5
)
2
x
i
∈
[
-
10,10
]
f
3
min
f
(
x
)
=
100
(
x
2
-
x
1
)
2
+
(
6.4
(
x
2
-
0.5
)
2
-
x
1
-
0.6
)
2
x
i
∈
[
-
5,5
]
f
4
min
f
(
x
)
=
100
(
x
2
-
x
1
2
)
2
+
(
x
1
-
1
)
2
x
i
∈
[
-
2.048,2.048
]
f
5
min
f
(
x
)
=
(
x
2
-
5.1
4
π
2
x
1
2
+
5
π
x
1
-
6
)
2
+
10
(
1
-
1
8
π
)
cos
x
1
+
10
x
i
∈
[
-
5,15
]
f
6
min
f
(
x
)
=
x
1
2
+
x
2
2
-
cos
(
18
x
1
)
-
cos
(
18
x
2
)
x
i
∈
[
-
1,1
]
f
7
min
f
(
x
)
=
(
x
1
+
2
x
2
-
7
)
2
+
(
2
x
1
x
2
-
5
)
2
x
i
∈
[
-
10,10
]
f
8
min
f
(
x
)
=
4
x
1
2
+
2.1
x
1
4
+
1
3
x
1
6
+
x
1
x
2
-
4
x
1
2
+
4
x
1
4
x
i
∈
[
-
5,5
]
f
9
min
f
(
x
)
=
{
1
+
(
x
1
+
x
2
+
1
)
2
(
19
-
14
x
1
+
3
x
1
2
-
14
x
1
+
6
x
1
x
2
+
3
x
1
2
)
}
{
30
+
(
2
x
1
-
3
x
2
)
2
(
18
-
32
x
1
+
12
x
1
2
+
48
x
2
-
36
x
1
x
2
+
27
x
2
2
)
}
x
i
∈
[
-
2,2
]
f
10
min
f
(
x
)
=
sin
(
x
1
2
+
x
2
2
-
0.5
)
1
+
0.001
(
x
1
2
+
x
2
2
)
2
-
0.5
x
i
∈
[
-
10,10
]
f
11
max
f
(
x
)
=
-
(
20
+
(
x
2
-
10
cos
(
2
π
x
1
)
)
+
(
x
2
2
-
10
cos
(
2
π
x
2
)
)
)
x
i
∈
[
-
2.048,2.048
]
f
12
max
f
(
x
)
=
cos
x
1
cos
x
2
e
-
(
x
1
-
π
)
2
-
(
x
2
-
π
)
2
x
i
∈
[
-
20,20
]
f
13
max
f
(
x
)
=
280
-
(
x
1
4
-
16
x
1
2
+
5
x
1
)
2
-
(
x
2
4
-
16
x
2
2
+
5
x
2
)
2
x
i
∈
[
-
5,5
]
f
14
max
f
(
x
)
=
ln
{
[
(
sin
(
cos
x
1
+
cos
x
2
)
2
)
2
-
(
cos
(
sin
x
1
+
sin
x
2
)
2
)
2
+
x
1
]
2
}
-
0.1
(
(
x
1
-
1
)
2
+
(
x
2
-
1
)
2
)
x
i
∈
[
-
10,10
]
f
15
max
f
(
x
)
=
-
[
∑
i
=
1
5
i
cos
(
i
+
1
)
x
1
+
i
]
[
∑
i
=
1
5
i
cos
(
i
cos
(
i
+
1
)
x
2
+
i
)
]
x
i
∈
[
-
10,10
]
f
16
max
f
(
x
)
=
660
-
(
x
1
2
+
x
2
-
11
)
2
-
(
x
1
+
x
2
2
-
7
)
2
x
i
∈
[
-
6,6
]Table2 shows the best solution, the worst solution, the medium of solutions, and the standard deviation of 100 runs. Medium of solutions and standard deviation of 100 runs are considered to measure the scalability. Table 2 reveals the striking potential of the SASFA in obtaining the optimal solution with high precision, and the solutions of SASFA are better than the solutions found by standard FA.Table 2
Comparison of standard FA and SASFA.
Functions
Optimization method
Best solution
Worst solution
Medium of solutions
Standard deviation
f
1
Standard FA
1.017552
E
-
12
9.648893
E
-
11
3.065379
E
-
12
9.930156
E
-
12
SASFA
1.017595
E
-
12
1.043827
E
-
12
1.026483
E
-
12
5.723552
E
-
15
f
2
Standard FA
2.500005
E
+
01
4.339859
E
+
01
2.647969
E
+
01
2.582632
E
+
00
SASFA
2.500019
E
+
01
2.501609
E
+
01
2.500482
E
+
01
3.358280
E
-
03
f
3
Standard FA
1.345107
E
-
12
5.080286
E
+
01
5.080286
E
-
01
5.080286
E
+
00
SASFA
1.640501
E
-
14
5.474220
E
-
03
1.074990
E
-
03
1.152379
E
-
03
f
4
Standard FA
1.085659
E
-
13
1.288528
E
+
00
6.863843
E
-
02
1.597118
E
-
01
SASFA
4.991661
E
-
08
4.744487
E
-
04
2.186426
E
-
05
5.391553
E
-
05
f
5
Standard FA
3.978874
E
-
01
2.024074
E
+
00
4.245216
E
-
01
1.715188
E
-
01
SASFA
3.978882
E
-
01
3.980451
E
-
01
3.979238
E
-
01
3.732067
E
-
05
f
6
Standard FA
-
2.000000
E
+
00
-
1.757801
E
+
00
-
1.979413
E
+
00
4.885083
E
-
02
SASFA
-
2.000000
E
+
00
-
1.859492
E
+
00
-
1.996340
E
+
00
1.833774
E
-
02
f
7
Standard FA
1.975868
E
-
13
4.346346
E
+
01
5.078575
E
+
00
8.627606
E
+
00
SASFA
5.542967
E
-
14
8.963713
E
-
04
9.258293
E
-
05
1.227339
E
-
04
f
8
Standard FA
-
1.031628
E
+
00
-
9.940826
E
-
01
-
1.031253
E
+
00
3.754586
E
-
03
SASFA
-
1.031628
E
+
00
-
1.031575
E
+
00
-
1.031615
E
+
00
1.269080
E
-
05
f
9
Standard FA
3.000000
E
+
00
8.400000
E
+
01
8.065019
E
+
00
1.289350
E
+
01
SASFA
3.000000
E
+
00
3.017131
E
+
00
3.001386
E
+
00
2.768176
E
-
03
f
10
Standard FA
7.283618
E
-
13
1.674303
E
-
02
8.079304
E
-
03
3.942527
E
-
03
SASFA
9.985832
E
-
08
9.716095
E
-
03
7.439098
E
-
03
4.036846
E
-
03
f
11
Standard FA
-
9.949591
E
-
01
-
9.949591
E
-
01
-
9.949591
E
-
01
1.673724
E
-
15
SASFA
-
2.844390
E
-
04
-
2.844390
E
-
04
-
2.844390
E
-
04
2.179328
E
-
19
f
12
Standard FA
1.000000
E
+
00
2.326942
E
-
42
8.127414
E
-
02
2.306928
E
-
01
SASFA
1.000000
E
+
00
7.680531
E
-
05
7.687526
E
-
01
4.105102
E
-
01
f
13
Standard FA
3.583323
E
+
02
3.441956
E
+
02
3.581890
E
+
02
1.413611
E
+
00
SASFA
3.583323
E
+
02
3.583305
E
+
02
3.583320
E
+
02
4.197847
E
-
04
f
14
Standard FA
2.205095
E
+
00
1.200545
E
+
00
1.820786
E
+
00
2.814797
E
-
01
SASFA
2.205094
E
+
00
1.776040
E
+
00
2.195012
E
+
00
6.151606
E
-
02
f
15
Standard FA
1.867309
E
+
02
4.712473
E
+
01
1.628826
E
+
02
4.008809
E
+
01
SASFA
1.867308
E
+
02
1.834636
E
+
02
1.863022
E
+
02
5.283146
E
-
01
f
16
Standard FA
6.600000
E
+
02
6.600000
E
+
02
6.600000
E
+
02
1.771468
E
-
11
SASFA
6.600000
E
+
02
6.599976
E
+
02
6.599997
E
+
02
4.307035
E
-
04Figures1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, and 16 give the comparison of convergence processes of the SASFA and standard FA in the above sixteen benchmark functions. It can be found out that SASFA outperformed standard FA with the same parameter settings. Convergence curves depict the provision trade-off between exploration and exploitation of the SASFA during the search process.Figure 1
Comparison of curve graph forf1.Figure 2
Comparison of curve graph forf2.Figure 3
Comparison of curve graph forf3.Figure 4
Comparison of curve graph forf4.Figure 5
Comparison of curve graph forf5.Figure 6
Comparison of curve graph forf6.Figure 7
Comparison of curve graph forf7.Figure 8
Comparison of curve graph forf8.Figure 9
Comparison of curve graph forf9.Figure 10
Comparison of curve graph forf10.Figure 11
Comparison of curve graph forf11.Figure 12
Comparison of curve graph forf12.Figure 13
Comparison of curve graph forf13.Figure 14
Comparison of curve graph forf14.Figure 15
Comparison of curve graph forf15.Figure 16
Comparison of curve graph forf16.


## 5. Conclusions and Further Research

In the paper, we have proposed a self-adaptive step firefly algorithm which considers the current situation and historical information of each firefly. Simulation results demonstrated the potential of the proposed algorithm. Considering more iteration’s information of the algorithm could be an exciting direction in future.



---

*Source: 832718-2013-11-02.xml*