Modiﬁed Fireﬂy Algorithm

,


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 a medium with light absorption coefficient of λ the light intensity, I varies with distance r as given below: where I 0 is the intensity at the source point.These can be combined as I r I 0 e −λr 2 .

2.3
However, computationally computing 1/ 1 λr 2 is easier than computing e −λr 2 14 .Hence the intensity can be calculated using Similarly, the attractiveness of a firefly can be defined as follows: where A 0 is the attractiveness at r 0. If a firefly located at x x 1 , x 2 , . . ., x n is brighter than another firefly located at x x 1 , x 2 , . . ., x n , the firefly located at x will move towards x .The location update of the firefly located at x will be done as follows: x : x A 0 e −λr 2 x − x αε.

2.6
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 A 0 can be taken as one, A 0 1.
The algorithm can be summarized as follows.
3 Move each firefly i 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.

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 generate m unit vectors, say u 1 , u 2 , . . ., u m .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: x : x αU, 3.
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 taking A i 0 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 A 0 is given by where I 0 is the intensity at r 0 for firefly i and I 0 is the intensity at r 0 for firefly j and I 0 / 0. For practical cases, to eliminate the singularity case when I 0 0, A 0 can also be described as e I 0 −I 0 .If we take A 0 I 0 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 A 0 .In either case it should be directly proportional to the intensity at the source, I 0 .

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.

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
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.
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.

The Second Test Problem
The second test problem used is based on Esom's function 16 , and the problem is given as

4.2
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.
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 .

The Third Test Problem
The third test problem is a discontinuous test problem taken from 17 .It is given as follows:

4.3
The optimum solution is 10 and is found when x i ≥ 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.

The Fourth Test Problem
The fourth test problem is taken from Mishra 18 .It is given as follows max f 4 ln sin cos

4.4
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. 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.

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:  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.Figure 5 shows the functional values for the two algorithms in the 500 iterations with α 2.4.

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
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.

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
It has 760 optimum solutions among which 18 are global optimal with functional optimum value of 186.7306721 .
Figure 7 shows the performance of the two algorithms for the seventh test problem, with α 5.
Table 1: Summery of simulation results, with maximum number of iterations as a termination criterion.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 Table 1.
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, say f , 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.
From Table 2, 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.

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 at r 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.

Figure 1 :
Figure 1: Simulation result of the first test problem.

Figure 2 :
Figure 2: Simulation result of the second test problem.

Figure 3 :
Figure 3: Simulation result of the third test problem.

Figure 4 :
Figure 4: Simulation result of the fourth test problem.

Figure 5 :
Figure 5: Simulation result of the fifth test problem.

Figure 6 :
Figure 6: Simulation result of the sixth test problem.

Figure 7 :
Figure 7: Simulation result of the seventh test problem.
* 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.CPU s CPU time for the standard firefly algorithm.CPU m CPU time for the modified firefly algorithm. x

Table 2 :
Summary of simulation results, with an achievement level as a termination criterion.
m : average iteration number for the modified firefly algorithm before termination.