Computational Intelligence and Neuroscience

Volume 2017, Article ID 8034573, 10 pages

https://doi.org/10.1155/2017/8034573

## Firefly Mating Algorithm for Continuous Optimization Problems

^{1}Computational Intelligence Laboratory, King Mongkut’s Institute of Technology Ladkrabang, Bangkok 10520, Thailand^{2}Faculty of Information Technology, King Mongkut’s Institute of Technology Ladkrabang, Bangkok 10520, Thailand^{3}College of Innovative Technology and Engineering, Dhurakij Pundit University, Bangkok, Thailand

Correspondence should be addressed to Arit Thammano; ht.ca.ltimk.ti@tira

Received 15 January 2017; Revised 22 May 2017; Accepted 14 June 2017; Published 20 July 2017

Academic Editor: Leonardo Franco

Copyright © 2017 Amarita Ritthipakdee et al. 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

This paper proposes a swarm intelligence algorithm, called firefly mating algorithm (FMA), for solving continuous optimization problems. FMA uses genetic algorithm as the core of the algorithm. The main feature of the algorithm is a novel mating pair selection method which is inspired by the following 2 mating behaviors of fireflies in nature: (i) the mutual attraction between males and females causes them to mate and (ii) fireflies of both sexes are of the multiple-mating type, mating with multiple opposite sex partners. A female continues mating until her spermatheca becomes full, and, in the same vein, a male can provide sperms for several females until his sperm reservoir is depleted. This new feature enhances the global convergence capability of the algorithm. The performance of FMA was tested with 20 benchmark functions (sixteen 30-dimensional functions and four 2-dimensional ones) against FA, ALC-PSO, COA, MCPSO, LWGSODE, MPSODDS, DFOA, SHPSOS, LSA, MPDPGA, DE, and GABC algorithms. The experimental results showed that the success rates of our proposed algorithm with these functions were higher than those of other algorithms and the proposed algorithm also required fewer numbers of iterations to reach the global optima.

#### 1. Introduction

Optimization is a process of finding the most desirable solution to the problem of interest. Optimization problems can be divided into two main categories depending on the types of variables involved (discrete or continuous). A problem with discrete variables is known as a combinatorial optimization problem while a problem with continuous variables is known as a continuous optimization problem. The optimization algorithm proposed in this paper only emphasizes solving continuous optimization problems. Optimization algorithms are of many varieties ranging from simple search to much more complex ones that require a great deal of computational time. At present, among the widely researched types of optimization algorithms, self-organized algorithms employing procedures that emulate animal swarm behavior are very popular. Brief overviews of recent metaheuristic algorithms based on firefly, ant, fish, bird, and bee are presented in the next paragraph.

Yang [1] developed a swarm intelligent algorithm based on the flashing behavior of fireflies. In nature, the firefly flashes its light to attract other fireflies for mating. The less bright firefly is attracted and moves towards the one that flashes brighter light. The experimental results in Yang’s paper showed that the firefly algorithm outperformed both genetic algorithm and particle swarm optimization on the tested benchmarks. Similar results were also obtained by Baykasoğlu and Ozsoydan [2]. Even though the algorithm is very promising, further investigation is needed to improve on the convergence of the algorithm and to prevent trapping in local optima. Farahani et al. [3] proposed an improved firefly algorithm called Gaussian distribution firefly (GD-FF) algorithm. Three new strategies were introduced: (i) an adaptive step length that changes with time, (ii) a directed movement towards the global best solution when there is no brighter firefly within its vicinity, and (iii) a social behavior that changes the position of each firefly based on a Gaussian distribution. The authors found that their algorithm got better result and converged to the global optimum faster than the original firefly algorithm. Rizk-Allah et al. [4], on the other hand, improved the firefly algorithm in a different way; they combined it with an ant colony optimization (ACO) algorithm. First, this hybrid algorithm is initialized using the ACO algorithm. Then the firefly algorithm is put to work as a local search to refine the solutions found by the ants. The hybrid was proven successful. Shin and Kita [5] improved the performance of particle swarm optimization (PSO) by including the information of the second global best and second personal best particles in their developed algorithm. The algorithm’s performance was found to be better than the original PSO. Another variant of PSO was an algorithm called Levy flight particle swarm optimization (LFPSO) [6]. This algorithm combined PSO with Levy flight. Experimental results showed that the LFPSO clearly outperformed the original PSO and other PSO variants in terms of solution quality and robustness. A different kind of swarm intelligent algorithm based on the behavior of bees in finding food sources, called bee colony optimization (BCO), was also further developed by assigning two weights to each food source. One is a global weight and the other is a local weight. As a result, the proposed algorithm, named weighted bee colony optimization (wBCO) [7], performed better than the original BCO and many state-of-the-art algorithms. Artificial bee colony (ABC), another bee-inspired algorithm, was modified by Gao and Liu [8]. In their proposed algorithm, Levy flight, differential evolution, and particle swarm optimization were incorporated into the original ABC algorithm. Experimental results showed that the proposed algorithm achieved better performance than the original ABC algorithm and many of its variants. Niu et al. [9] proposed an improved version of the original fruit fly optimization algorithm (FOA), called DFOA. They modified the expression of the smell concentration judgement value and introduced DE/best/1 mutation strategy to replace the random search. The results showed that DFOA was superior to seven other evolutionary computation methods. Chen et al. [10] presented a new PSO variant called particle swarm optimization with an aging leader and challengers (ALC-PSO). In ALC-PSO, the leader of the swarm has a lifespan. If the leader is trapped in a local optimum, it will age quickly and new challengers will emerge to replace the old leader. As a result, ALC-PSO has an ability to escape from local optima and to find global optima in a short period of time. Genetic algorithm (GA) was also developed further by Thakur [11] who proposed a new crossover operator, called double Pareto crossover operator (DPX). DPX was used in combination with power mutation (PM) operator. He tested this algorithm with multimodal nonlinear functions and found that its success rate was higher than that of the standard GA.

