# Modified Firefly Algorithm

Authors: Surafel Luleseged Tilahun; Hong Choon Ong
Journal: Journal of Applied Mathematics
 (2012)

---

## Abstract

Firefly algorithm is one of the new metaheuristic algorithms for optimization problems. The algorithm is inspired by the flashing behavior of fireflies. In the algorithm, randomly generated solutions will be considered as fireflies, and brightness is assigned depending on their performance on the objective function. One of the rules used to construct the algorithm is, a firefly will be attracted to a brighter firefly, and if there is no brighter firefly, it will move randomly. In this paper we modify this random movement of the brighter firefly by generating random directions in order to determine the best direction in which the brightness increases. If such a direction is not generated, it will remain in its current position. Furthermore the assignment of attractiveness is modified in such a way that the effect of the objective function is magnified. From the simulation result it is shown that the modified firefly algorithm performs better than the standard one in finding the best solution with smaller CPU time.


---

## Body

## 1. Introduction

An optimization problem is a problem of finding values for the variables of a function to optimize the function. These kinds of problems exist in many disciplines [1–4]. Whenever a decision needs to be made and the problem is formulated using mathematical terms, optimization solution methods will be used to solve the formulated problem. The solution methods exist depending on the behavior of the problem. For example, if both the objective function and the functions which construct the feasible region are linear, it is called a linear programming problem, and methods like simplex algorithm will be used to solve it [5]. Some of the solution methods depend on the derivatives of the objective function [6, 7]. Even though there are many solution methods, there are many problems which need special attention and are hard to solve using the deterministic solution methods.Metaheuristic algorithms are optimization algorithms which try to improve the quality of solution members iteratively with some randomness properties. Most of these algorithms are inspired by biological aspects. Unlike deterministic solution methods metaheuristic algorithms are not affected by the behavior of the optimization problem [8]. This makes the algorithm to be used widely in different fields [9–11]. Since the introduction of genetic algorithm in 1975, many metaheuristic algorithms are introduced [12]. Firefly algorithm is one of the new algorithms introduced in 2009 by Yang [13]. The algorithm mimics the behavior of fireflies. It has three ideal rules. One among these rules is that a firefly will follow the brighter firefly, and if there is no brighter firefly, it will move randomly.In this paper we modify this random movement of the brighter firefly, and we also modify the way how the attractiveness, which is used to compute the brightness, is computed. Simulation is also done on selected benchmark problems. From the simulation result it is shown that the modified firefly algorithm performs better than the standard firefly algorithm. In the next section basic concepts will be discussed followed by a discussion on the modified firefly algorithm in Section3. Simulation results will be presented in Section 4 followed by the conclusion in Section 5.


## 2. Basic Concepts

### 2.1. Optimization Problem

An optimization problem has basically three components: a function to optimize, possible solution set to choose a value for the variable from, and the optimization rule, which will be either maximized or minimized. Since one can switch between minimization and maximization problems by multiplying the objective function by negative one, analyzing either minimization or maximization problem is enough. A typical maximization problem can be given as follows:(2.1)maxf(x),s.t.x∈S⊆ℜn.A solution for this problem is a member of setS which gives the maximum value of f(x) compared to all elements in S. Mathematically, x* is a solution if and only if x*∈S and f(x*)≥f(x),forallx∈S.The aim of all solution methods and algorithms is to find suchx*.


### 2.2. Firefly Algorithm

