# An Adaptive Bacterial Foraging Optimization Algorithm with Lifecycle and Social Learning

Authors: Xiaohui Yan; Yunlong Zhu; Hao Zhang; Hanning Chen; Ben Niu
Journal: Discrete Dynamics in Nature and Society
 (2012)

---

## Abstract

Bacterial Foraging Algorithm (BFO) is a recently proposed swarm intelligence algorithm inspired by the foraging and chemotactic phenomenon of bacteria. However, its optimization ability is not so good compared with other classic algorithms as it has several shortages. This paper presents an improved BFO Algorithm. In the new algorithm, a lifecycle model of bacteria is founded. The bacteria could split, die, or migrate dynamically in the foraging processes, and population size varies as the algorithm runs. Social learning is also introduced so that the bacteria will tumble towards better directions in the chemotactic steps. Besides, adaptive step lengths are employed in chemotaxis. The new algorithm is named BFOLS and it is tested on a set of benchmark functions with dimensions of 2 and 20. Canonical BFO, PSO, and GA algorithms are employed for comparison. Experiment results and statistic analysis show that the BFOLS algorithm offers significant improvements than original BFO algorithm. Particulary with dimension of 20, it has the best performance among the four algorithms.


---

## Body

## 1. Introduction

Swarm intelligence is an innovative optimization technique inspired by the social behaviors of animal swarms in nature. Though the individuals have only simple behaviors and are without centralized control, complex collectiveintelligence could emerge on the level of swarm by their interaction and cooperation. Recent years, several swarm intelligence algorithms have been proposed, such as Ant Colony Optimization (ACO) [1], Particle Swarm Optimization (PSO) [2], Artificial Bee Colony (ABC) ‎[3], and Bacterial Foraging Optimization (BFO) BFO algorithm is first proposed by Passino ‎[4] in 2002. It is inspired by the foraging and chemotactic behaviors of bacteria, especially the Escherichia coli (E. coli). By smooth running and tumbling, The E. coli can move to the nutrient area and escape from poison area in the environment. The chemotactic is the most attractive behavior of bacteria. It has been studied by many researchers [5, 6]. By simulating the problem as the foraging environment, BFO algorithm and its variants are used for many numerical optimization [7, 8] or engineering optimization problems, such as distributed optimization [9], job shop scheduling [10], image processing‎ [11], and stock market prediction ‎[12].However, the original BFO has some shortages:(1) dispersal, reproduction, and elimination each happens; after a certain amount of chemotaxis operations. The appropriate time and method for dispersal and reproduction are important. Otherwise, the stability of the population may be destroyed. (2) The tumble angles in the chemotactic phase are generated randomly. As a result, the algorithm is more like a random searching algorithm except it will try further in better directions. The bacteria swarm lacks interaction between individuals. Good information carried by those individuals in higher nutritional areas cannot be shared with and utilized by other bacteria. (3) The swim step length in the original BFO algorithm is a constant. In most cases, the bacterium will run one more step if the position is better than its last position. If the swim step is large at the end stage (e.g., larger than the distance between its current position and the optimal point), it will skip the optimal point repeatedly. This will make the bacteria hard to converge to the optimal point.In this paper, several adaptive strategies are used to improve the original BFO algorithm. First, a lifecycle model of bacteria is proposed. Bacteria will split or die depending on the nutrition obtained in their foraging processes. Then, social leaning is introduced to enhance the information sharing between bacteria. The tumble angles are no longer generated randomly but directed by the swarm’s memory. Last, adaptive search strategy is employed, which makes the bacteria could use different search step lengths in different situations.The rest of the paper is organized as follows. In Section2, we will introduce the original BFO algorithm. Its features and pseudocode are given. In Section 3, the adaptive strategies of BFOLS algorithm is described in detail. In Section 4, the BFOLS algorithm is tested on a set of benchmark functions compared with several other algorithms. Results are presented and discussed. The test of its new parameters setting and the simulation of its varying population size are also done in this section. Finally, conclusions are drawn in Section 5.


## 2. Original Bacterial Foraging Optimization

TheE. colibacteria is one of the earliest bacteria which has been researched. It has a plasma membrane, cell wall, and capsule that contains the cytoplasm and nucleoid. Besides, it has several flagella which are randomly distributed around its cell wall. The flagella rotate in the same direction at about 100–200 revolutions per second ‎[13]. If the flagella rotate clockwise, they will pull on the cell to make a “tumble.” And if they rotate counterclockwise, their effects accumulate by forming a bundle which makes the bacterium “run” in one direction ‎[4], as shown in Figure 1.Figure 1
Chemotactic behavior ofE. coli: run and tumble.The bacteria can sense the nutrient concentration in the environment. By tumbling and running, the bacteria will search for nutrient area and keep away from the poisonous area. Simulating the foraging process of bacteria, Passino proposed the Bacterial Foraging Optimization (BFO) algorithm. The main mechanisms of BFO are illustrated as follows.


### 2.1. Chemotaxis

Chemotaxis is the main motivation of the bacteria’s foraging process‎[14]. It consists of a tumble with several runs. In BFO, the position updating which simulates the chemotaxis procedure is used in (2.1) as follows. θit  presents the position of the ith bacterium in the tth chemotaxis step. C(i) is the step length during the ith chemotaxis. ϕ(i) is a unit vector which stands for the swimming direction after a tumble. It can be generated by (2.2), where Δi is a randomly produced vector with the same dimension of the problem:
(2.1)θit+1=θit+C(i)ϕ(i),(2.2)ϕ(i)=ΔiΔiTΔi.In each chemotactic step, the bacterium generated a tumble direction firstly. Then the bacterium moves in the direction using (2.1). If the nutrient concentration in the new position is higher than the last position, it will run one more step in the same direction. This procedure continues until the nutrient get worse or the maximum run step is reached. The maximum run step is controlled by a parameter called  Ns.


### 2.2. Reproduction

For everyNc times of chemotactic steps, a reproduction step is taken in the bacteria population. The bacteria are sorted in descending order by their nutrient obtained in the previous chemotactic processes. Bacteria in the first half of the population are regarded as having obtained sufficient nutrients so that they will reproduce. Each of them splits into two (duplicate one copy in the same location). Bacteria in the residual half of the population die and they are removed out from the population. The population size remains the same after this procedure. Reproduction is the simulation of the natural reproduction phenomenon. By this operator, individuals with higher nutrient are survived and duplicated, which guarantees that the potential optimal areas are searched more carefully.


### 2.3. Eliminate and Dispersal

In nature, the changes of environment where population lives may affect the behaviors of the population. For example, the sudden change of temperature or nutrient concentration, the flow of water, all these may cause bacteria in the population to die or move to another place‎[15]. To simulate this phenomenon, eliminate-dispersal is added in the BFO algorithm. After every Nre times of reproduction steps, an eliminate-dispersal event happens. For each bacterium, a random number is generated between 0 and 1. If the random number is less than a predetermined parameter, known as  Pe, the bacterium will be eliminated and a new bacterium is generated in the environment. The operator can be also regarded as moving the bacterium to a randomly produced position. The eliminate-dispersal events may destroy the chemotactic progress. But they may also promote the solutions since dispersal might place the bacteria in better positions. Overall, contrary to the reproduction, this operator enhances the diversity of the algorithm.In BFO algorithm, the eliminate-dispersal events happen forNed times. That is to say, there are three loops for the bacteria population in BFO algorithm. The outer loop is eliminate-dispersal event, the middle loop is reproduction event and the inner loop is chemotactic event. The algorithm ends after all the three loops are finished. The pseudocode of original BFO algorithm is given in Pseudocode 1.


## 2.1. Chemotaxis

Chemotaxis is the main motivation of the bacteria’s foraging process‎[14]. It consists of a tumble with several runs. In BFO, the position updating which simulates the chemotaxis procedure is used in (2.1) as follows. θit  presents the position of the ith bacterium in the tth chemotaxis step. C(i) is the step length during the ith chemotaxis. ϕ(i) is a unit vector which stands for the swimming direction after a tumble. It can be generated by (2.2), where Δi is a randomly produced vector with the same dimension of the problem:
(2.1)θit+1=θit+C(i)ϕ(i),(2.2)ϕ(i)=ΔiΔiTΔi.In each chemotactic step, the bacterium generated a tumble direction firstly. Then the bacterium moves in the direction using (2.1). If the nutrient concentration in the new position is higher than the last position, it will run one more step in the same direction. This procedure continues until the nutrient get worse or the maximum run step is reached. The maximum run step is controlled by a parameter called  Ns.


## 2.2. Reproduction

For everyNc times of chemotactic steps, a reproduction step is taken in the bacteria population. The bacteria are sorted in descending order by their nutrient obtained in the previous chemotactic processes. Bacteria in the first half of the population are regarded as having obtained sufficient nutrients so that they will reproduce. Each of them splits into two (duplicate one copy in the same location). Bacteria in the residual half of the population die and they are removed out from the population. The population size remains the same after this procedure. Reproduction is the simulation of the natural reproduction phenomenon. By this operator, individuals with higher nutrient are survived and duplicated, which guarantees that the potential optimal areas are searched more carefully.


## 2.3. Eliminate and Dispersal

In nature, the changes of environment where population lives may affect the behaviors of the population. For example, the sudden change of temperature or nutrient concentration, the flow of water, all these may cause bacteria in the population to die or move to another place‎[15]. To simulate this phenomenon, eliminate-dispersal is added in the BFO algorithm. After every Nre times of reproduction steps, an eliminate-dispersal event happens. For each bacterium, a random number is generated between 0 and 1. If the random number is less than a predetermined parameter, known as  Pe, the bacterium will be eliminated and a new bacterium is generated in the environment. The operator can be also regarded as moving the bacterium to a randomly produced position. The eliminate-dispersal events may destroy the chemotactic progress. But they may also promote the solutions since dispersal might place the bacteria in better positions. Overall, contrary to the reproduction, this operator enhances the diversity of the algorithm.In BFO algorithm, the eliminate-dispersal events happen forNed times. That is to say, there are three loops for the bacteria population in BFO algorithm. The outer loop is eliminate-dispersal event, the middle loop is reproduction event and the inner loop is chemotactic event. The algorithm ends after all the three loops are finished. The pseudocode of original BFO algorithm is given in Pseudocode 1.


## 3. Bacterial Foraging Optimization with Lifecycle and Social Learning

To improve the optimization ability of BFO algorithms, many variations are proposed. In the proposed BFOLS algorithm, three strategies are used to improve the original BFO.


### 3.1. Lifecycle Model of Bacterium