In this paper, a swarm intelligence algorithm called firefly mating algorithm (FMA) is presented. In FMA, GA is used as the core of the algorithm. A new mating pair selection method, inspired by the mating behavior of fireflies in nature, is introduced and incorporated into GA.

The rest of the paper is organized as follows: Sections 2 and 3 briefly discuss the original firefly algorithm and genetic algorithm, respectively; in Section 4, the biological background of the proposed algorithm is explained; in Section 5, the proposed model with a detailed description of each step is presented; in Section 6, a description of the experiments is given; in Section 7, experimental results are shown and compared; finally, Section 8 is the conclusion.

#### 2. Firefly Algorithm

This section describes the original firefly algorithm. Firefly algorithm (FA) is a reliable and efficient metaheuristic algorithm capable of solving many real-world problems such as scheduling, optimization problems in dynamic environments, and economic load dispatch problem. This algorithm is influenced by the flashing behavior of fireflies to attract one another. It is constructed based on three rules [12]:

(i) All fireflies are unisex so that one firefly is attracted to all other fireflies.

(ii) The attractiveness of a firefly is proportional to its brightness. For any two fireflies, the dimmer one is attracted by (and thus moves towards) the brighter one. However, if there are no fireflies brighter than a given firefly, that firefly will move randomly.

(iii) The brightness of a firefly decreases as the distance from it increases. This is because light is absorbed when it passes through the medium. Therefore, the brightness (also attractiveness) of the firefly seen by the firefly is defined in (1).where is a light absorption coefficient of the medium, is the Euclidean distance between the firefly and the firefly , is the brightness of the firefly at , and and are the locations of the fireflies and , respectively.

If the firefly is the brighter one, the value of its attractiveness regulates the movement of the firefly according to the following equation:where is a randomization parameter and rand is a uniform random number in the range . The function of the second term in (3) is to move the firefly towards the firefly . The function of the third term in (3) is to move the solution away from a local optimum when such incident takes place.

#### 3. Genetic Algorithm

Genetic algorithm (GA) is an optimization technique inspired by the process of natural selection. GA starts with an initial population which consists of a number of randomly generated chromosomes. A new population is created from the current one by means of 3 genetic operators: selection, crossover, and mutation. The selection operator stochastically chooses chromosomes to be included in the mating pool; the ones with higher fitness values are more likely to be chosen. Crossover operator selectively chooses some genes from the chromosomes of the parents and combines them into the offspring. Mutation operator randomly changes some genes of the offspring. This evolution process is repeatedly performed until any of the stopping criteria is met. The commonly used stopping criteria are as follows: (i) a predefined number of iterations is reached, (ii) the best solution does not improve for a predefined number of iterations, and (iii) a large percentage of the chromosomes in the population is the same.

#### 4. Biological Inspiration of the Proposed Algorithm

There are over 2,000 species of fireflies around the world, but most of them are found in the tropical zone. They live under the water when they are larvae and on the ground and in the air when they are adults. Fireflies are social animals. They stay in a swarm on tree branches and lay eggs on the ground around the trees. The fascinating thing when observing fireflies is their light flash. The light emitted from their abdomens is a cold light through chemical reactions within their bodies. Fireflies emit flashing light for communication, luring preys, repelling predators, and attracting mates. Note that this research only focuses on the mating behavior of the firefly; therefore, the detailed relation of the flashing light signal to the mate selection process is further discussed in the next paragraph.

In the mating season, female fireflies release pheromones into the air to signal their readiness to mate. The pheromones are carried away in the direction controlled by the wind [13]. Male fireflies follow the pheromone trail and approach the females from a downwind direction [13]. More males are attracted to females who release more pheromones. Males then fly around the trees that the females perch on and flash courtship signal to attract females [14]. Females are more attracted to brighter males and response to those males by flashing their own lights. Then many rounds of mating take place during the night [15]. Males mate until they run out of sperm in their sperm reservoir while females can hold only a certain amount of sperms in their spermatheca. Sperms from fitter males are more likely to be chosen to fertilize a female’s eggs; this is due to the following two explanations: (i) females have ways to discard low-quality sperms, including destroying them by their internally produced chemicals [16, 17]; (ii) one male’s seminal fluid can incapacitate rival males’ sperm within the female reproductive tract [16, 18]. It is nature’s way of selective breeding.