Firefly algorithm is a bio-inspired metaheuristic algorithm for optimization problems. It was introduced in 2009 at Cambridge University by Yang [14]. The algorithm is inspired by the flashing behavior of fireflies at night. One of the three rules used to construct the algorithm is that all fireflies are unisex, which means any firefly can be attracted to any other brighter one. The second rule is that the brightness of a firefly is determined from the encoded objective function. The last rule is that attractiveness is directly proportional to brightness but decreases with distance, and a firefly will move towards the brighter one, and if there is no brighter one, it will move randomly.From elementary physics it is clear that the intensity of light is inversely proportional to the square of the distance, sayr, from the source. Furthermore when light passes through a medium with light absorption coefficient of  λ the light intensity, I varies with distance r as given below:
(2.2)I(r)=I0e-λr,
where I0 is the intensity at the source point.These can be combined as(2.3)I(r)=I0e-λr2.However, computationally computing1/(1+λr2) is easier than computing e-λr2 [14]. Hence the intensity can be calculated using
(2.4)I(r)=I01+λr2.Similarly, the attractiveness of a firefly can be defined as follows:(2.5)A(r)=A01+λr2,
where A0 is the attractiveness at r=0.If a firefly located atx′=(x1′,x2′,…,xn′) is brighter than another firefly located at x=(x1,x2,…,xn), the firefly located at x will move towards x′. The location update of the firefly located at x will be done as follows:
(2.6)x:=x+A0e-λr2(x′-x)+αε.The last term is a randomization term withα being a randomization parameter with 0≤α≤1 and ε vector of random numbers, whereas the second term is due to the attraction of x  towards x′. According to [13] for practical uses A0 can be taken as one, A0=1.The algorithm can be summarized as follows.(1)
Generate a random solution set,{x1,x2,…,xk}.(2)
Compute intensity for each solution member,{I1,I2,…,Ik}.(3)
Move each fireflyi towards other brighter fireflies, and if there is no other brighter firefly, move it randomly.(4)
Update the solution set.(5)
Terminate if a termination criterion is fulfilled otherwise go back to step 2.


## 2.1. Optimization Problem

An optimization problem has basically three components: a function to optimize, possible solution set to choose a value for the variable from, and the optimization rule, which will be either maximized or minimized. Since one can switch between minimization and maximization problems by multiplying the objective function by negative one, analyzing either minimization or maximization problem is enough. A typical maximization problem can be given as follows:(2.1)maxf(x),s.t.x∈S⊆ℜn.A solution for this problem is a member of setS which gives the maximum value of f(x) compared to all elements in S. Mathematically, x* is a solution if and only if x*∈S and f(x*)≥f(x),forallx∈S.The aim of all solution methods and algorithms is to find suchx*.


## 2.2. Firefly Algorithm

Firefly algorithm is a bio-inspired metaheuristic algorithm for optimization problems. It was introduced in 2009 at Cambridge University by Yang [14]. The algorithm is inspired by the flashing behavior of fireflies at night. One of the three rules used to construct the algorithm is that all fireflies are unisex, which means any firefly can be attracted to any other brighter one. The second rule is that the brightness of a firefly is determined from the encoded objective function. The last rule is that attractiveness is directly proportional to brightness but decreases with distance, and a firefly will move towards the brighter one, and if there is no brighter one, it will move randomly.From elementary physics it is clear that the intensity of light is inversely proportional to the square of the distance, sayr, from the source. Furthermore when light passes through a medium with light absorption coefficient of  λ the light intensity, I varies with distance r as given below:
(2.2)I(r)=I0e-λr,
where I0 is the intensity at the source point.These can be combined as(2.3)I(r)=I0e-λr2.However, computationally computing1/(1+λr2) is easier than computing e-λr2 [14]. Hence the intensity can be calculated using
(2.4)I(r)=I01+λr2.Similarly, the attractiveness of a firefly can be defined as follows:(2.5)A(r)=A01+λr2,
where A0 is the attractiveness at r=0.If a firefly located atx′=(x1′,x2′,…,xn′) is brighter than another firefly located at x=(x1,x2,…,xn), the firefly located at x will move towards x′. The location update of the firefly located at x will be done as follows:
(2.6)x:=x+A0e-λr2(x′-x)+αε.The last term is a randomization term withα being a randomization parameter with 0≤α≤1 and ε vector of random numbers, whereas the second term is due to the attraction of x  towards x′. According to [13] for practical uses A0 can be taken as one, A0=1.The algorithm can be summarized as follows.(1)
Generate a random solution set,{x1,x2,…,xk}.(2)
Compute intensity for each solution member,{I1,I2,…,Ik}.(3)
Move each fireflyi towards other brighter fireflies, and if there is no other brighter firefly, move it randomly.(4)
Update the solution set.(5)
Terminate if a termination criterion is fulfilled otherwise go back to step 2.


## 3. Modified Firefly Algorithm

