Firefly algorithm  In mathematical optimization, the firefly algorithm is a metaheuristic proposed by Xin-She Yang and inspired by the flashing behavior of fireflies. In pseudocode the algorithm can be stated as:  Note that the number of objective function evaluations per loop is one evaluation per firefly, even though the above pseudocode suggests it is "n"×"n". (Based on Yang's MATLAB code.) Thus the total number of objective function evaluations is (number of generations) × (number of fireflies). The main update formula for any pair of two fireflies formula_1 and formula_2 is where formula_4 is a parameter controlling the step size, while formula_5 is a vector drawn from a Gaussian or other distribution. It can be shown that the limiting case formula_6 corresponds to the standard Particle Swarm Optimization (PSO). In fact, if the inner loop (for j) is removed and the brightness formula_7 is replaced by the current global best formula_8, then FA essentially becomes the standard PSO. Nature-inspired metaheuristics in general have attracted criticism in the research community for hiding their lack of novelty behind an elaborate metaphor. The firefly algorithm has been criticized as differing from the well-established particle swarm optimization only in a negligible way.