#### 5. Our Proposed Algorithm

This section describes a firefly mating algorithm (FMA), which is built on top of the GA. FMA incorporates a new mating feature, inspired by the mating behavior of fireflies in nature, into GA. This new feature, which will be discussed in Section 5.2, significantly contributes to the capability of the proposed FMA.

FMA consists of three main processes: (i) a male selects a female according to the level of her released pheromone that he senses which changes according to wind speed and direction; (ii) a female selects a male according the light intensity of his flash; and (iii) a male or a female mates repeatedly until he runs out of sperms or her spermatheca is full, producing more able offspring for the next generation. This algorithm proceeds from the first step to the last in the 6 following steps.

##### 5.1. Initialization

An initial population of fireflies is randomly generated; half are assigned as males and the other half are females. Each firefly consists of genes (which is equal to the number of variables in the problem). Additionally, the sizes of each female’s spermatheca and each male’s sperm reservoir, which are real numbers between 0 and 1, are randomly generated. Lastly, the fitness value of each firefly is calculated.

##### 5.2. Selection of Mating Pairs

This step features a new method for determining the mating pairs. Unlike in the GA where mating pairs are selected by using a roulette wheel selection technique, our proposed algorithm introduces a new selection method based on a process of firefly mate selection. First, male fireflies are drawn to a female’s location by following the pheromone that the female releases. Second, the female selects males based on their brightness. Finally, mating pairs are formed based on the mutual attraction of each pair. By introducing this concept to the algorithm, it provides a way to overcome the problem of getting stuck in local optima, as is often the case with the roulette wheel selection technique. A detail of this new selection method is described in the following subsection.

###### 5.2.1. Determination of Female Sex Appeal

Female sex appeal is directly proportional to the amount of pheromone released by the female. The pheromone released by the female firefly diffuses downwind and reaches each male firefly in unequal amounts depending on 2 factors: (i) the distance and (ii) the speed and direction of the wind. In this subsection, therefore, the male fireflies determine the concentration level of each female’s pheromone reaching them. A highly fit female that is farther away from a male can get selected by the male if her highly concentrated pheromone gets carried along by a high-speed wind towards the male. The concentration level of the female ’s pheromone reaching the male , , is calculated by usingwhere is the fitness value of a female firefly , is the wind vector which is randomly generated in each iteration, and is the difference vector between the position vector of a male and that of the female.

###### 5.2.2. Determination of Male Sex Appeal

In this subsection, the female fireflies determine the appeal of each male in their vicinity. Similar to the original FA, the appeal of a male firefly is directly proportional to his brightness. Thus, by imitating (1), the appeal of the male firefly seen by the female firefly is calculated according to the following equation:where is the appeal of the male firefly seen by the female firefly , is a constant in the range , is the Euclidean distance between the male and the female (calculated according to (2)), and is the fitness value of the male firefly .

###### 5.2.3. Calculation of the Mutual Attraction

According to the degree of mutual attraction, a number of males and females are paired together as potential parents. A pair whose mutual attraction value is the highest among all pairs is selected as the first mating pair. The mutual attraction between the female firefly and the male firefly , , is defined asAfter each mating, the numbers of sperms in the male’s sperm reservoir and in the female’s spermatheca are updated. The update procedure is described in the next subsection. Next, the pair with the next highest value is selected if its male member still has some sperms left in the sperm reservoir and the female’s sperm bucket has not become full yet.

###### 5.2.4. Update Procedure for Male’s Sperm Reservoir and Female’s Spermatheca

At the beginning, the number of sperms in each male’s sperm reservoir and the size of each female’s spermatheca are randomly initialized within the range . When a pair of male and female mates, sperms are transferred from the male’s sperm reservoir to the female’s spermatheca, and the number of sperms in the male’s sperm reservoir is reduced. For each mating, the number of sperms a male gives to the female he chose depends on her fitness. The number of sperms that a male can transfer to the female he chose is calculated by the following equation:where is the number of sperms transferred to the female at the time of mating, is the number of sperms in the sperm reservoir, and is the fitness value of a female firefly . It stands to reason that a fitter female should get more sperms because, then, she would produce more offspring that are fitter than those produced by other females.

After mating, the number of sperms in each male’s sperm reservoir and the space of each female’s spermatheca are checked. Once a male runs out of sperm or a female’s spermatheca is full, he/she will be disqualified from mating in the next round. Equations (8) and (9) are used to update the number of sperms in a male’s sperm reservoir and a female’s spermatheca, respectively.Mating goes on until there is no qualified firefly left to form the mating pair.

##### 5.3. Crossover Operation

When a male and a female mates, some of their genes are crossed over to form two new offspring. One of the two following cases is applied with a specific crossover procedure as follows.

*Case 1. *If the parents have never been mated before, the 2-point crossover operator (Figure 1) is used to create the offspring. The 2-point crossover operator starts from randomly selecting a start position and an end position in the parent chromosomes to be crossed over, and then the genes between these two positions are crossed over and placed in the same position in the chromosomes of the two offspring, each having the original genes from each parent before the crossover.