The brightest firefly is a firefly with current global best solution. If this brightest firefly moves randomly as in the standard firefly algorithm, its brightness may decrease depending on the direction. This leads to the decrement of the performance of the algorithm in that particular iteration. However, if this brightest firefly is allowed to move only if in a direction in which its brightness improves, it will not decrease the performance of the algorithm in terms of global best solution for the solutions in that particular iteration. The modification proposed in this paper is as follows. To determine the movement direction of the brightest firefly, randomly generatem unit vectors, say u1,u2,…,um. Then choose a direction, U, among the randomly generated m directions in which the brightness of the brightest firefly increases if the firefly moves in that direction. Hence, the movement of the brightest firefly can be described as follows:
(3.1)x:=x+αU,
where α is a random step length.If such direction does not exist among the randomly generated solutions, the brightest firefly will stay in its current position.Furthermore, rather than takingA0i=1 for each firefly i, it is better to assign a source attractiveness which depends on the intensity of the firefly, which in turn depends on the objective function. One possible way to do so is to assign the ratio of the intensity of fireflies. Suppose firefly i, located at x′, is brighter than a firefly j, which is located at x. Then the firefly located at x will move towards firefly i, as given in (2.6), but A0 is given by
(3.2)A0=I0′I0,
where I0′ is the intensity at r=0 for firefly i and I0 is the intensity at r=0 for firefly j and I0≠0. For practical cases, to eliminate the singularity case when I0=0, A0 can also be described as eI0′-I0.If we takeA0=I0′ and if the intensity is large, the movement of firefly j towards i may be long. However depending on the solution space it is better to adjust A0. In either case it should be directly proportional to the intensity at the source, I0′.


## 4. Simulation Results

To test the performance of modified firefly algorithm and compare it with the standard firefly algorithm, seven test problems are selected. The test functions include stochastic, multimodal, unimodal, continuous, and discontinuous benchmark problems. For each test problem the same randomly generated initial solution set is used for both the modified and the standard firefly algorithms with absorption coefficient,λ, equaling 2, and the number of random directions for local search in the case of modified firefly algorithm is 20. Furthermore the iteration number is set to be 500.


### 4.1. The First Test Problem

The objective function of the first test problem used for the simulation purpose is the negative of second function of De Jong, and the problem is given as in [15]:
(4.1)maxf1=-(20+(x12-10cos2πx1)+(x22-10cos2πx2)),s.t.-2.048≤x1,x2≤2.048.It is one of the well-known benchmark optimization problems with many local optimums and a unique global optimum of 0 at (0, 0).The modified firefly algorithm and the standard firefly algorithm are used to solve this maximization problem withα=1.2, and the result is recorded as shown in Figure 1.Figure 1
Simulation result of the first test problem.After running the program the solutions found using the standard firefly algorithm and the modified firefly algorithm are −0.1239 and −0.0001 at(-0.0207,0.0140) and (0.0000,0.0005), respectively.


### 4.2. The Second Test Problem

The second test problem used is based on Esom’s function [16], and the problem is given as
(4.2)maxf2=(cosx1cosx2)e-(x1-π)2-(x2-π)2,s.t.-20≤x1,x2≤20.This is an optimization problem with a unique global solution. However, the behavior of the objective function with wide flat surface and an optimum of 1 at(π,π) makes it a hard optimization problem.The result after running the simulation, withα=10, is recorded in Figure 2.Figure 2
Simulation result of the second test problem.According to the simulation result, the standard firefly algorithm gives a result of 0.9782 at(3.2044,3.0378), whereas the modified firefly algorithm gives 1 at (3.1420,3.1413).


### 4.3. The Third Test Problem

The third test problem is a discontinuous test problem taken from [17]. It is given as follows:
(4.3)maxf3=∑i=12int(xi),s.t.-5.12≤x1,x2≤5.12.The optimum solution is 10 and is found whenxi≥4.5, for i=1,2. If a suitable step length is not assigned, many algorithms tend to be trapped on one of the flat surfaces rather than moving towards the optimal solution.After the 500 iterations the final functional value for the two algorithms is found to be 10 at (5.1149, 5.0934) for the standard firefly algorithm and (5.1200, 5.1200) for the modified firefly algorithm. The algorithm parameterα is set to be 2.4. The performance graph of the two algorithm overlaps as shown in Figure 3.Figure 3
Simulation result of the third test problem.


### 4.4. The Fourth Test Problem

