`Journal of Applied MathematicsVolume 2012 (2012), Article ID 467631, 12 pageshttp://dx.doi.org/10.1155/2012/467631`
Research Article

Modified Firefly Algorithm

School of Mathematical Sciences, Universiti Sains Malaysia, 11800 Minden, Penang, Malaysia

Received 25 May 2012; Revised 1 October 2012; Accepted 1 October 2012

Copyright © 2012 Surafel Luleseged Tilahun and Hong Choon Ong. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

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.

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 [14]. 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 [911]. 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 Section 3. 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:

A solution for this problem is a member of set which gives the maximum value of compared to all elements in . Mathematically, is a solution if and only if and .

The aim of all solution methods and algorithms is to find such .

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, say , from the source. Furthermore when light passes through a medium with light absorption coefficient of the light intensity, varies with distance as given below: where is the intensity at the source point.

These can be combined as

However, computationally computing is easier than computing [14]. Hence the intensity can be calculated using

Similarly, the attractiveness of a firefly can be defined as follows: where is the attractiveness at .

If a firefly located at is brighter than another firefly located at , the firefly located at will move towards . The location update of the firefly located at will be done as follows:

The last term is a randomization term with being a randomization parameter with and vector of random numbers, whereas the second term is due to the attraction of towards . According to [13] for practical uses can be taken as one, .

The algorithm can be summarized as follows.(1)Generate a random solution set, .(2)Compute intensity for each solution member, .(3)Move each firefly 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 generate unit vectors, say . Then choose a direction, , among the randomly generated 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: 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 for each firefly , 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 , located at , is brighter than a firefly , which is located at . Then the firefly located at will move towards firefly , as given in (2.6), but is given by where is the intensity at for firefly and is the intensity at for firefly and . For practical cases, to eliminate the singularity case when , can also be described as .

If we take and if the intensity is large, the movement of firefly towards may be long. However depending on the solution space it is better to adjust . In either case it should be directly proportional to the intensity at the source, .

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]:

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 , 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 and , 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

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 , 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 , whereas the modified firefly algorithm gives 1 at .

4.3. The Third Test Problem

The third test problem is a discontinuous test problem taken from [17]. It is given as follows:

The optimum solution is 10 and is found when , for . 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

This is a multimodal function with optimal functional value of 2.28395 at .

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

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 .

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:

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

It has 760 optimum solutions among which 18 are global optimal with functional optimum value of 186.73067 [21].

Figure 7 shows the performance of the two algorithms for the seventh test problem, with .

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

Table 1: Summery of simulation results, with maximum number of iterations as a termination criterion.

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 , 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 . This means that the algorithm keep running until the objective function becomes or more, where 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.

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.

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

Acknowledgments

This work is in part supported by the USM short-term Grant no. 304/PMATHS/6311126. The first author would like to acknowledge a support from TWAS-USM fellowship.

References

1. N. Svilen and Z. Tsvetan, “Load optimization in training the olympic rowing (Skiff) champion from Beijing, 2008: case study,” Serbian Journal of Sports Sciences, vol. 5, pp. 41–50, 2011.
2. X. Gong, S. A. Vorobyov, and C. Tellambura, “Optimal bandwidth and power allocation for sum ergodic capacity under fading channels in cognitive radio networks,” IEEE Transactions on Signal Processing, vol. 59, no. 4, pp. 1814–1826, 2011.
3. S. S. Rao, Engineering Optimization: Theory and Practice, John Wiley & Sons, 3rd edition, 2009.
4. D. W. K. Yeung and L. A. Petrosyan, Subgame Consistent Economic Optimization: An Advanced Cooperative Dynamic Game Analysis, Birkhäuser, 2011.
5. R. J. Vanderbei, Linear Programming: Foundations and Extensions, International Series in Operations Research & Management Science, Springer, 3rd edition, 2008.
6. J. F. Bonnans, J. C. Gilbert, C. Lemaréchal, and C. A. Sagastizábal, Numerical Optimization: Theoretical and Practical Aspects, Springer, 2003.
7. R. Fletcher, Practical Methods of Optimization, John Wiley & Sons, 2000.
8. E. G. Talbi, Metaheuristics: From Design to Implementation, John Wiley & Sons, 2009.
9. T. Apostolopoulos and A. Vlachos, “Application of the firefly algorithm for solving the economic emissions load dispatch problem,” International Journal of Combinatorics, vol. 2011, Article ID 523806, 23 pages, 2011.
10. S. L. Tilahun and H. C. Ong, “Bus timetabling as a fuzzy multiobjective optimization problem using preference based genetic algorithm,” Promet Traffic & Transportation, vol. 24, no. 3, 2012.
11. J. Y. Wang and C. M. Lin, “Mass transit route network design using genetic algorithm,” Journal of the Chinese Institute of Engineers, vol. 33, no. 2, pp. 301–315, 2010.
12. M. Negnevitsky, Artificial Intelligence: A Guide To Intelligent System, Henry Ling Limited, Harlow, England, 2005.
13. X. S. Yang, “Firefly algorithms for multimodal optimization,” in Proceedings of the 5th International Conference on Stochastic Algorithms: Foundation and Applications (SAGA '09), vol. 5792 of Lecture notes in Computer Science, pp. 169–178, 2009.
14. X. S. Yang, Nature-Inspired Metaheuristic Algorithm, Luniver Press, Beckington, UK:, 2nd edition, 2010.
15. M. Molga and C. Smutnicki, Test functions for optimization needs, 2005, http://www.zsd.ict.pwr.wroc.pl/files/docs/functions.pdf.
16. E. J. S. Pires, J. A. T. MacHado, P. B. De Moura Oliveira, J. B. Cunha, and L. Mendes, “Particle swarm optimization with fractional-order velocity,” Nonlinear Dynamics, vol. 61, no. 1-2, pp. 295–301, 2010.
17. J. G. Digalalis and K. G. Margaritis, “On benchmarking functions for genetic algorithm,” International Journal of Computer Mathematics, vol. 1, pp. 1–27, 2000.
18. S. K. Mishra, Repulsive Particle Swarm Method on Some Diffcult Test Problems of Global Optimization, North-Eastern Hill University (NEHU), Meghalaya, India, 2006, http://ssrn.com/abstract=928538.
19. X. S. Yang and Firefly Algorithm, “Stochastic test functions and design optimisation,” International Journal of Bio-Inspired Computation, vol. 2, no. 2, p. 7884, 2010.
20. P. Ittipong, P. Luangpaiboon, and P. Pongcharoen, “Solving nonlinear continuous mathematical models using shuffled frog leaping and memetic algorithms,” in Operations Research Network in Thailand (OR-NET '08), vol. 25, pp. 79–85, 2008, http://as.nida.ac.th/ornet/ORNET2008/08papers/79-85.pdf.
21. M. Molga and C. Smutnicki, Test functions for optimization needs, 2005, http://www.bioinformaticslaboratory.nl/twikidata/pub/Education/NBICResearchSchool/Optimization/VanKampen/BackgroundInformation/TestFunctions-Optimization.pdf.