As mentioned above, in original BFO algorithm, there are three loops for the population. Bacteria will reproduce afterNc times of chemotactic steps and dispersal after  Nre  times of reproduction. As a result, the parameter settings of Nc and Nre are important to the performance of the algorithm. Unsuitable parameter values may destroy the chemotactic searching progress ‎[16]. To avoid this, we remove the three loops In BFOLS algorithm. Instead, for each bacterium, we will decide it to reproduce, die, or migrate by certain conditions in the bacteria’s cycle.The idea of lifecycle has been used in some swarm intelligence algorithms‎[17, 18]. Based on Niu’s model in ‎[18], a new lifecycle model of bacteria is founded in this paper. In the model, a bacterium could be represented by a six-tuple as follows:
(3.1)B={P,F,N,T,D,C},
where P,F,N,T,D,C represent the position, fitness, nutrient, state, tumble direction, and step length, respectively. It should be noted that fitness is the evaluation to the current position of a bacterium, and nutrient is total nutrient gained by the bacterium in its whole searching process.We define the nutrient updating formula as (3.2).  Flast  represents the fitness of the bacterium’s last position (for a minimum problem, fitness is larger when the function value is smaller). In initialization stage, nutrients of all bacteria are zero. In the bacterium’s chemotactic processes, if the new position is better than the last one, it is regarded that the bacterium will gain nutrient from the environment and the nutrient is added by one. Otherwise, it loses nutrient in the searching process and its nutrient is reduced by one.
(3.2)N(i)={N(i)+1if(F(i)>Flast)N(i)-1if(F(i)<Flast).There are five states defined in the lifecycle model: born, forage, split, die, and migrate. That is,T={Born∣Forage∣Split∣Die∣Migrate}. The bacteria are born when they are initialized. Then they will forage for nutrient. In the foraging process, if a bacterium obtains sufficient nutrient, it will split into two in the same position; if the bacterium enters bad area and loses nutrient to a certain threshold, it will die and be eliminated from the population; if the bacterium is with a bad nutrient value but has not died yet, it may migrate to a random position according to certain probability. After split or migrate, the bacterium is regarded as new born and its nutrient will be reset to 0. The state transition diagram is shown in Figure 2.Figure 2
State transition in lifecycle model of bacteria in BFOLS.The split criterion and dead criterion are listed in Formula (3.3) and (3.4). Nsplit and Nadapt are two new parameters used to control and adjust the split criterion and dead criterion. S  is the initial population size and Si is the current population size. It should be noticed that the population size will increase by one if a bacterium splits and reduce by one if a bacterium dies. As a result, the population size may vary in the searching process. At the beginning of the algorithm, as S equals to Si, the bacterium will split when its nutrient is larger than Nsplit and die when its nutrient is smaller than 0. We do not need to worry that the population will decrease suddenly at the first beginning because when it is first time for the bacteria to decide whether to die or not, they have passed through the chemotactic process so most of the bacteria’s nutrient values are larger than zero. With the algorithm runs, the population size may change and differ from the initial population size. On certain conditions, the population size will reduce to zero, which makes the algorithm unable to continue. Oppositely, if the population size becomes too large, it will cost too much computation and be hard to evolve. To avoid the population size becoming too large or too small, a self-adaptive strategy is introduced: if  Si  is larger than S, for each Nadapt of their differences, the split threshold value will increase by one. And if S is larger than Si, for each Nadapt of their differences, the death threshold value will decrease by one. The strategy is also in accord with nature. Behaviors of organisms will be affected by the environment their lived. If the population is too crowded, the competition between the individuals will increase and death becomes common. If the population is small, the individuals are easier to survive and reproduce. By this strategy, the split threshold is enhanced when population size is large and the dead condition is stricter when population is small, which controls the population size in a relatively stable range:
(3.3)Nutrient(i)>max(Nsplit,Nsplit+(Si-S)Nadapt),(3.4)Nutrient(i)<min(0,0+(Si-S)Nadapt).When the nutrient of a bacterium is less than zero, but it has not died yet, it could migrate with a probability. A random number is generated and if the number is less than migration probabilityPe, it will migrate and move to a randomly produced position. Nutrient of the bacterium will be reset to zero.It should be mentioned that the splitting, death, and migration operators are judged in sequence, if one of them is done, the algorithm will breakout from the current cycle and will not execute the rest of judgments.


### 3.2. Social Learning

Social learning is the core motivation in the formation of the collective knowledge of swarm intelligence‎[19]. For example, in PSO algorithm, particles learn from the best particles and themselves ‎[20]. In ABC algorithm, bees learn from their neighbors ‎[21]. However, the social learning is seldom used in original BFO algorithm. In chemotactic steps of original BFO, the tumble directions are generated randomly. Information carried by the bacteria in nutrient rich positions is not utilized. In our BFOLS, we assume that all bacteria can memory the best position they have reached and share the information to other bacteria. And in chemotactic steps, a bacterium will decide which direction to tumble using the information of its personal best position and the population’s global best position. Based on the assumption, the tumble directions in our BFOLS are generated using (3.5). Where θgbest is the global best of the population found so far and θi,pbest is the ith bacterium’s personal historical best. The tumble direction is then normalized as unit vector by (2.2) and the position updating is still using the (2.1):
(3.5)Δi=(θgbest-θi)+(θi,pbest-θi).The direction generating equation is similar to the velocity updating equation of PSO algorithm‎[22]. They all used the global best and personal best. However, they are not the same. First, there is no inertia term in (3.5). Usually, the bacteria will run more than one time in chemotactic steps. An inertia term will enlarge the difference of between θgbest,θi,pbest and the current position tremendously. Second, there are no learning factors in (3.5). Because the direction that will be normalized to unit vector and the learning factors is meaningless.By social learning, the bacteria will move to better areas with higher probability as good information is fully utilized.


### 3.3. Adaptive Search Strategy

As mentioned above, the constant step length will make the population hard to converge to the optimal point. In an intelligence optimization algorithm, it is important to balance its exploration ability and exploitation ability. The exploration ability ensures that the algorithm can search the whole space and escape from local optima. The exploitation ability guarantees that the algorithm can search local areas carefully and converge to the optimal point. Generally, in the early stage of an algorithm, we should enhance the exploration ability to search all the areas. In the later stage of the algorithm, we should enhance the exploitation ability to search the good areas intensively.There are various step length varying strategies‎[23, 24]. In BFOLS, we use the decreasing step length. The step length will decrease with the fitness evaluations, as shown in (3.6).  Cs is the step length at the beginning. Ce is the step length at the end. nowEva is the current fitness evaluations count. TotEva is the total fitness evaluations. In the early stage of BFOLS algorithm, larger step length provides the exploration ability. And at the later stage, small step length is used to make the algorithm turn to exploitation:
(3.6)C=Cs-(Cs-Ce)×nowEvaTotEva.To strengthen the idea further, an elaborate adaptive search strategy is introduced based on the decreasing step length mentioned above. In the new strategy, the bacteria’s step lengths may vary from each other. And their values are related with their nutrient, which are calculated using (3.7):
(3.7)C(i)={CNutrient(i)if(Nurtrient(i)>0)Cif(Nurtrient(i)≤0).With a higher nutrient value, the bacterium’s step length is shortened further. This is also in accordance with the food searching behaviors in natural. The higher nutrient value indicates that the bacterium is located in potential nutrient rich area with a larger probability. As a result, it is necessary to exploit the area carefully with smaller step length.The pseudocode of BFOLS algorithm is listed in  Pseudocode 2.


## 3.1. Lifecycle Model of Bacterium

As mentioned above, in original BFO algorithm, there are three loops for the population. Bacteria will reproduce afterNc times of chemotactic steps and dispersal after  Nre  times of reproduction. As a result, the parameter settings of Nc and Nre are important to the performance of the algorithm. Unsuitable parameter values may destroy the chemotactic searching progress ‎[16]. To avoid this, we remove the three loops In BFOLS algorithm. Instead, for each bacterium, we will decide it to reproduce, die, or migrate by certain conditions in the bacteria’s cycle.The idea of lifecycle has been used in some swarm intelligence algorithms‎[17, 18]. Based on Niu’s model in ‎[18], a new lifecycle model of bacteria is founded in this paper. In the model, a bacterium could be represented by a six-tuple as follows:
(3.1)B={P,F,N,T,D,C},
where P,F,N,T,D,C represent the position, fitness, nutrient, state, tumble direction, and step length, respectively. It should be noted that fitness is the evaluation to the current position of a bacterium, and nutrient is total nutrient gained by the bacterium in its whole searching process.We define the nutrient updating formula as (3.2).  Flast  represents the fitness of the bacterium’s last position (for a minimum problem, fitness is larger when the function value is smaller). In initialization stage, nutrients of all bacteria are zero. In the bacterium’s chemotactic processes, if the new position is better than the last one, it is regarded that the bacterium will gain nutrient from the environment and the nutrient is added by one. Otherwise, it loses nutrient in the searching process and its nutrient is reduced by one.
(3.2)N(i)={N(i)+1if(F(i)>Flast)N(i)-1if(F(i)<Flast).There are five states defined in the lifecycle model: born, forage, split, die, and migrate. That is,T={Born∣Forage∣Split∣Die∣Migrate}. The bacteria are born when they are initialized. Then they will forage for nutrient. In the foraging process, if a bacterium obtains sufficient nutrient, it will split into two in the same position; if the bacterium enters bad area and loses nutrient to a certain threshold, it will die and be eliminated from the population; if the bacterium is with a bad nutrient value but has not died yet, it may migrate to a random position according to certain probability. After split or migrate, the bacterium is regarded as new born and its nutrient will be reset to 0. The state transition diagram is shown in Figure 2.Figure 2
State transition in lifecycle model of bacteria in BFOLS.The split criterion and dead criterion are listed in Formula (3.3) and (3.4). Nsplit and Nadapt are two new parameters used to control and adjust the split criterion and dead criterion. S  is the initial population size and Si is the current population size. It should be noticed that the population size will increase by one if a bacterium splits and reduce by one if a bacterium dies. As a result, the population size may vary in the searching process. At the beginning of the algorithm, as S equals to Si, the bacterium will split when its nutrient is larger than Nsplit and die when its nutrient is smaller than 0. We do not need to worry that the population will decrease suddenly at the first beginning because when it is first time for the bacteria to decide whether to die or not, they have passed through the chemotactic process so most of the bacteria’s nutrient values are larger than zero. With the algorithm runs, the population size may change and differ from the initial population size. On certain conditions, the population size will reduce to zero, which makes the algorithm unable to continue. Oppositely, if the population size becomes too large, it will cost too much computation and be hard to evolve. To avoid the population size becoming too large or too small, a self-adaptive strategy is introduced: if  Si  is larger than S, for each Nadapt of their differences, the split threshold value will increase by one. And if S is larger than Si, for each Nadapt of their differences, the death threshold value will decrease by one. The strategy is also in accord with nature. Behaviors of organisms will be affected by the environment their lived. If the population is too crowded, the competition between the individuals will increase and death becomes common. If the population is small, the individuals are easier to survive and reproduce. By this strategy, the split threshold is enhanced when population size is large and the dead condition is stricter when population is small, which controls the population size in a relatively stable range:
(3.3)Nutrient(i)>max(Nsplit,Nsplit+(Si-S)Nadapt),(3.4)Nutrient(i)<min(0,0+(Si-S)Nadapt).When the nutrient of a bacterium is less than zero, but it has not died yet, it could migrate with a probability. A random number is generated and if the number is less than migration probabilityPe, it will migrate and move to a randomly produced position. Nutrient of the bacterium will be reset to zero.It should be mentioned that the splitting, death, and migration operators are judged in sequence, if one of them is done, the algorithm will breakout from the current cycle and will not execute the rest of judgments.


## 3.2. Social Learning

Social learning is the core motivation in the formation of the collective knowledge of swarm intelligence‎[19]. For example, in PSO algorithm, particles learn from the best particles and themselves ‎[20]. In ABC algorithm, bees learn from their neighbors ‎[21]. However, the social learning is seldom used in original BFO algorithm. In chemotactic steps of original BFO, the tumble directions are generated randomly. Information carried by the bacteria in nutrient rich positions is not utilized. In our BFOLS, we assume that all bacteria can memory the best position they have reached and share the information to other bacteria. And in chemotactic steps, a bacterium will decide which direction to tumble using the information of its personal best position and the population’s global best position. Based on the assumption, the tumble directions in our BFOLS are generated using (3.5). Where θgbest is the global best of the population found so far and θi,pbest is the ith bacterium’s personal historical best. The tumble direction is then normalized as unit vector by (2.2) and the position updating is still using the (2.1):
(3.5)Δi=(θgbest-θi)+(θi,pbest-θi).The direction generating equation is similar to the velocity updating equation of PSO algorithm‎[22]. They all used the global best and personal best. However, they are not the same. First, there is no inertia term in (3.5). Usually, the bacteria will run more than one time in chemotactic steps. An inertia term will enlarge the difference of between θgbest,θi,pbest and the current position tremendously. Second, there are no learning factors in (3.5). Because the direction that will be normalized to unit vector and the learning factors is meaningless.By social learning, the bacteria will move to better areas with higher probability as good information is fully utilized.


## 3.3. Adaptive Search Strategy

As mentioned above, the constant step length will make the population hard to converge to the optimal point. In an intelligence optimization algorithm, it is important to balance its exploration ability and exploitation ability. The exploration ability ensures that the algorithm can search the whole space and escape from local optima. The exploitation ability guarantees that the algorithm can search local areas carefully and converge to the optimal point. Generally, in the early stage of an algorithm, we should enhance the exploration ability to search all the areas. In the later stage of the algorithm, we should enhance the exploitation ability to search the good areas intensively.There are various step length varying strategies‎[23, 24]. In BFOLS, we use the decreasing step length. The step length will decrease with the fitness evaluations, as shown in (3.6).  Cs is the step length at the beginning. Ce is the step length at the end. nowEva is the current fitness evaluations count. TotEva is the total fitness evaluations. In the early stage of BFOLS algorithm, larger step length provides the exploration ability. And at the later stage, small step length is used to make the algorithm turn to exploitation:
(3.6)C=Cs-(Cs-Ce)×nowEvaTotEva.To strengthen the idea further, an elaborate adaptive search strategy is introduced based on the decreasing step length mentioned above. In the new strategy, the bacteria’s step lengths may vary from each other. And their values are related with their nutrient, which are calculated using (3.7):
(3.7)C(i)={CNutrient(i)if(Nurtrient(i)>0)Cif(Nurtrient(i)≤0).With a higher nutrient value, the bacterium’s step length is shortened further. This is also in accordance with the food searching behaviors in natural. The higher nutrient value indicates that the bacterium is located in potential nutrient rich area with a larger probability. As a result, it is necessary to exploit the area carefully with smaller step length.The pseudocode of BFOLS algorithm is listed in  Pseudocode 2.


## 4. Experiments

In this section, first we will test the optimization ability of BFOLS algorithm on a set of benchmark functions. Several other intelligent algorithms will be employed for comparison, including original BFO, PSO, and Genetic Algorithm (GA)‎[25]. Statistical techniques are also used ‎[26, 27]. Iman-Davenport test and Holm method are employed to analyze the differences among these algorithms. As two extra control parameters Nsplit  and  Nadapt  are introduced, the settings of the two parameters are then tested to determine their best values. At last, the varying tendency of population size in BFOLS is tested and analyzed.


### 4.1. Performance Test of BFOLS

#### 4.1.1. Benchmark Functions

The BFOLS algorithm was tested on a set of benchmark functions with dimensions of 2 and 20, respectively. The functions are listed in Table1. Among them, f1 – f6 are basic functions widely adopted by other researchers ‎[28, 29], their global minima are all zero. f7 – f14 are shifted and rotated functions selected from CEC2005 test-bed, global minima of these functions are different from each other. For each function, its standard variable range is used. Function f10 is a special case. It has no bounds. The initialization range of this function is [0,600], and the global optima is outside of its initialization range.Table 1
Benchmark functions used in the experiment.
Function
Formulation
Variable ranges
f
(
x
*
)
f
1
Sphere
f
(
x
)
=
∑
i
=
1
D
x
i
2
[
-
5.12,5.12
]
0
f
2
Rosenbrock
f
(
x
)
=
∑
i
=
1
D
-
1
(
100
(
x
i
2
-
x
i
+
1
)
2
+
(
1
-
x
i
)
2
)
[
-
15,15
]
0
f
3
Rastrigin
f
(
x
)
=
∑
i
=
1
D
(
x
i
2
-
10
cos
(
2
π
x
i
)
+
10
)
[
-
10,10
]
0
f
4
Ackley
f
(
x
)
=
20
+
e
-
20
e
(
-
0.2
(
1
/
D
)
∑
i
=
1
D
x
i
2
)
-
e
(
(
1
/
D
)
∑
i
=
1
D
cos
(
2
π
x
i
)
)
[
-
32.768
,
32.768
]
0
f
5
Griewank
f
(
x
)
=
1
4000
(
∑
i
=
1
D
x
i
2
)
-
(
∏
i
=
1
D
cos
(
x
i
i
)
)
+
1
[
-
600
,
600
]
0
f
6
Schwefel2.22
f
(
x
)
=
∑
i
=
1
D
|
x
i
|
+
∏
i
=
1
D
|
x
i
|
[
-
10,10
]
0
f
7
Shifted sphere
f
(
x
)
=
∑
i
=
1
D
z
i
2
+
f
bias
1
,
z
=
x
-
o
[
-
100,100
]
−450
f
8
Shifted Schwefel1.2
f
(
x
)
=
∑
i
=
1
D
(
∑
j
=
1
i
z
j
)
2
+
f
bias
2
,
z
=
x
-
o
[
-
100,100
]
−450
f
9
Shifted Rosenbrock
f
(
x
)
=
∑
i
=
1
D
-
1
(
100
(
z
i
2
-
z
i
+
1
)
2
+
(
z
i
-
1
)
2
)
+
f
_
bias
6,
[
-
100,100
]
390
z=x-o
f
10
Shifted rotated Griewank
f
(
x
)
=
∑
i
=
1
D
z
i
2
4000
-
∏
i
=
1
D
cos
(
z
i
i
)
+
1
+
f
_
bias
7
,
No bounds
−180
z=(x-o)*M
f
(
x
)
=
-
20
exp
(
-
0.2
1
D
∑
i
=
1
D
z
i
2
)
f
11
Shifted rotated Ackley
-exp(1D∑i=1Dcos(2πzi))+20+e+f_bias8,
[
-
32
,
32
]
−140
z=(x-o)*M
f
12
Shifted Rastrigin
f
(
x
)
=
∑
i
=
1
D
(
z
i
2
-
10
cos
(
2
π
z
i
)
+
10
)
+
f
_
bias
9
,
[
-
5
,
5
]
−330
z=(x-o)
f
13
Shifted rotated Rastrigin
f
(
x
)
=
∑
i
=
1
D
(
z
i
2
-
10
cos
(
2
π
z
i
)
+
10
)
+
f
_
bias
10
,
[
-
5
,
5
]
−330
z=(x-o)*M
f
(
x
)
=
∑
i
=
1
D
(
∑
k
=
0
k
max
[
a
k
cos
(
2
π
b
k
(
z
i
+
0.5
)
)
]
)
f
14
Shifted rotated Weierstrass
-D∑k=0kmax[akcos(2πbk·0.5)]+f_bias11,
[
-
0.5
,
0.5
]
90
z=(x-o)*MIt should be mentioned that the bacteria may run different times in a chemotactic step. As a result, different computational complexity may be taken in each iteration for different algorithms and iterations count is no longer a reasonable measure. In order to compare the different algorithms, a fair measure method must be selected. In this paper, we use number of function evaluations (FEs) as a measure criterion, which is also used in many other works‎[30–32]. All algorithms were terminated after 20,000 function evaluations on dimension of 2 and 60,000 function evaluations on dimension of 20.


#### 4.1.2. Parameter Settings for the Involved Algorithms

The population sizesS of all algorithms were 50. In original BFO algorithm, the parameters are set as follows: Nc=50,Ns=4,Nre=4,Ned=10, Pe=0.25,C=0.1,andSr=S/2=25. The parameter settings are similar to that in Passino’s work except Nc  is smaller and Ned is larger ‎[4]. This is because the termination criterion has changed to be the function evaluations. Smaller Nc  is selected to guarantee that the algorithm can run through the chemotactic, reproduction, eliminate, and dispersal processes. Larger Ned is selected to guarantee that the BFO algorithm will not terminate before the maximum function evaluations. In our BFOLS algorithm, as it has mentioned previously, Nc, Nre,Ned, and  Sr are no longer needed. Ns=4,Pe=0.25, which are the same with those are in BFO. The started step Cs=0.1(Ub-Lb); ended step Ce=0.00001(Ub-Lb), where Lb and Ub refer to the lower bound and upper bound of the variables of the problems. This will make the algorithm suitable for problems of different scales. The step of the whole population decreases from Cs to Ce  linearly, and step of each bacterium is calculated by (3.7) mentioned above. The values of the two control parameters Nsplit  and Nadapt are set to be 30 and 5. Standard PSO and GA algorithm was used in this experiment. In PSO algorithm, inertia weight ω decreased from 0.9 to 0.7. The learning factors C1=C2=2.0 [33].  Vmin=0.1×Lb,Vmax=0.1×Ub. In GA algorithm, single-point crossover is used; crossover probability is 0.95 and mutation probability is 0.1 ‎[25].


#### 4.1.3. Experiment Results and Statistical Analysis

The error values(f(x)-f(x*)) of BFOLS, BFO, PSO, and GA algorithms on the benchmark functions with dimension of 2 and 20 are listed in Tables 2 and 3, respectively. Mean and standard deviation values obtained by these algorithms for 30 times of independent runs are given. Best values of them on each function are marked as bold. As there are 14 functions on each dimension, it will take too much space to give all the convergence plots. Here, only f1-f6’s convergence plots are given, as seen in Figure 3.Table 2
Error values obtained by BFOLS, BFO, PSO, and GA algorithms with dimension of 2.
Function
BFOLS
BFO
PSO
GA
f
1
Mean
1.66266
e
-
010
1.14309
e
-
005
1.48427
e
-
018
2
.
46555
e
-
003
Std
2.35439
e
-
010
1.44400
e
-
005
3.38437
e
-
018
4
.
0565
0
e
-
003
f
2
Mean
4.7678
e
-
008
4.94397
e
-
003
4.26062
e
-
015
1.76305
e
+
000
Std
5.69309
e
-
008
5.08761
e
-
003
9.56508
e
-
015
2.11319
e
+
000
f
3
Mean
1.40217
e
-
007
6
.
55588
e
-
001
3.07902
e
-
015
1
.
59279
e
-
001
Std
1.46112
e
-
007
3
.
622
00
e
-
001
8.83798
e
-
015
1
.
88468
e
-
001
f
4
Mean
1.90708
e
-
004
1.18787
e
-
001
1.06646
e
-
008
3
.
62955
e
-
001
Std
1.11928
e
-
004
6.54950
e
-
002
1.36111
e
-
008
2
.
58463
e
-
001
f
5
Mean
1.17638
e
-
006
2.67927
e
-
002
2.92970
e
-
004
9
.
3831
0
e
-
002
Std
2.53546
e
-
006
1.28042
e
-
002
1.36535
e
-
003
6
.
92769
e
-
002
f
6
Mean
1.60310
e
-
005
8.0626
e
-
003
2.47171
e
-
009
3
.
37681
e
-
002
Std
1.36623
e
-
005
4.42736
e
-
003
4.17088
e
-
009
2
.
83197
e
-
002
f
7
Mean
4.52226
e
-
008
3.81605
e
-
003
0
1.06661
e
+
001
Std
3.93677
e
-
008
3.62032
e
-
003
0
1.02199
e
+
001
f
8
Mean
5.57271
e
-
008
4.75829
e
-
003
5.68434
e
-
015
1.91645
e
+
000
Std
8.51665
e
-
008
4.00577
e
-
003
1.73446
e
-
014
4.00548
e
+
000
f
9
Mean
2.15994
e
-
006
2.00971
e
-
001
6.66463
e
-
006
4.24819
e
+
001
Std
2.21157
e
-
006
1.58643
e
-
001
2.94369
e
-
005
4.77406
e
+
001
f
10
Mean
1
.
64445
e
-
004
4
.
59019
e
-
002
1
.
66967
e
-
003
2
.
87956
e
-
001
Std
8
.
78281
e
-
004
2
.
35742
e
-
002
3
.
37535
e
-
003
1
.
40164
e
-
001
f
11
Mean
1
.
19137
e
+
001
9.69262
e
+
000
1
.
66669
e
+
001
1
.
21447
e
+
001
Std
9.89835
e
+
000
5.40612
e
+
000
7.5811
e
+
000
4.10647
e
+
000
f
12
Mean
4.631
00
e
-
008
2
.
50975
e
-
001
1
.
98992
e
-
001
7
.
41804
e
-
001
Std
5.64908
e
-
008
3
.
35611
e
-
001
4
.
04787
e
-
001
6
.
75828
e
-
001
f
13
Mean
3.49518
e
-
008
1
.
85255
e
-
001
3
.
31653
e
-
002
9
.
61984
e
-
001
Std
2.31262
e
-
008
1
.
65632
e
-
001
1
.
81654
e
-
001
6
.
48141
e
-
001
f
14
Mean
1
.
81406
e
-
003
1
.
01915
e
-
001
9.25237
e
-
006
3
.
39486
e
-
001
Std
6
.
56816
e
-
004
3
.
849
00
e
-
002
6.56108
e
-
006
1
.
11498
e
-
001Table 3
Error values obtained by the BFOLS, BFO, PSO, and GA algorithms with dimension of 20.
Function
BFOLS
BFO
PSO
GA
f
1
Mean
6.89944
e
-
008
6
.
17635
e
-
001
3.76236
e
-
006
6
.
61625
e
-
001
Std
4.37473
e
-
008
1
.
943
00
e
-
001
4.85485
e
-
006
2
.
34433
e
-
001
f
2
Mean
2.36439
e
+
001
2.02447
e
+
003
2.49117
e
+
001
6
.
56345
e
+
002
Std
2.39321
e
+
001
8.62087
e
+
002
2.12081
e
+
001
4
.
55687
e
+
002
f
3
Mean
1.09317
e
+
001
4.94922
e
+
002
3.35838
e
+
001
6
.
80152
e
+
001
Std
5.90291
e
+
000
6.74151
e
+
001
1.07949
e
+
001
1
.
77908
e
+
001
f
4
Mean
1
.
29613
e
-
003
1
.
95483
e
+
001
1.10071
e
+
000
1
.
86919
e
+
001
Std
2
.
60321
e
-
003
3
.
71818
e
-
001
9
.
1465
0
e
-
001
1.30767
e
-
000
f
5
Mean
2
.
92754
e
-
002
3.00705
e
+
000
3
.
89587
e
-
002
3.11937
e
+
000
Std
2
.
12876
e
-
002
4
.
5062
e
-
001
3
.
13277
e
-
002
8
.
5576
0
e
-
001
f
6
Mean
8
.
20052
e
-
004
5.43634
e
+
001
1
.
39941
e
-
001
4.92696
e
+
000
Std
2
.
08416
e
-
004
1.20626
e
+
001
1
.
87068
e
-
001
1.09457
e
+
000
f
7
Mean
2.00442
e
-
005
7.63447
e
+
002
6.53663
e
+
001
9.33638
e
+
001
Std
1.01518
e
-
005
2.85716
e
+
002
1.47148
e
+
002
2.21348
e
+
001
f
8
Mean
1.96773
e
+
001
1.00992
e
+
004
2.58670
e
+
002
1.61144
e
+
004
Std
3.32945
e
+
001
2.54700
e
+
003
5.37769
e
+
002
6.68451
e
+
003
f
9
Mean
3.20719
e
+
001
1.80082
e
+
007
2.23033
e
+
005
1.41913
e
+
005
Std
2.84519
e
+
001
2.24514
e
+
007
7.69626
e
+
005
1.29572
e
+
005
f
10
Mean
1.74564
e
-
001
6.12735
e
+
001
8.44887
e
+
000
1.94291
e
+
001
Std
2.39218
e
-
001
3.07002
e
+
001
6.86895
e
+
000
6.31473
e
+
000
f
11
Mean
2.07203
e
+
001
2.08745
e
+
001
2.07481
e
+
001
2.08665
e
+
001
Std
8.27531
e
-
002
5.76786
e
-
002
6.78494
e
-
002
5.81818
e
-
002
f
12
Mean
7.99944
e
+
001
1.86911
e
+
004
9.86338
e
+
001
5.00084
e
+
001
Std
2.08287
e
+
001
2.49192
e
+
001
1.75115
e
+
001
1.01565
e
+
001
f
13
Mean
1.45491
e
+
002
3.06702
e
+
002
1.74580
e
+
002
1.77517
e
+
002
Std
2.95067
e
+
001
3.87859
e
+
001
3.93332
e
+
00
1
2.79148
e
+
001
f
14
Mean
1.90236
e
+
001
2.04888
e
+
001
1.44403
e
+
001
2.51640
e
+
001
Std
2.13827
e
+
000
1.14255
e
+
000
2.83690
e
+
000
7.57584
e
-
001Convergence plots of BFOLS, BFO, PSO, and GA on functionsf1 – f6 with dimensions of 2 and 20.
(a)
Sphere-2D
(b)
Sphere-20D
(c)
Rosenbrock-2D
(d)
Rosenbrock-20D
(e)
Rastrigin-2D
(f)
Rastrigin-20D
(g)
Ackley-2D
(h)
Ackley-20D
(i)
Griewank-2D
(j)
Griewank-20D
(k)
Schwefel2.22-2D
(l)
Schwefel2.22-20DWith dimension of 2, PSO obtained best mean error values on 8 functions. BFOLS performed best on 5 and BFO performed best on the rest ones. With dimension of 20, BFOLS algorithm obtained best results on 12 functions of all 14. PSO and GA performed best on the rest two, respectively. The average rankings of the four algorithms are listed in Table4. The smaller the value is, the better the algorithm performs. On dimension of 2, the performance order is PSO>BFOLS>BFO>GA. And on dimension of 20, the performance order is BFOLS>PSO>GA>BFO.Table 4
Average rankings of the four algorithms on dimensions of 2 and 20.
Dimension
BFOLS
BFO
PSO
GA
2
1.6429
2.9286
1.5714
3.8571
20
1.1429
3.7143
2.0714
3.0714Table5 shows the results of Iman-Davenport statistical test. The critical values are at the level of 0.05, which can be looked up in the F-distribution table with 3 and 39 degrees of freedom. On dimensions of 2 and 20, the Iman-Davenport values are all larger than their critical values, which mean that significant differences exist among the rankings of the algorithms under the two conditions.Table 5
Results of the Iman-Davenport test.
Dimension
Iman-Davenport value
Critical valueα=0.05
Significant differences?
2
34.1852
2.85
Yes
20
42.3913
2.85
YesHolm tests were done as a post hoc procedure. With dimension of 2, PSO performed best. It is chosen as the control algorithm and the other algorithms will be compared with it. With dimension of 20, BFOLS algorithm is the control algorithm. The results of Holm test with dimensions of 2 and 20 are given in Tables6 and 7, respectively. The α/i values are with α=0.05. If α=0.10, the values are twice of the values listed.Table 6
Results of Holm’s test with dimension of 2.
Algorithm
z
P value
α
/
i
Significant differences?
GA
4.6843
2.8089
E
-
6
0.0167
Yes
BFO
2.7813
0.0054
0.025
Yes
BFOLS
0.1464
0.8836
0.05
NoTable 7
Results of Holm’s test with dimension of 20.
Algorithm
z
P value
α
/
i
Significant differences?
BFO
5.2699
1.365
3
E
-
7
0.0167
Yes
GA
3.9524
7.737
3
E
-
5
0.025
Yes
PSO
1.9030
0.0570
0.05
NoAs shown in Table6, the P values of GA and BFO are smaller than their α/i values, which means that equality hypotheses are rejected and significant differences exist between these two algorithms and the control algorithm-PSO. The P value of BFOLS is larger than its α/i values, so the equality hypothesis cannot be rejected. It denotes that no significant differences exist and it can be regarded as equivalent to PSO. The situation is the same when  α=0.10.With dimension of 20, BFOLS algorithm is the control algorithm. TheP values of BFO and GA are smaller than their α/i values, So BFOLS is significant better than the two algorithms. The equality hypothesis between BFOLS and PSO cannot be rejected when α=0.05. However, when  α=0.10, α/i value is 0.1 and the P value is smaller than it. So BFOLS is also significantly better than PSO under the level of 0.1.Overall, BFOLS shows significant improvement over the original BFO algorithm. And its optimization ability is better than the classic PSO and GA algorithms on higher dimensional problems, too.


### 4.2. Parameters Setting Test of BFOLS

In BFOLS, two extra parametersNsplit and Nadapt are introduced. Nsplit is the initial split threshold. Nadapt makes the split threshold and the death threshold adjusted with the environment adaptively. To determine the best settings of these two parameters, we tested the algorithm on four benchmarks with different Nsplit and  Nadapt values.The four benchmark functions are Rosenbrock, Griewank, Ackley, and Schwefel2.22. Each function was tested with dimensions of 2 and 20.Nsplit should be a little larger so the bacteria will not reproduce sharply at first. Nadapt should be larger than zero to let the split and death threshold vary adaptively. Tests have been done that population size will reduce to zero and error occurs on some functions when Nadapt is zero. In the first group of tests, Nadapt were fixed to 5 and Nsplit were set to be 10, 20, 30, 50, and 100 separately. In the second group of tests, Nsplit were fixed to 30 and Nadapt were set to be 1, 2, 5, 20, and 60 separately. Results of BFOLS obtained with different parameter values are listed in Tables 8 and 9.Table 8
Results of BFOLS with differentNsplit values under Nadapt=5.
Function
N
split
10
20
30
50
100
Rosenbrock2D
Mean
5.03273
e
-
007
9.32218
e
-
008
4.7678
0
e
-
008
1.7662
e
-
008
1.48532
e
-
008
Rank
4
5
3
2
1
Rosenbrock20D
Mean
1.49457
e
+
001
1
.
80154
e
+
001
2.5331
0
e
+
001
2.6878
0
e
+
001
3.686
23
e
+
001
Rank
1
2
3
4
5
Griewank2D
Mean
3.17617
e
-
006
1.20719
e
-
005
1.17638
e
-
006
1.53849
e
-
006
7
.
28572
e
-
00
6
Rank
3
5
1
2
4
Griewank20D
Mean
2
.
39571
e
-
002
3
.
56497
e
-
002
2
.
92754
e
-
002
2
.
7761
0
e
-
002
3
.
132
00
e
-
002
Rank
1
5
3
2
4
Ackley2D
Mean
2
.
25585
e
-
004
1
.
58819
e
-
004
1
.
90708
e
-
004
1
.
6191
0
e
-
004
1
.
24685
e
-
004
Rank
5
2
4
3
1
Ackley20D
Mean
1
.
78481
e
-
003
1
.
13355
e
-
003
1
.
29613
e
-
003
1.6481
0
e
+
000
1.52429
e
+
000
Rank
3
1
2
5
4
Schwefel2.222D
Mean
2.41253
e
-
005
2.28243
e
-
005
1.6031
0
e
-
005
1.84355
e
-
005
1.49146
e
-
005
Rank
5
4
2
3
1
Schwefel2.2220D
Mean
1
.
61622
e
-
003
9
.
90601
e
-
004
8
.
20052
e
-
004
5
.
89764
e
-
004
4
.
38522
e
-
004
Rank
5
4
3
2
1
Average rank
3.375
3.5
2.625
2.875
2.625Table 9
Results of BFOLS with differentNadapt values under Nsplit=30.
Function
N
adapt
1
2
5
20
60
Rosenbrock2D
Mean
2.03042
e
-
008
3.25644
e
-
008
4.76780
e
-
008
3.83752
e
-
008
6.27226
e
-
008
Rank
1
2
4
3
5
Rosenbrock20D
Mean
2.07862
e
+
001
1.85445
e
+
001
2.53310
e
+
001
1.21741
e
+
001
2.00873
e
+
001
Rank
4
2
5
1
3
Griewank2D
Mean
1.21182
e
-
006
7.3607
e
-
006
1.17638
e
-
006
8.76095
e
-
006
4.21623
e
-
006
Rank
2
4
1
5
3
Griewank20D
Mean
4.68112
e
-
002
4.45132
e
-
002
2.92754
e
-
002
3.10057
e
-
002
4.52086
e
-
002
Rank
5
3
1
2
4
Ackley2D
Mean
1.49850
e
-
004
1.34254
e
-
004
1.90708
e
-
004
1.63858
e
-
004
1.56880
e
-
004
Rank
2
1
5
4
3
Ackley20D
Mean
7.99836
e
-
001
6.77576
e
-
001
1.29613
e
-
003
2.79342
e
-
003
1.55109
e
-
001
Rank
5
4
1
2
3
Schwefel2.222D
Mean
2.61265
e
-
005
2.08609
e
-
005
1.60310
e
-
005
1.20443
e
-
005
1.82075
e
-
005
Rank
5
4
2
1
3
Schwefel2.2220D
Mean
6.70517
e
-
004
8.60185
e
-
004
8.20052
e
-
004
9.97355
e
-
004
8.10414
e
-
004
Rank
1
4
3
5
2
Average rank
3.125
3
2.75
2.875
3.25It is clear from the table, on most benchmark functions, results obtained with different parameter values are almost at the same order of magnitude. That is to say, the performance of BFOLS is not that sensitive to the parameter values on most functions. However, on Ackley function with dimension of 20, the situations seem changed. WhileNadapt was fixed, results of BFOLS with Nsplit values of 10, 20, and 30 are much better than of 50 and 100. While Nsplit was fixed, results of BFO with Nadapt values of 5 and 20 are better than 1, 2, and 60 clearly. At the meanwhile, the average ranks show that it got the best rank while Nsplit were 30 or 100 in the first test and while Nadapt was 5 in the second test.


### 4.3.  Population Size-Varying Simulation in BFOLS

As it has mentioned above, the population size of BFOLS may vary because the bacteria will split and die. As a result, the dynamic varying on functionf1 – f6 is tracked and recorded while the algorithm runs. The mean population size varying plots on the six functions with dimension of 2 and 20 are listed in Figure 4. The left subplot is with dimension of 2 and the right one is with dimension of 20. It can be seen that obvious regularities exist among both the two plots. With dimension of 2, the population size of BFOLS decreased firstly and increased at the end in all functions. With dimension of 20, population size increased fast at the beginning and then reached the peaks. After that, population size began to decrease. The varying plots probably correspond with two adaptive behaviors in the nature environment. As mentioned in (3.2), the nutrient updating is related with the improvement or deterioration of the position of the bacterium. In functions with dimension of two, the room for improvement is limited, which is similar to a saturated environment. The nutrient is limited and competitions between bacteria are fierce. As a result, bacteria die more than split and the population size decreases. At the end of the algorithm, the competition reduced as the number of bacteria decreased, so the bacteria reproduced more often adaptively. On functions with dimension of 20, there is much room for improvement and it could be regarded as an eutrophic environment. Bacteria split easily and the population size increased sharply at first; then it reached saturation. Competition increased and the population size began to decrease.Mean population size varying plots of BFOLS on benchmark functions with dimensions of 2 (a) and 20 (b).
(a)
(b)


## 4.1. Performance Test of BFOLS

### 4.1.1. Benchmark Functions

The BFOLS algorithm was tested on a set of benchmark functions with dimensions of 2 and 20, respectively. The functions are listed in Table1. Among them, f1 – f6 are basic functions widely adopted by other researchers ‎[28, 29], their global minima are all zero. f7 – f14 are shifted and rotated functions selected from CEC2005 test-bed, global minima of these functions are different from each other. For each function, its standard variable range is used. Function f10 is a special case. It has no bounds. The initialization range of this function is [0,600], and the global optima is outside of its initialization range.Table 1
Benchmark functions used in the experiment.
Function
Formulation
Variable ranges
f
(
x
*
)
f
1
Sphere
f
(
x
)
=
∑
i
=
1
D
x
i
2
[
-
5.12,5.12
]
0
f
2
Rosenbrock
f
(
x
)
=
∑
i
=
1
D
-
1
(
100
(
x
i
2
-
x
i
+
1
)
2
+
(
1
-
x
i
)
2
)
[
-
15,15
]
0
f
3
Rastrigin
f
(
x
)
=
∑
i
=
1
D
(
x
i
2
-
10
cos
(
2
π
x
i
)
+
10
)
[
-
10,10
]
0
f
4
Ackley
f
(
x
)
=
20
+
e
-
20
e
(
-
0.2
(
1
/
D
)
∑
i
=
1
D
x
i
2
)
-
e
(
(
1
/
D
)
∑
i
=
1
D
cos
(
2
π
x
i
)
)
[
-
32.768
,
32.768
]
0
f
5
Griewank
f
(
x
)
=
1
4000
(
∑
i
=
1
D
x
i
2
)
-
(
∏
i
=
1
D
cos
(
x
i
i
)
)
+
1
[
-
600
,
600
]
0
f
6
Schwefel2.22
f
(
x
)
=
∑
i
=
1
D
|
x
i
|
+
∏
i
=
1
D
|
x
i
|
[
-
10,10
]
0
f
7
Shifted sphere
f
(
x
)
=
∑
i
=
1
D
z
i
2
+
f
bias
1
,
z
=
x
-
o
[
-
100,100
]
−450
f
8
Shifted Schwefel1.2
f
(
x
)
=
∑
i
=
1
D
(
∑
j
=
1
i
z
j
)
2
+
f
bias
2
,
z
=
x
-
o
[
-
100,100
]
−450
f
9
Shifted Rosenbrock
f
(
x
)
=
∑
i
=
1
D
-
1
(
100
(
z
i
2
-
z
i
+
1
)
2
+
(
z
i
-
1
)
2
)
+
f
_
bias
6,
[
-
100,100
]
390
z=x-o
f
10
Shifted rotated Griewank
f
(
x
)
=
∑
i
=
1
D
z
i
2
4000
-
∏
i
=
1
D
cos
(
z
i
i
)
+
1
+
f
_
bias
7
,
No bounds
−180
z=(x-o)*M
f
(
x
)
=
-
20
exp
(
-
0.2
1
D
∑
i
=
1
D
z
i
2
)
f
11
Shifted rotated Ackley
-exp(1D∑i=1Dcos(2πzi))+20+e+f_bias8,
[
-
32
,
32
]
−140
z=(x-o)*M
f
12
Shifted Rastrigin
f
(
x
)
=
∑
i
=
1
D
(
z
i
2
-
10
cos
(
2
π
z
i
)
+
10
)
+
f
_
bias
9
,
[
-
5
,
5
]
−330
z=(x-o)
f
13
Shifted rotated Rastrigin
f
(
x
)
=
∑
i
=
1
D
(
z
i
2
-
10
cos
(
2
π
z
i
)
+
10
)
+
f
_
bias
10
,
[
-
5
,
5
]
−330
z=(x-o)*M
f
(
x
)
=
∑
i
=
1
D
(
∑
k
=
0
k
max
[
a
k
cos
(
2
π
b
k
(
z
i
+
0.5
)
)
]
)
f
14
Shifted rotated Weierstrass
-D∑k=0kmax[akcos(2πbk·0.5)]+f_bias11,
[
-
0.5
,
0.5
]
90
z=(x-o)*MIt should be mentioned that the bacteria may run different times in a chemotactic step. As a result, different computational complexity may be taken in each iteration for different algorithms and iterations count is no longer a reasonable measure. In order to compare the different algorithms, a fair measure method must be selected. In this paper, we use number of function evaluations (FEs) as a measure criterion, which is also used in many other works‎[30–32]. All algorithms were terminated after 20,000 function evaluations on dimension of 2 and 60,000 function evaluations on dimension of 20.


### 4.1.2. Parameter Settings for the Involved Algorithms

The population sizesS of all algorithms were 50. In original BFO algorithm, the parameters are set as follows: Nc=50,Ns=4,Nre=4,Ned=10, Pe=0.25,C=0.1,andSr=S/2=25. The parameter settings are similar to that in Passino’s work except Nc  is smaller and Ned is larger ‎[4]. This is because the termination criterion has changed to be the function evaluations. Smaller Nc  is selected to guarantee that the algorithm can run through the chemotactic, reproduction, eliminate, and dispersal processes. Larger Ned is selected to guarantee that the BFO algorithm will not terminate before the maximum function evaluations. In our BFOLS algorithm, as it has mentioned previously, Nc, Nre,Ned, and  Sr are no longer needed. Ns=4,Pe=0.25, which are the same with those are in BFO. The started step Cs=0.1(Ub-Lb); ended step Ce=0.00001(Ub-Lb), where Lb and Ub refer to the lower bound and upper bound of the variables of the problems. This will make the algorithm suitable for problems of different scales. The step of the whole population decreases from Cs to Ce  linearly, and step of each bacterium is calculated by (3.7) mentioned above. The values of the two control parameters Nsplit  and Nadapt are set to be 30 and 5. Standard PSO and GA algorithm was used in this experiment. In PSO algorithm, inertia weight ω decreased from 0.9 to 0.7. The learning factors C1=C2=2.0 [33].  Vmin=0.1×Lb,Vmax=0.1×Ub. In GA algorithm, single-point crossover is used; crossover probability is 0.95 and mutation probability is 0.1 ‎[25].


### 4.1.3. Experiment Results and Statistical Analysis

The error values(f(x)-f(x*)) of BFOLS, BFO, PSO, and GA algorithms on the benchmark functions with dimension of 2 and 20 are listed in Tables 2 and 3, respectively. Mean and standard deviation values obtained by these algorithms for 30 times of independent runs are given. Best values of them on each function are marked as bold. As there are 14 functions on each dimension, it will take too much space to give all the convergence plots. Here, only f1-f6’s convergence plots are given, as seen in Figure 3.Table 2
Error values obtained by BFOLS, BFO, PSO, and GA algorithms with dimension of 2.
Function
BFOLS
BFO
PSO
GA
f
1
Mean
1.66266
e
-
010
1.14309
e
-
005
1.48427
e
-
018
2
.
46555
e
-
003
Std
2.35439
e
-
010
1.44400
e
-
005
3.38437
e
-
018
4
.
0565
0
e
-
003
f
2
Mean
4.7678
e
-
008
4.94397
e
-
003
4.26062
e
-
015
1.76305
e
+
000
Std
5.69309
e
-
008
5.08761
e
-
003
9.56508
e
-
015
2.11319
e
+
000
f
3
Mean
1.40217
e
-
007
6
.
55588
e
-
001
3.07902
e
-
015
1
.
59279
e
-
001
Std
1.46112
e
-
007
3
.
622
00
e
-
001
8.83798
e
-
015
1
.
88468
e
-
001
f
4
Mean
1.90708
e
-
004
1.18787
e
-
001
1.06646
e
-
008
3
.
62955
e
-
001
Std
1.11928
e
-
004
6.54950
e
-
002
1.36111
e
-
008
2
.
58463
e
-
001
f
5
Mean
1.17638
e
-
006
2.67927
e
-
002
2.92970
e
-
004
9
.
3831
0
e
-
002
Std
2.53546
e
-
006
1.28042
e
-
002
1.36535
e
-
003
6
.
92769
e
-
002
f
6
Mean
1.60310
e
-
005
8.0626
e
-
003
2.47171
e
-
009
3
.
37681
e
-
002
Std
1.36623
e
-
005
4.42736
e
-
003
4.17088
e
-
009
2
.
83197
e
-
002
f
7
Mean
4.52226
e
-
008
3.81605
e
-
003
0
1.06661
e
+
001
Std
3.93677
e
-
008
3.62032
e
-
003
0
1.02199
e
+
001
f
8
Mean
5.57271
e
-
008
4.75829
e
-
003
5.68434
e
-
015
1.91645
e
+
000
Std
8.51665
e
-
008
4.00577
e
-
003
1.73446
e
-
014
4.00548
e
+
000
f
9
Mean
2.15994
e
-
006
2.00971
e
-
001
6.66463
e
-
006
4.24819
e
+
001
Std
2.21157
e
-
006
1.58643
e
-
001
2.94369
e
-
005
4.77406
e
+
001
f
10
Mean
1
.
64445
e
-
004
4
.
59019
e
-
002
1
.
66967
e
-
003
2
.
87956
e
-
001
Std
8
.
78281
e
-
004
2
.
35742
e
-
002
3
.
37535
e
-
003
1
.
40164
e
-
001
f
11
Mean
1
.
19137
e
+
001
9.69262
e
+
000
1
.
66669
e
+
001
1
.
21447
e
+
001
Std
9.89835
e
+
000
5.40612
e
+
000
7.5811
e
+
000
4.10647
e
+
000
f
12
Mean
4.631
00
e
-
008
2
.
50975
e
-
001
1
.
98992
e
-
001
7
.
41804
e
-
001
Std
5.64908
e
-
008
3
.
35611
e
-
001
4
.
04787
e
-
001
6
.
75828
e
-
001
f
13
Mean
3.49518
e
-
008
1
.
85255
e
-
001
3
.
31653
e
-
002
9
.
61984
e
-
001
Std
2.31262
e
-
008
1
.
65632
e
-
001
1
.
81654
e
-
001
6
.
48141
e
-
001
f
14
Mean
1
.
81406
e
-
003
1
.
01915
e
-
001
9.25237
e
-
006
3
.
39486
e
-
001
Std
6
.
56816
e
-
004
3
.
849
00
e
-
002
6.56108
e
-
006
1
.
11498
e
-
001Table 3
Error values obtained by the BFOLS, BFO, PSO, and GA algorithms with dimension of 20.
Function
BFOLS
BFO
PSO
GA
f
1
Mean
6.89944
e
-
008
6
.
17635
e
-
001
3.76236
e
-
006
6
.
61625
e
-
001
Std
4.37473
e
-
008
1
.
943
00
e
-
001
4.85485
e
-
006
2
.
34433
e
-
001
f
2
Mean
2.36439
e
+
001
2.02447
e
+
003
2.49117
e
+
001
6
.
56345
e
+
002
Std
2.39321
e
+
001
8.62087
e
+
002
2.12081
e
+
001
4
.
55687
e
+
002
f
3
Mean
1.09317
e
+
001
4.94922
e
+
002
3.35838
e
+
001
6
.
80152
e
+
001
Std
5.90291
e
+
000
6.74151
e
+
001
1.07949
e
+
001
1
.
77908
e
+
001
f
4
Mean
1
.
29613
e
-
003
1
.
95483
e
+
001
1.10071
e
+
000
1
.
86919
e
+
001
Std
2
.
60321
e
-
003
3
.
71818
e
-
001
9
.
1465
0
e
-
001
1.30767
e
-
000
f
5
Mean
2
.
92754
e
-
002
3.00705
e
+
000
3
.
89587
e
-
002
3.11937
e
+
000
Std
2
.
12876
e
-
002
4
.
5062
e
-
001
3
.
13277
e
-
002
8
.
5576
0
e
-
001
f
6
Mean
8
.
20052
e
-
004
5.43634
e
+
001
1
.
39941
e
-
001
4.92696
e
+
000
Std
2
.
08416
e
-
004
1.20626
e
+
001
1
.
87068
e
-
001
1.09457
e
+
000
f
7
Mean
2.00442
e
-
005
7.63447
e
+
002
6.53663
e
+
001
9.33638
e
+
001
Std
1.01518
e
-
005
2.85716
e
+
002
1.47148
e
+
002
2.21348
e
+
001
f
8
Mean
1.96773
e
+
001
1.00992
e
+
004
2.58670
e
+
002
1.61144
e
+
004
Std
3.32945
e
+
001
2.54700
e
+
003
5.37769
e
+
002
6.68451
e
+
003
f
9
Mean
3.20719
e
+
001
1.80082
e
+
007
2.23033
e
+
005
1.41913
e
+
005
Std
2.84519
e
+
001
2.24514
e
+
007
7.69626
e
+
005
1.29572
e
+
005
f
10
Mean
1.74564
e
-
001
6.12735
e
+
001
8.44887
e
+
000
1.94291
e
+
001
Std
2.39218
e
-
001
3.07002
e
+
001
6.86895
e
+
000
6.31473
e
+
000
f
11
Mean
2.07203
e
+
001
2.08745
e
+
001
2.07481
e
+
001
2.08665
e
+
001
Std
8.27531
e
-
002
5.76786
e
-
002
6.78494
e
-
002
5.81818
e
-
002
f
12
Mean
7.99944
e
+
001
1.86911
e
+
004
9.86338
e
+
001
5.00084
e
+
001
Std
2.08287
e
+
001
2.49192
e
+
001
1.75115
e
+
001
1.01565
e
+
001
f
13
Mean
1.45491
e
+
002
3.06702
e
+
002
1.74580
e
+
002
1.77517
e
+
002
Std
2.95067
e
+
001
3.87859
e
+
001
3.93332
e
+
00
1
2.79148
e
+
001
f
14
Mean
1.90236
e
+
001
2.04888
e
+
001
1.44403
e
+
001
2.51640
e
+
001
Std
2.13827
e
+
000
1.14255
e
+
000
2.83690
e
+
000
7.57584
e
-
001Convergence plots of BFOLS, BFO, PSO, and GA on functionsf1 – f6 with dimensions of 2 and 20.
(a)
Sphere-2D
(b)
Sphere-20D
(c)
Rosenbrock-2D
(d)
Rosenbrock-20D
(e)
Rastrigin-2D
(f)
Rastrigin-20D
(g)
Ackley-2D
(h)
Ackley-20D
(i)
Griewank-2D
(j)
Griewank-20D
(k)
Schwefel2.22-2D
(l)
Schwefel2.22-20DWith dimension of 2, PSO obtained best mean error values on 8 functions. BFOLS performed best on 5 and BFO performed best on the rest ones. With dimension of 20, BFOLS algorithm obtained best results on 12 functions of all 14. PSO and GA performed best on the rest two, respectively. The average rankings of the four algorithms are listed in Table4. The smaller the value is, the better the algorithm performs. On dimension of 2, the performance order is PSO>BFOLS>BFO>GA. And on dimension of 20, the performance order is BFOLS>PSO>GA>BFO.Table 4
Average rankings of the four algorithms on dimensions of 2 and 20.
Dimension
BFOLS
BFO
PSO
GA
2
1.6429
2.9286
1.5714
3.8571
20
1.1429
3.7143
2.0714
3.0714Table5 shows the results of Iman-Davenport statistical test. The critical values are at the level of 0.05, which can be looked up in the F-distribution table with 3 and 39 degrees of freedom. On dimensions of 2 and 20, the Iman-Davenport values are all larger than their critical values, which mean that significant differences exist among the rankings of the algorithms under the two conditions.Table 5
Results of the Iman-Davenport test.
Dimension
Iman-Davenport value
Critical valueα=0.05
Significant differences?
2
34.1852
2.85
Yes
20
42.3913
2.85
YesHolm tests were done as a post hoc procedure. With dimension of 2, PSO performed best. It is chosen as the control algorithm and the other algorithms will be compared with it. With dimension of 20, BFOLS algorithm is the control algorithm. The results of Holm test with dimensions of 2 and 20 are given in Tables6 and 7, respectively. The α/i values are with α=0.05. If α=0.10, the values are twice of the values listed.Table 6
Results of Holm’s test with dimension of 2.
Algorithm
z
P value
α
/
i
Significant differences?
GA
4.6843
2.8089
E
-
6
0.0167
Yes
BFO
2.7813
0.0054
0.025
Yes
BFOLS
0.1464
0.8836
0.05
NoTable 7
Results of Holm’s test with dimension of 20.
Algorithm
z
P value
α
/
i
Significant differences?
BFO
5.2699
1.365
3
E
-
7
0.0167
Yes
GA
3.9524
7.737
3
E
-
5
0.025
Yes
PSO
1.9030
0.0570
0.05
NoAs shown in Table6, the P values of GA and BFO are smaller than their α/i values, which means that equality hypotheses are rejected and significant differences exist between these two algorithms and the control algorithm-PSO. The P value of BFOLS is larger than its α/i values, so the equality hypothesis cannot be rejected. It denotes that no significant differences exist and it can be regarded as equivalent to PSO. The situation is the same when  α=0.10.With dimension of 20, BFOLS algorithm is the control algorithm. TheP values of BFO and GA are smaller than their α/i values, So BFOLS is significant better than the two algorithms. The equality hypothesis between BFOLS and PSO cannot be rejected when α=0.05. However, when  α=0.10, α/i value is 0.1 and the P value is smaller than it. So BFOLS is also significantly better than PSO under the level of 0.1.Overall, BFOLS shows significant improvement over the original BFO algorithm. And its optimization ability is better than the classic PSO and GA algorithms on higher dimensional problems, too.


## 4.1.1. Benchmark Functions

The BFOLS algorithm was tested on a set of benchmark functions with dimensions of 2 and 20, respectively. The functions are listed in Table1. Among them, f1 – f6 are basic functions widely adopted by other researchers ‎[28, 29], their global minima are all zero. f7 – f14 are shifted and rotated functions selected from CEC2005 test-bed, global minima of these functions are different from each other. For each function, its standard variable range is used. Function f10 is a special case. It has no bounds. The initialization range of this function is [0,600], and the global optima is outside of its initialization range.Table 1
Benchmark functions used in the experiment.
Function
Formulation
Variable ranges
f
(
x
*
)
f
1
Sphere
f
(
x
)
=
∑
i
=
1
D
x
i
2
[
-
5.12,5.12
]
0
f
2
Rosenbrock
f
(
x
)
=
∑
i
=
1
D
-
1
(
100
(
x
i
2
-
x
i
+
1
)
2
+
(
1
-
x
i
)
2
)
[
-
15,15
]
0
f
3
Rastrigin
f
(
x
)
=
∑
i
=
1
D
(
x
i
2
-
10
cos
(
2
π
x
i
)
+
10
)
[
-
10,10
]
0
f
4
Ackley
f
(
x
)
=
20
+
e
-
20
e
(
-
0.2
(
1
/
D
)
∑
i
=
1
D
x
i
2
)
-
e
(
(
1
/
D
)
∑
i
=
1
D
cos
(
2
π
x
i
)
)
[
-
32.768
,
32.768
]
0
f
5
Griewank
f
(
x
)
=
1
4000
(
∑
i
=
1
D
x
i
2
)
-
(
∏
i
=
1
D
cos
(
x
i
i
)
)
+
1
[
-
600
,
600
]
0
f
6
Schwefel2.22
f
(
x
)
=
∑
i
=
1
D
|
x
i
|
+
∏
i
=
1
D
|
x
i
|
[
-
10,10
]
0
f
7
Shifted sphere
f
(
x
)
=
∑
i
=
1
D
z
i
2
+
f
bias
1
,
z
=
x
-
o
[
-
100,100
]
−450
f
8
Shifted Schwefel1.2
f
(
x
)
=
∑
i
=
1
D
(
∑
j
=
1
i
z
j
)
2
+
f
bias
2
,
z
=
x
-
o
[
-
100,100
]
−450
f
9
Shifted Rosenbrock
f
(
x
)
=
∑
i
=
1
D
-
1
(
100
(
z
i
2
-
z
i
+
1
)
2
+
(
z
i
-
1
)
2
)
+
f
_
bias
6,
[
-
100,100
]
390
z=x-o
f
10
Shifted rotated Griewank
f
(
x
)
=
∑
i
=
1
D
z
i
2
4000
-
∏
i
=
1
D
cos
(
z
i
i
)
+
1
+
f
_
bias
7
,
No bounds
−180
z=(x-o)*M
f
(
x
)
=
-
20
exp
(
-
0.2
1
D
∑
i
=
1
D
z
i
2
)
f
11
Shifted rotated Ackley
-exp(1D∑i=1Dcos(2πzi))+20+e+f_bias8,
[
-
32
,
32
]
−140
z=(x-o)*M
f
12
Shifted Rastrigin
f
(
x
)
=
∑
i
=
1
D
(
z
i
2
-
10
cos
(
2
π
z
i
)
+
10
)
+
f
_
bias
9
,
[
-
5
,
5
]
−330
z=(x-o)
f
13
Shifted rotated Rastrigin
f
(
x
)
=
∑
i
=
1
D
(
z
i
2
-
10
cos
(
2
π
z
i
)
+
10
)
+
f
_
bias
10
,
[
-
5
,
5
]
−330
z=(x-o)*M
f
(
x
)
=
∑
i
=
1
D
(
∑
k
=
0
k
max
[
a
k
cos
(
2
π
b
k
(
z
i
+
0.5
)
)
]
)
f
14
Shifted rotated Weierstrass
-D∑k=0kmax[akcos(2πbk·0.5)]+f_bias11,
[
-
0.5
,
0.5
]
90
z=(x-o)*MIt should be mentioned that the bacteria may run different times in a chemotactic step. As a result, different computational complexity may be taken in each iteration for different algorithms and iterations count is no longer a reasonable measure. In order to compare the different algorithms, a fair measure method must be selected. In this paper, we use number of function evaluations (FEs) as a measure criterion, which is also used in many other works‎[30–32]. All algorithms were terminated after 20,000 function evaluations on dimension of 2 and 60,000 function evaluations on dimension of 20.


## 4.1.2. Parameter Settings for the Involved Algorithms

The population sizesS of all algorithms were 50. In original BFO algorithm, the parameters are set as follows: Nc=50,Ns=4,Nre=4,Ned=10, Pe=0.25,C=0.1,andSr=S/2=25. The parameter settings are similar to that in Passino’s work except Nc  is smaller and Ned is larger ‎[4]. This is because the termination criterion has changed to be the function evaluations. Smaller Nc  is selected to guarantee that the algorithm can run through the chemotactic, reproduction, eliminate, and dispersal processes. Larger Ned is selected to guarantee that the BFO algorithm will not terminate before the maximum function evaluations. In our BFOLS algorithm, as it has mentioned previously, Nc, Nre,Ned, and  Sr are no longer needed. Ns=4,Pe=0.25, which are the same with those are in BFO. The started step Cs=0.1(Ub-Lb); ended step Ce=0.00001(Ub-Lb), where Lb and Ub refer to the lower bound and upper bound of the variables of the problems. This will make the algorithm suitable for problems of different scales. The step of the whole population decreases from Cs to Ce  linearly, and step of each bacterium is calculated by (3.7) mentioned above. The values of the two control parameters Nsplit  and Nadapt are set to be 30 and 5. Standard PSO and GA algorithm was used in this experiment. In PSO algorithm, inertia weight ω decreased from 0.9 to 0.7. The learning factors C1=C2=2.0 [33].  Vmin=0.1×Lb,Vmax=0.1×Ub. In GA algorithm, single-point crossover is used; crossover probability is 0.95 and mutation probability is 0.1 ‎[25].


## 4.1.3. Experiment Results and Statistical Analysis

The error values(f(x)-f(x*)) of BFOLS, BFO, PSO, and GA algorithms on the benchmark functions with dimension of 2 and 20 are listed in Tables 2 and 3, respectively. Mean and standard deviation values obtained by these algorithms for 30 times of independent runs are given. Best values of them on each function are marked as bold. As there are 14 functions on each dimension, it will take too much space to give all the convergence plots. Here, only f1-f6’s convergence plots are given, as seen in Figure 3.Table 2
Error values obtained by BFOLS, BFO, PSO, and GA algorithms with dimension of 2.
Function
BFOLS
BFO
PSO
GA
f
1
Mean
1.66266
e
-
010
1.14309
e
-
005
1.48427
e
-
018
2
.
46555
e
-
003
Std
2.35439
e
-
010
1.44400
e
-
005
3.38437
e
-
018
4
.
0565
0
e
-
003
f
2
Mean
4.7678
e
-
008
4.94397
e
-
003
4.26062
e
-
015
1.76305
e
+
000
Std
5.69309
e
-
008
5.08761
e
-
003
9.56508
e
-
015
2.11319
e
+
000
f
3
Mean
1.40217
e
-
007
6
.
55588
e
-
001
3.07902
e
-
015
1
.
59279
e
-
001
Std
1.46112
e
-
007
3
.
622
00
e
-
001
8.83798
e
-
015
1
.
88468
e
-
001
f
4
Mean
1.90708
e
-
004
1.18787
e
-
001
1.06646
e
-
008
3
.
62955
e
-
001
Std
1.11928
e
-
004
6.54950
e
-
002
1.36111
e
-
008
2
.
58463
e
-
001
f
5
Mean
1.17638
e
-
006
2.67927
e
-
002
2.92970
e
-
004
9
.
3831
0
e
-
002
Std
2.53546
e
-
006
1.28042
e
-
002
1.36535
e
-
003
6
.
92769
e
-
002
f
6
Mean
1.60310
e
-
005
8.0626
e
-
003
2.47171
e
-
009
3
.
37681
e
-
002
Std
1.36623
e
-
005
4.42736
e
-
003
4.17088
e
-
009
2
.
83197
e
-
002
f
7
Mean
4.52226
e
-
008
3.81605
e
-
003
0
1.06661
e
+
001
Std
3.93677
e
-
008
3.62032
e
-
003
0
1.02199
e
+
001
f
8
Mean
5.57271
e
-
008
4.75829
e
-
003
5.68434
e
-
015
1.91645
e
+
000
Std
8.51665
e
-
008
4.00577
e
-
003
1.73446
e
-
014
4.00548
e
+
000
f
9
Mean
2.15994
e
-
006
2.00971
e
-
001
6.66463
e
-
006
4.24819
e
+
001
Std
2.21157
e
-
006
1.58643
e
-
001
2.94369
e
-
005
4.77406
e
+
001
f
10
Mean
1
.
64445
e
-
004
4
.
59019
e
-
002
1
.
66967
e
-
003
2
.
87956
e
-
001
Std
8
.
78281
e
-
004
2
.
35742
e
-
002
3
.
37535
e
-
003
1
.
40164
e
-
001
f
11
Mean
1
.
19137
e
+
001
9.69262
e
+
000
1
.
66669
e
+
001
1
.
21447
e
+
001
Std
9.89835
e
+
000
5.40612
e
+
000
7.5811
e
+
000
4.10647
e
+
000
f
12
Mean
4.631
00
e
-
008
2
.
50975
e
-
001
1
.
98992
e
-
001
7
.
41804
e
-
001
Std
5.64908
e
-
008
3
.
35611
e
-
001
4
.
04787
e
-
001
6
.
75828
e
-
001
f
13
Mean
3.49518
e
-
008
1
.
85255
e
-
001
3
.
31653
e
-
002
9
.
61984
e
-
001
Std
2.31262
e
-
008
1
.
65632
e
-
001
1
.
81654
e
-
001
6
.
48141
e
-
001
f
14
Mean
1
.
81406
e
-
003
1
.
01915
e
-
001
9.25237
e
-
006
3
.
39486
e
-
001
Std
6
.
56816
e
-
004
3
.
849
00
e
-
002
6.56108
e
-
006
1
.
11498
e
-
001Table 3
Error values obtained by the BFOLS, BFO, PSO, and GA algorithms with dimension of 20.
Function
BFOLS
BFO
PSO
GA
f
1
Mean
6.89944
e
-
008
6
.
17635
e
-
001
3.76236
e
-
006
6
.
61625
e
-
001
Std
4.37473
e
-
008
1
.
943
00
e
-
001
4.85485
e
-
006
2
.
34433
e
-
001
f
2
Mean
2.36439
e
+
001
2.02447
e
+
003
2.49117
e
+
001
6
.
56345
e
+
002
Std
2.39321
e
+
001
8.62087
e
+
002
2.12081
e
+
001
4
.
55687
e
+
002
f
3
Mean
1.09317
e
+
001
4.94922
e
+
002
3.35838
e
+
001
6
.
80152
e
+
001
Std
5.90291
e
+
000
6.74151
e
+
001
1.07949
e
+
001
1
.
77908
e
+
001
f
4
Mean
1
.
29613
e
-
003
1
.
95483
e
+
001
1.10071
e
+
000
1
.
86919
e
+
001
Std
2
.
60321
e
-
003
3
.
71818
e
-
001
9
.
1465
0
e
-
001
1.30767
e
-
000
f
5
Mean
2
.
92754
e
-
002
3.00705
e
+
000
3
.
89587
e
-
002
3.11937
e
+
000
Std
2
.
12876
e
-
002
4
.
5062
e
-
001
3
.
13277
e
-
002
8
.
5576
0
e
-
001
f
6
Mean
8
.
20052
e
-
004
5.43634
e
+
001
1
.
39941
e
-
001
4.92696
e
+
000
Std
2
.
08416
e
-
004
1.20626
e
+
001
1
.
87068
e
-
001
1.09457
e
+
000
f
7
Mean
2.00442
e
-
005
7.63447
e
+
002
6.53663
e
+
001
9.33638
e
+
001
Std
1.01518
e
-
005
2.85716
e
+
002
1.47148
e
+
002
2.21348
e
+
001
f
8
Mean
1.96773
e
+
001
1.00992
e
+
004
2.58670
e
+
002
1.61144
e
+
004
Std
3.32945
e
+
001
2.54700
e
+
003
5.37769
e
+
002
6.68451
e
+
003
f
9
Mean
3.20719
e
+
001
1.80082
e
+
007
2.23033
e
+
005
1.41913
e
+
005
Std
2.84519
e
+
001
2.24514
e
+
007
7.69626
e
+
005
1.29572
e
+
005
f
10
Mean
1.74564
e
-
001
6.12735
e
+
001
8.44887
e
+
000
1.94291
e
+
001
Std
2.39218
e
-
001
3.07002
e
+
001
6.86895
e
+
000
6.31473
e
+
000
f
11
Mean
2.07203
e
+
001
2.08745
e
+
001
2.07481
e
+
001
2.08665
e
+
001
Std
8.27531
e
-
002
5.76786
e
-
002
6.78494
e
-
002
5.81818
e
-
002
f
12
Mean
7.99944
e
+
001
1.86911
e
+
004
9.86338
e
+
001
5.00084
e
+
001
Std
2.08287
e
+
001
2.49192
e
+
001
1.75115
e
+
001
1.01565
e
+
001
f
13
Mean
1.45491
e
+
002
3.06702
e
+
002
1.74580
e
+
002
1.77517
e
+
002
Std
2.95067
e
+
001
3.87859
e
+
001
3.93332
e
+
00
1
2.79148
e
+
001
f
14
Mean
1.90236
e
+
001
2.04888
e
+
001
1.44403
e
+
001
2.51640
e
+
001
Std
2.13827
e
+
000
1.14255
e
+
000
2.83690
e
+
000
7.57584
e
-
001Convergence plots of BFOLS, BFO, PSO, and GA on functionsf1 – f6 with dimensions of 2 and 20.
(a)
Sphere-2D
(b)
Sphere-20D
(c)
Rosenbrock-2D
(d)
Rosenbrock-20D
(e)
Rastrigin-2D
(f)
Rastrigin-20D
(g)
Ackley-2D
(h)
Ackley-20D
(i)
Griewank-2D
(j)
Griewank-20D
(k)
Schwefel2.22-2D
(l)
Schwefel2.22-20DWith dimension of 2, PSO obtained best mean error values on 8 functions. BFOLS performed best on 5 and BFO performed best on the rest ones. With dimension of 20, BFOLS algorithm obtained best results on 12 functions of all 14. PSO and GA performed best on the rest two, respectively. The average rankings of the four algorithms are listed in Table4. The smaller the value is, the better the algorithm performs. On dimension of 2, the performance order is PSO>BFOLS>BFO>GA. And on dimension of 20, the performance order is BFOLS>PSO>GA>BFO.Table 4
Average rankings of the four algorithms on dimensions of 2 and 20.
Dimension
BFOLS
BFO
PSO
GA
2
1.6429
2.9286
1.5714
3.8571
20
1.1429
3.7143
2.0714
3.0714Table5 shows the results of Iman-Davenport statistical test. The critical values are at the level of 0.05, which can be looked up in the F-distribution table with 3 and 39 degrees of freedom. On dimensions of 2 and 20, the Iman-Davenport values are all larger than their critical values, which mean that significant differences exist among the rankings of the algorithms under the two conditions.Table 5
Results of the Iman-Davenport test.
Dimension
Iman-Davenport value
Critical valueα=0.05
Significant differences?
2
34.1852
2.85
Yes
20
42.3913
2.85
YesHolm tests were done as a post hoc procedure. With dimension of 2, PSO performed best. It is chosen as the control algorithm and the other algorithms will be compared with it. With dimension of 20, BFOLS algorithm is the control algorithm. The results of Holm test with dimensions of 2 and 20 are given in Tables6 and 7, respectively. The α/i values are with α=0.05. If α=0.10, the values are twice of the values listed.Table 6
Results of Holm’s test with dimension of 2.
Algorithm
z
P value
α
/
i
Significant differences?
GA
4.6843
2.8089
E
-
6
0.0167
Yes
BFO
2.7813
0.0054
0.025
Yes
BFOLS
0.1464
0.8836
0.05
NoTable 7
Results of Holm’s test with dimension of 20.
Algorithm
z
P value
α
/
i
Significant differences?
BFO
5.2699
1.365
3
E
-
7
0.0167
Yes
GA
3.9524
7.737
3
E
-
5
0.025
Yes
PSO
1.9030
0.0570
0.05
NoAs shown in Table6, the P values of GA and BFO are smaller than their α/i values, which means that equality hypotheses are rejected and significant differences exist between these two algorithms and the control algorithm-PSO. The P value of BFOLS is larger than its α/i values, so the equality hypothesis cannot be rejected. It denotes that no significant differences exist and it can be regarded as equivalent to PSO. The situation is the same when  α=0.10.With dimension of 20, BFOLS algorithm is the control algorithm. TheP values of BFO and GA are smaller than their α/i values, So BFOLS is significant better than the two algorithms. The equality hypothesis between BFOLS and PSO cannot be rejected when α=0.05. However, when  α=0.10, α/i value is 0.1 and the P value is smaller than it. So BFOLS is also significantly better than PSO under the level of 0.1.Overall, BFOLS shows significant improvement over the original BFO algorithm. And its optimization ability is better than the classic PSO and GA algorithms on higher dimensional problems, too.


## 4.2. Parameters Setting Test of BFOLS

In BFOLS, two extra parametersNsplit and Nadapt are introduced. Nsplit is the initial split threshold. Nadapt makes the split threshold and the death threshold adjusted with the environment adaptively. To determine the best settings of these two parameters, we tested the algorithm on four benchmarks with different Nsplit and  Nadapt values.The four benchmark functions are Rosenbrock, Griewank, Ackley, and Schwefel2.22. Each function was tested with dimensions of 2 and 20.Nsplit should be a little larger so the bacteria will not reproduce sharply at first. Nadapt should be larger than zero to let the split and death threshold vary adaptively. Tests have been done that population size will reduce to zero and error occurs on some functions when Nadapt is zero. In the first group of tests, Nadapt were fixed to 5 and Nsplit were set to be 10, 20, 30, 50, and 100 separately. In the second group of tests, Nsplit were fixed to 30 and Nadapt were set to be 1, 2, 5, 20, and 60 separately. Results of BFOLS obtained with different parameter values are listed in Tables 8 and 9.Table 8
Results of BFOLS with differentNsplit values under Nadapt=5.
Function
N
split
10
20
30
50
100
Rosenbrock2D
Mean
5.03273
e
-
007
9.32218
e
-
008
4.7678
0
e
-
008
1.7662
e
-
008
1.48532
e
-
008
Rank
4
5
3
2
1
Rosenbrock20D
Mean
1.49457
e
+
001
1
.
80154
e
+
001
2.5331
0
e
+
001
2.6878
0
e
+
001
3.686
23
e
+
001
Rank
1
2
3
4
5
Griewank2D
Mean
3.17617
e
-
006
1.20719
e
-
005
1.17638
e
-
006
1.53849
e
-
006
7
.
28572
e
-
00
6
Rank
3
5
1
2
4
Griewank20D
Mean
2
.
39571
e
-
002
3
.
56497
e
-
002
2
.
92754
e
-
002
2
.
7761
0
e
-
002
3
.
132
00
e
-
002
Rank
1
5
3
2
4
Ackley2D
Mean
2
.
25585
e
-
004
1
.
58819
e
-
004
1
.
90708
e
-
004
1
.
6191
0
e
-
004
1
.
24685
e
-
004
Rank
5
2
4
3
1
Ackley20D
Mean
1
.
78481
e
-
003
1
.
13355
e
-
003
1
.
29613
e
-
003
1.6481
0
e
+
000
1.52429
e
+
000
Rank
3
1
2
5
4
Schwefel2.222D
Mean
2.41253
e
-
005
2.28243
e
-
005
1.6031
0
e
-
005
1.84355
e
-
005
1.49146
e
-
005
Rank
5
4
2
3
1
Schwefel2.2220D
Mean
1
.
61622
e
-
003
9
.
90601
e
-
004
8
.
20052
e
-
004
5
.
89764
e
-
004
4
.
38522
e
-
004
Rank
5
4
3
2
1
Average rank
3.375
3.5
2.625
2.875
2.625Table 9
Results of BFOLS with differentNadapt values under Nsplit=30.
Function
N
adapt
1
2
5
20
60
Rosenbrock2D
Mean
2.03042
e
-
008
3.25644
e
-
008
4.76780
e
-
008
3.83752
e
-
008
6.27226
e
-
008
Rank
1
2
4
3
5
Rosenbrock20D
Mean
2.07862
e
+
001
1.85445
e
+
001
2.53310
e
+
001
1.21741
e
+
001
2.00873
e
+
001
Rank
4
2
5
1
3
Griewank2D
Mean
1.21182
e
-
006
7.3607
e
-
006
1.17638
e
-
006
8.76095
e
-
006
4.21623
e
-
006
Rank
2
4
1
5
3
Griewank20D
Mean
4.68112
e
-
002
4.45132
e
-
002
2.92754
e
-
002
3.10057
e
-
002
4.52086
e
-
002
Rank
5
3
1
2
4
Ackley2D
Mean
1.49850
e
-
004
1.34254
e
-
004
1.90708
e
-
004
1.63858
e
-
004
1.56880
e
-
004
Rank
2
1
5
4
3
Ackley20D
Mean
7.99836
e
-
001
6.77576
e
-
001
1.29613
e
-
003
2.79342
e
-
003
1.55109
e
-
001
Rank
5
4
1
2
3
Schwefel2.222D
Mean
2.61265
e
-
005
2.08609
e
-
005
1.60310
e
-
005
1.20443
e
-
005
1.82075
e
-
005
Rank
5
4
2
1
3
Schwefel2.2220D
Mean
6.70517
e
-
004
8.60185
e
-
004
8.20052
e
-
004
9.97355
e
-
004
8.10414
e
-
004
Rank
1
4
3
5
2
Average rank
3.125
3
2.75
2.875
3.25It is clear from the table, on most benchmark functions, results obtained with different parameter values are almost at the same order of magnitude. That is to say, the performance of BFOLS is not that sensitive to the parameter values on most functions. However, on Ackley function with dimension of 20, the situations seem changed. WhileNadapt was fixed, results of BFOLS with Nsplit values of 10, 20, and 30 are much better than of 50 and 100. While Nsplit was fixed, results of BFO with Nadapt values of 5 and 20 are better than 1, 2, and 60 clearly. At the meanwhile, the average ranks show that it got the best rank while Nsplit were 30 or 100 in the first test and while Nadapt was 5 in the second test.


## 4.3.  Population Size-Varying Simulation in BFOLS

As it has mentioned above, the population size of BFOLS may vary because the bacteria will split and die. As a result, the dynamic varying on functionf1 – f6 is tracked and recorded while the algorithm runs. The mean population size varying plots on the six functions with dimension of 2 and 20 are listed in Figure 4. The left subplot is with dimension of 2 and the right one is with dimension of 20. It can be seen that obvious regularities exist among both the two plots. With dimension of 2, the population size of BFOLS decreased firstly and increased at the end in all functions. With dimension of 20, population size increased fast at the beginning and then reached the peaks. After that, population size began to decrease. The varying plots probably correspond with two adaptive behaviors in the nature environment. As mentioned in (3.2), the nutrient updating is related with the improvement or deterioration of the position of the bacterium. In functions with dimension of two, the room for improvement is limited, which is similar to a saturated environment. The nutrient is limited and competitions between bacteria are fierce. As a result, bacteria die more than split and the population size decreases. At the end of the algorithm, the competition reduced as the number of bacteria decreased, so the bacteria reproduced more often adaptively. On functions with dimension of 20, there is much room for improvement and it could be regarded as an eutrophic environment. Bacteria split easily and the population size increased sharply at first; then it reached saturation. Competition increased and the population size began to decrease.Mean population size varying plots of BFOLS on benchmark functions with dimensions of 2 (a) and 20 (b).
(a)
(b)


## 5. Conclusions

This paper analyzes the shortness of original Bacterial Foraging Optimization algorithm. To overcome its shortness, an adaptive BFO algorithm with lifecycle and social learning is proposed, which is named BFOLS. In the new algorithm, a lifecycle model of bacteria is founded. The bacteria will split, die, or migrate dynamically in the foraging processes according to their nutrient. Social learning is also introduced in the chemotactic steps to guide the tumble direction. In BFOLS algorithm, the tumble angles are no longer generated randomly. Instead, they are produced using the information of the bacteria’s global best, the bacterium’ personal best, and its current position. At last, an adaptive search step length strategy is employed. The step length of the bacteria population decreases linearly with iterations and the individuals adjust their step lengths further according to their nutrient value.To verify the optimization ability of BFOLS algorithm, it is tested on a set of benchmark functions with dimensions of 2 and 20. Original BFO, PSO, and GA algorithms are used for comparison. With dimension of 2, it outperforms BFO and GA but is little worse than PSO. With dimension of 20, it shows significant better performance than GA and BFO. At the level ofα=0.10, it is significant better than PSO, too. The settings of the new parameters are tested and discussed. Nsplit and Nadapt are recommend to be 30 and 5 or in the nearby range. The varying situations of population size are also tracked. With dimensions of 2 and 20, their varying plots show obvious regularities and correspond with the population survival phenomenon in natural. Overall, the proposed BFOLS algorithm is a powerful algorithm for optimization. It offers significant improvements over original BFO and shows competitive performances compared with other algorithms on higher-dimensional problems.Further research efforts could focus on the following aspects. First, other step length strategies can be used. Second, more benchmark functions with different dimensions could be tested.Pseudocode 1:Pseudocode of original BFO algorithm.
1Initialization
2For  i=1: Ned
3For  j=1: Nre
4For  k=1: Nc
5For  n=1: S
6Jlast=J(n)
7     Generate a tumble angle for bacteriumn;
8     Update the position of bacteriumn by (2.1);
9     Recalculate theJ(n)
10m=0
11While(m<Ns)
12 If  J(n)<Jlast
13  Jlast=J(n);
14  Run one more step using (2.1);
15  Recalculate the J(n);
16  m=m+1;
17 Else
18  m=Ns;
19 End if
20End while
21End for
22Update the best value achieved so far;
23End for
24Sort the population according to J;
25For  m=1: S/2
26 Bacterium (k+S/2) = Bacterium (k);
27End For
28End for
29Forl=1: S
30 If (rand<Pe)
31  Move Bacterium l to a random position
32 End if
33End for
34End forPseudocode 2:Pseudocode of BFOLS algorithm.
1Initialization
2While(termination conditions are not met)
3S= size of the last population; i=0;
4while  i<S
5i=i+1;
6Jlast=J(i)
7   Generate a tumble angle for bacteriumn;
8   Update the position of bacteriumn by (2.1);
9   Recalculate theJ(i)
10Update personal best and global best;
11m=0
12While(m<Ns)
13 If  J(i)<Jlast
14  Jlast=J(i)
15  Run one more step using (2.1);
16  Recalculate the J(i);
17  Update personal best and global best;
18  m=m+1;
19 Else
20  m=Ns;
21 End if
22End while
23If(Nutrition (i) is larger than split threshold value)
24 Split bacterium i into two bacteria;Break;
25End if
26If(Nutrition (i) is less than dead threshold value)
27 Remove it from the population;
28 i=i-1; S=S-1; Break;
29End if
30If(Nutrition (i) is less than 0 and rand<Pe )
31 Move bacterium i to a random position;
32End if
33End while
34End while



---

*Source: 409478-2012-11-14.xml*