The fourth test problem is taken from Mishra [18]. It is given as follows
(4.4)maxf4=ln{[(sin(cosx1+cosx2)2)2-(cos(sinx1+sinx2)2)2+x1]2}-0.1((x1-1)2+(x2-1)2),s.t.-10≤x1,x2≤10.This is a multimodal function with optimal functional value of 2.28395 at(2.8863,1.8233).The simulation result for the fourth test problem, withα = 5, is given in Figure 4.Figure 4
Simulation result of the fourth test problem.From the simulation result the final functional value for the standard and modified firefly algorithm is found to be 2.2308 at (2.8765, 1.9518) and 2.2839 at (2.8864, 1.8234), respectively.


### 4.5. The Fifth Test Problem

The fifth test problem is a stochastic test. Owing to the random noise parameter it is unlikely to get the same result at a point in different iterations [19]. It is given as follows:
(4.5)maxf5=5e-(x1-π)2-(x2-π)2+∑j=12∑i=12εije-(x1-i)2-(x2-j)2,s.t.0≤x1,x2≤10,
where εij is a random number between 0 and 1. The optimal value is found at (π,π) with the functional value between 5 and 5.0794 depending on the random number εij.4.8828 and 5.0279 are the final functional values obtained after the simulation for the standard and modified firefly algorithm at (2.9504, 3.1789) and (3.1455, 3.1368), respectively. Figure5 shows the functional values for the two algorithms in the 500 iterations with α=2.4.Figure 5
Simulation result of the fifth test problem.


### 4.6. The Sixth Test Problem

The sixth test problem is a maximization problem with an objective function called the Styblinski function [20]. It is multimodal problem with optimum solution of 358.3323 at (−2.9035, −2.9035). It is given as follows:
(4.6)maxf6=280-(x14-16x12+5x12+x24-16x22+5x22),s.t.-5≤x1,x2≤5.After the simulation the final functional value for the standard and modified firefly algorithm is found to be 358.2775 at (−2.9495, −2.8714) and 358.3323 at (−2.9040, −2.9040), respectively. Like the previous simulationα is set to be 2.4. Figure 6 shows the performance of the two algorithms in the 500 iterations.Figure 6
Simulation result of the sixth test problem.


### 4.7. The Seventh Test Problem

The objective function of the last test problem is taken to be the negative of Shubert’s function. It is a multimodal test function. It is given as(4.7)maxf7=-[∑i=15icos((i+1)x1+i)][∑i=15icos((i+1)x2+i)],s.t.-10≤x1,x2≤10.It has 760 optimum solutions among which 18 are global optimal with functional optimum value of 186.73067 [21].Figure7 shows the performance of the two algorithms for the seventh test problem, with α=5.Figure 7
Simulation result of the seventh test problem.From the simulation the final functional values for the standard and modified firefly algorithms are found to be 183.4958 at (0.3895, −0.1890) and 186.7290 at (−0.1989, −5.8586), respectively.The simulation results of the test problems can be summarized in Table1.Table 1
Summery of simulation results, with maximum number of iterations as a termination criterion.
f
1
(
x
)
f
2
(
x
)
f
3
(
x
)
f
4
(
x
)
f
5
(
x
)
f
6
(
x
)
f
7
(
x
)
x
*
(0,0)
(
π
,
π
)
x
1
,
x
2
≥
4.5
(2.8863, 1.8233)
(
π
,
π
)
(−2.9035, −2.9035)
multiple
f
*
=
f
(
x
*
)
0
1
10
2.28395
[
5,5.0794
]
358.3323
186.73067
x
s
*
(−0.0207, 0.0140)
(3.2044, 3.0378)
(5.1149, 5.0934)
(2.8765, 1.9518)
(2.9504, 3.1789)
(−2.9495, −2.8714)
(0.3895, −0.1890)
f
s
*
=
f
(
x
s
*
)
-
0.1239
0.9782
10
2.2308
4.8828
358.2775
183.4958
x
m
*
(0.0.0005)
(3.1420, 3.1413)
(5.12, 5.12)
(2.8864, 1.8234)
(3.1455, 3.1368)
(−2.904, −2.904)
(−0.1989,−5.8586)
f
m
*
=
f
(
x
m
*
)
-
0.0001
1
10
2.2839
5.0279
358.3323
186.7290
CP
U
s
0.1248
0.1404
0.1404
0.1560
0.2184
0.1716
0.1248
CP
U
m
0.1404
0.1560
0.1404
0.1716
0.2340
0.1872
0.2028
x
* the optimal solution with f* as the global optimal value.
x
s
* is the solution of the ordinary firefly algorithm.
f
s
* is the final functional value in the ordinary firefly algorithm.
x
m
* is the solution of the modified firefly algorithm.
f
m
* is the final functional value in the modified algorithm.
CP
U
s CPU time for the standard firefly algorithm.
CP
U
m CPU time for the modified firefly algorithm.For the simulation results it is clearly shown that the modified firefly algorithm performs better than the standard firefly algorithm. From the figures, the standard firefly algorithms performance is not always improving but sometimes gets down from the current optimal solution which is not the case in the modified firefly algorithm for all the test problems. Even though the CPU time for the modified firefly algorithm is slightly higher it gives better solution after the 500 iterations. If the termination criterion is set to achieve a certain target, sayf′, which is very near to the global optimal solution, the modified firefly algorithm will terminate before the standard firefly algorithm, as shown in Table 2. The two algorithms are run 100 times, and the average CPU time and average iterations number before termination are recorded, with the termination criterion are achieving at least f′. This means that the algorithm keep running until the objective function becomes f′ or more, where f′ is chosen to be a very close number to the global optimal solution.Table 2
Summary of simulation results, with an achievement level as a termination criterion.
f
1
(
x
)
f
2
(
x
)
f
3
(
x
)
f
4
(
x
)
f
5
(
x
)
f
6
(
x
)
f
7
(
x
)
f
′
−0.01
0.99
10
2.28
4.9
358.2
186
CP
U
s
0.1243
0.1569
0.1100
0.1601
0.1892
0.1687
0.1304
CP
U
m
0.0936
0.0321
0.0122
0.0982
0.0789
0.0654
0.0776
Itr
.
s
152.45
235.2
11.2
61.25
87.31
99.54
121.25
Itr
.
m
57.9
46.8
6.28
31.64
35.48
40.68
29.96
f
′: the target for termination criterion.
CP
U
s: average  CPU time for the standard firefly algorithm.
CP
U
m: average CPU time for the modified firefly algorithm.
Itr
.
s: average iteration number for the standard firefly algorithm before termination.
Itr
.
m: average iteration number for the modified firefly algorithm before termination.From Table2, it is shown that when the termination criterion is not the maximum number of iterations but a certain achievement level, the modified firefly algorithm achieves the target with less number of iterations which results in less CPU time as compared to the standard firefly algorithm.


## 4.1. The First Test Problem

The objective function of the first test problem used for the simulation purpose is the negative of second function of De Jong, and the problem is given as in [15]:
(4.1)maxf1=-(20+(x12-10cos2πx1)+(x22-10cos2πx2)),s.t.-2.048≤x1,x2≤2.048.It is one of the well-known benchmark optimization problems with many local optimums and a unique global optimum of 0 at (0, 0).The modified firefly algorithm and the standard firefly algorithm are used to solve this maximization problem withα=1.2, and the result is recorded as shown in Figure 1.Figure 1
Simulation result of the first test problem.After running the program the solutions found using the standard firefly algorithm and the modified firefly algorithm are −0.1239 and −0.0001 at(-0.0207,0.0140) and (0.0000,0.0005), respectively.


## 4.2. The Second Test Problem

The second test problem used is based on Esom’s function [16], and the problem is given as
(4.2)maxf2=(cosx1cosx2)e-(x1-π)2-(x2-π)2,s.t.-20≤x1,x2≤20.This is an optimization problem with a unique global solution. However, the behavior of the objective function with wide flat surface and an optimum of 1 at(π,π) makes it a hard optimization problem.The result after running the simulation, withα=10, is recorded in Figure 2.Figure 2
Simulation result of the second test problem.According to the simulation result, the standard firefly algorithm gives a result of 0.9782 at(3.2044,3.0378), whereas the modified firefly algorithm gives 1 at (3.1420,3.1413).


## 4.3. The Third Test Problem

The third test problem is a discontinuous test problem taken from [17]. It is given as follows:
(4.3)maxf3=∑i=12int(xi),s.t.-5.12≤x1,x2≤5.12.The optimum solution is 10 and is found whenxi≥4.5, for i=1,2. If a suitable step length is not assigned, many algorithms tend to be trapped on one of the flat surfaces rather than moving towards the optimal solution.After the 500 iterations the final functional value for the two algorithms is found to be 10 at (5.1149, 5.0934) for the standard firefly algorithm and (5.1200, 5.1200) for the modified firefly algorithm. The algorithm parameterα is set to be 2.4. The performance graph of the two algorithm overlaps as shown in Figure 3.Figure 3
Simulation result of the third test problem.


## 4.4. The Fourth Test Problem

The fourth test problem is taken from Mishra [18]. It is given as follows
(4.4)maxf4=ln{[(sin(cosx1+cosx2)2)2-(cos(sinx1+sinx2)2)2+x1]2}-0.1((x1-1)2+(x2-1)2),s.t.-10≤x1,x2≤10.This is a multimodal function with optimal functional value of 2.28395 at(2.8863,1.8233).The simulation result for the fourth test problem, withα = 5, is given in Figure 4.Figure 4
Simulation result of the fourth test problem.From the simulation result the final functional value for the standard and modified firefly algorithm is found to be 2.2308 at (2.8765, 1.9518) and 2.2839 at (2.8864, 1.8234), respectively.


## 4.5. The Fifth Test Problem

The fifth test problem is a stochastic test. Owing to the random noise parameter it is unlikely to get the same result at a point in different iterations [19]. It is given as follows:
(4.5)maxf5=5e-(x1-π)2-(x2-π)2+∑j=12∑i=12εije-(x1-i)2-(x2-j)2,s.t.0≤x1,x2≤10,
where εij is a random number between 0 and 1. The optimal value is found at (π,π) with the functional value between 5 and 5.0794 depending on the random number εij.4.8828 and 5.0279 are the final functional values obtained after the simulation for the standard and modified firefly algorithm at (2.9504, 3.1789) and (3.1455, 3.1368), respectively. Figure5 shows the functional values for the two algorithms in the 500 iterations with α=2.4.Figure 5
Simulation result of the fifth test problem.


## 4.6. The Sixth Test Problem

The sixth test problem is a maximization problem with an objective function called the Styblinski function [20]. It is multimodal problem with optimum solution of 358.3323 at (−2.9035, −2.9035). It is given as follows:
(4.6)maxf6=280-(x14-16x12+5x12+x24-16x22+5x22),s.t.-5≤x1,x2≤5.After the simulation the final functional value for the standard and modified firefly algorithm is found to be 358.2775 at (−2.9495, −2.8714) and 358.3323 at (−2.9040, −2.9040), respectively. Like the previous simulationα is set to be 2.4. Figure 6 shows the performance of the two algorithms in the 500 iterations.Figure 6
Simulation result of the sixth test problem.


## 4.7. The Seventh Test Problem

The objective function of the last test problem is taken to be the negative of Shubert’s function. It is a multimodal test function. It is given as(4.7)maxf7=-[∑i=15icos((i+1)x1+i)][∑i=15icos((i+1)x2+i)],s.t.-10≤x1,x2≤10.It has 760 optimum solutions among which 18 are global optimal with functional optimum value of 186.73067 [21].Figure7 shows the performance of the two algorithms for the seventh test problem, with α=5.Figure 7
Simulation result of the seventh test problem.From the simulation the final functional values for the standard and modified firefly algorithms are found to be 183.4958 at (0.3895, −0.1890) and 186.7290 at (−0.1989, −5.8586), respectively.The simulation results of the test problems can be summarized in Table1.Table 1
Summery of simulation results, with maximum number of iterations as a termination criterion.
f
1
(
x
)
f
2
(
x
)
f
3
(
x
)
f
4
(
x
)
f
5
(
x
)
f
6
(
x
)
f
7
(
x
)
x
*
(0,0)
(
π
,
π
)
x
1
,
x
2
≥
4.5
(2.8863, 1.8233)
(
π
,
π
)
(−2.9035, −2.9035)
multiple
f
*
=
f
(
x
*
)
0
1
10
2.28395
[
5,5.0794
]
358.3323
186.73067
x
s
*
(−0.0207, 0.0140)
(3.2044, 3.0378)
(5.1149, 5.0934)
(2.8765, 1.9518)
(2.9504, 3.1789)
(−2.9495, −2.8714)
(0.3895, −0.1890)
f
s
*
=
f
(
x
s
*
)
-
0.1239
0.9782
10
2.2308
4.8828
358.2775
183.4958
x
m
*
(0.0.0005)
(3.1420, 3.1413)
(5.12, 5.12)
(2.8864, 1.8234)
(3.1455, 3.1368)
(−2.904, −2.904)
(−0.1989,−5.8586)
f
m
*
=
f
(
x
m
*
)
-
0.0001
1
10
2.2839
5.0279
358.3323
186.7290
CP
U
s
0.1248
0.1404
0.1404
0.1560
0.2184
0.1716
0.1248
CP
U
m
0.1404
0.1560
0.1404
0.1716
0.2340
0.1872
0.2028
x
* the optimal solution with f* as the global optimal value.
x
s
* is the solution of the ordinary firefly algorithm.
f
s
* is the final functional value in the ordinary firefly algorithm.
x
m
* is the solution of the modified firefly algorithm.
f
m
* is the final functional value in the modified algorithm.
CP
U
s CPU time for the standard firefly algorithm.
CP
U
m CPU time for the modified firefly algorithm.For the simulation results it is clearly shown that the modified firefly algorithm performs better than the standard firefly algorithm. From the figures, the standard firefly algorithms performance is not always improving but sometimes gets down from the current optimal solution which is not the case in the modified firefly algorithm for all the test problems. Even though the CPU time for the modified firefly algorithm is slightly higher it gives better solution after the 500 iterations. If the termination criterion is set to achieve a certain target, sayf′, which is very near to the global optimal solution, the modified firefly algorithm will terminate before the standard firefly algorithm, as shown in Table 2. The two algorithms are run 100 times, and the average CPU time and average iterations number before termination are recorded, with the termination criterion are achieving at least f′. This means that the algorithm keep running until the objective function becomes f′ or more, where f′ is chosen to be a very close number to the global optimal solution.Table 2
Summary of simulation results, with an achievement level as a termination criterion.
f
1
(
x
)
f
2
(
x
)
f
3
(
x
)
f
4
(
x
)
f
5
(
x
)
f
6
(
x
)
f
7
(
x
)
f
′
−0.01
0.99
10
2.28
4.9
358.2
186
CP
U
s
0.1243
0.1569
0.1100
0.1601
0.1892
0.1687
0.1304
CP
U
m
0.0936
0.0321
0.0122
0.0982
0.0789
0.0654
0.0776
Itr
.
s
152.45
235.2
11.2
61.25
87.31
99.54
121.25
Itr
.
m
57.9
46.8
6.28
31.64
35.48
40.68
29.96
f
′: the target for termination criterion.
CP
U
s: average  CPU time for the standard firefly algorithm.
CP
U
m: average CPU time for the modified firefly algorithm.
Itr
.
s: average iteration number for the standard firefly algorithm before termination.
Itr
.
m: average iteration number for the modified firefly algorithm before termination.From Table2, it is shown that when the termination criterion is not the maximum number of iterations but a certain achievement level, the modified firefly algorithm achieves the target with less number of iterations which results in less CPU time as compared to the standard firefly algorithm.


## 5. Conclusion

Firefly algorithm is one of the newly introduced metaheuristic algorithms which mimic the behavior of fireflies at night. In this paper a discussion is given on modifying the algorithm so that the performance will be better. One of the modifications is identifying the best direction in which the brightness of the brightest firefly increases. If such a direction is found, from randomly generated directions, the brightest firefly will move in that direction. However, if such a direction is not found among the randomly generated directions, it will stay in its current position. Furthermore a modification is suggested in computing the attractiveness of each firefly atr=0. According to the simulation results done on selected seven benchmark problems with different properties, the modified firefly algorithm performs better in achieving the near optimal solution. Furthermore, when the termination criterion is to achieve at least a certain functional level, modified firefly algorithm achieves the target with less CPU time and iteration numbers.



---

*Source: 467631-2012-11-11.xml*