Bacterial Foraging Algorithm With Potential Field Guidance Mechanism

To address the problems of weak quorum sensing ability and slow convergence speed in bacterial foraging algorithm, a bacterial foraging algorithm with potential field guidance mechanism is proposed. The algorithm combines the sampling guidance mechanism in the artificial potential field algorithm to provide the optimization direction for each bacterium; The original swimming operation of bacterial foraging algorithm is used to realize the local optimization strategy, and the local dimension update is added after swimming, so that the search range of bacteria in chemotaxis operation is wider; In the elimination and dispersal operation of bacterial foraging algorithm, double Gaussian function is introduced to re initialize the location of bacteria, so as to better avoid the algorithm falling into local extremum and improve the optimization ability of the algorithm. The experimental results show that the improved bacterial foraging algorithm has better optimization ability than the basic bacterial foraging algorithm.


Introduction
Bacterial foraging optimization algorithm (BFO) is a bionic group algorithm [1] that mimics the drug-tending motility of E. coli and has been widely used in the fields of proportional-integral-differential controller (PID) parameter tuning, pattern recognition, image processing, etc. The algorithm has been widely used in the fields of proportionalintegral-differential controller (PID), parameter tuning, pattern recognition, and image processing. The algorithm is simple to construct, easy to implement, parallel in search, and easy to jump out of local extremes, thus attracting the interest of many researchers. In the convergence operation of the bacterial foraging algorithm, individuals search blindly throughout the optimal search space without any orientation because the direction of each bacterial swim is randomly generated. Simulation experiments by Tang et al. [2]proved that the population sensing mechanism of the BFO interferes with the convergence of the bacterial foraging algorithm, and Chu Y [3] found through extensive experimental tests that when there are more individuals in the population distributed around the local extrema, the individuals who have already found the global optimal solution will also fall into the local optimum due to the effect of the group induction mechanism, which also causes the bacterial foraging algorithm to fail to converge quickly to obtain the global optimal solution of the function when solving high-dimensional problems or complex functions. The elimination and dispersal operation just helps the algorithm to jump out of the global optimum by re-initializing the position of bacterial individuals, and this approach may cause the re-initialized bacteria to remain in the vicinity of the local optimum solution, which cannot achieve the desired effect.
To address the above problem, many scholars have proposed solutions. Mishra et al. [4] have proposed a solution in a fuzzy bacterial foraging algorithm (Fuzzy bacterial foraging (FBF), and then, many scholars have studied the step size in bacterial foraging algorithm. Niu et al. [5] proposed nonlinearly decreasing and exponentially nonlinearly decreasing step sizes by verifying the effect of step size on global convergence. Tan et al. [6] calculated the current bacterial convergence step size based on the current optimal position of bacteria, the historical optimal position and the average position of all bacteria in the population. Zhen L et al. [7] proposed in an improved bacterial foraging optimization algorithm based on nonlinearly decreasing cosine adaptive step size. To further improve the performance of the algorithm, scholars started to combine the basic bacterial foraging algorithm with other metaheuristics to propose a hybrid bacterial foraging algorithm. Zhou W H et al. [8] combined the bacterial foraging algorithm with particle swarm algorithm and proposed variable probability hybrid bacterial foraging optimization algorithm. Liu et al. [9] introduced the idea of clonal selection in immune algorithm to bacterial foraging algorithm, and Du et al. [10] designed a convergence method of employed bees based on artificial bee swarm algorithm. In order to improve the global optimization capability of the algorithm, Zhang et al. [11]introduced the quantum potential energy trap in quantum mechanics into the bacterial foraging algorithm to improve the optimization capability of the bacterial foraging algorithm to a certain extent; Liu et al. [12]designed a nonlinear dynamic adaptive rotation angle to continue to improve the convergence operation in the quantum bacterial foraging algorithm to further improve the convergence speed of the algorithm. From the existing literature on bacterial foraging algorithms, it can be seen that most of the improvement schemes are limited to the improvement of the step length of the algorithm, without considering the influence of the relationship between individual bacteria in the whole population on the optimization process. Although the quantum bacterial foraging algorithm has improved its solving performance compared with the basic bacterial foraging algorithm, the solving ability of the algorithm becomes weaker as the number of dimensions increases.
In this paper, we propose a bacterial foraging optimization algorithm with potential field guidance mechanism (PBFO), which calculates the acting force between bacteria with the help of the guidance mechanism in the artificial potential field algorithm, and gives the determined swimming direction of bacteria in the convergence operation according to the gravitational relationship between bacteria. After the bacteria finish swimming, the local dimension update operation is designed to update the bacteria after the swimming, so that the bacteria can maintain a better merit-seeking ability even after the dimension increase. A double Gaussian function is introduced in the elimination and dispersal operation to reinitialize individual positions to further strengthen the diversity of the population. Finally, the performance of PBFO is tested by the benchmark function, and the test results are compared with Particle swarm optimization (PSO), Gravitational search algorithm (GSA), PBFO derivative algorithm and other improved algorithms, and the experimental results The experimental results show that PBFO can obtain better optimal solutions and has a faster convergence speed.

2.Related works
2.1 Basic bacterial foraging optimization algorithm BFO consists of three principal parts: 1) chemotaxis, 2) reproduction, and 3) elimination and dispersal [13], and a brief introduction of each part is given as follows 2.1.1 Chemotaxis In biology, the chemotaxis is a process of bacteria movement for gaining the nutrient. One of the E-coli bacterium properties is that, it can move in two diverse ways, swimming and tumbling. In swimming, the bacterium swims in the same direction to search for nutrient, and in tumbling, bacterium changes the direction to another direction. Assume ( , , ) i P j k l shows the current position of i th bacterium, j th chemotaxis step, k th reproduction step, and elimination and dispersal step, then the position of bacterium in the next chemotaxis step by tumbling will be as: where, ( ) Ci shows the number of steps, () i  represents the direction of bacterial chemotaxis direction that is specified by the tumbling of i th bacterium and Δ indicates a vector of random directions in population size with continuous values between [-1, 1].

Reproduction
In the reproduction part, those bacteria that have enough nutrient will be reproduced and others will be eliminated. To do so, a health status of each bacterium is calculated. The health status is the sum of step fitness during its life and can be defined as: 1 ( , , , ) where, Nc is total number of chemotaxis steps, and Jhealth is calculated for i th bacterium, j th chemotaxis step, k th reproduction step, and l th elimination and dispersal step. Eventually, the health status of all bacteria will be sorted in ascending order and the first half of the bacteria reproduce and surrogate into second half of the bacteria based on their top health status. In other words, the smaller Jhealth values related to healthier bacteria. Thus, bacteria with smaller health values have more chance to survive. This process not only keeps the population constant, but also the healthier bacteria continue to next generation.

Elimination and dispersal
When the density of bacteria getting high in a small area, the temperature of this area getting high and may not be enough nutrient for all bacteria as well. Thus, in this part, the population of bacteria may randomly change their positions to avoid these flaws. Elimination and dispersal event relocates the bacteria in different environments to avoid the bacteria death and local optimum solution(s). In this operation, a random number rand is generated for each bacterial individual. If the value of the bacteria is less than the elimination and dispersal threshold Ped, the bacterium is migrated, and the random initialization position is re-randomized in the entire solution space. The algorithm flow is shown in Figure 1.

Artificial potential field method
The artificial potential field method (APF) [14] was proposed by Oussama Khatib and was first applied to mobile robot path planning. The algorithm introduces the concept of a generalized potential field and constructs an artificial abstract potential field. The target point region generates a gravitational potential field and the obstacles generate a repulsive potential field. The artificial potential field is generally described by an electrostatic field model, which is illustrated in Figure2. Positive and negative charges produce an electric field, which produces repulsive forces on homogeneous charges and gravitational forces on heterogeneous charges. The charge is subjected to the superposition of the electric field, the motion occurs to produce current. In analogy to the electrostatic field, the artificial potential field is a virtual field generated and superimposed by the target and the obstacle respectively, and its potential field exerts a gravitational repulsive effect on the robot. After the robot is subjected to the potential field, it starts to move to generate a planned path.
An electric charge is subjected to an electric field force in an electric field. If more than one charge acts at the same time, follow the rules of vector operation to calculate the magnitude and direction of the electric field force. Analogously to the electric field force, the target area and the obstacle will also generate potential field force in the potential field. The negative gradient direction is the direction where the function value decreases fastest. The gravitational force generated by the gravitational potential field on the robot is defined as the negative gradient of the gravitational potential field, and the repulsive force generated by the repulsive potential field on the robot is the negative gradient of the repulsive potential field. The robot follows the rules of vector operation to calculate the magnitude and direction of the force on the potential field. The target area is represented as the gravitational force on the robot, and the obstacle is represented as the repulsive force on the robot. The repulsive force generated by the obstacles and the gravitational force generated by the target location are superimposed, and their combined force is the total force on the robot in the artificial potential field. Under the force of the potential field, the robot moves to produce a planned path.  The force analysis of a robot in an artificial potential field is shown in Figure3. The artificial potential field method creates a potential field in the robot's motion space. The repulsive force of the target on the robot is monotonically decreasing as the distance between the robot and the obstacle increases, and the attractive force of the target on the robot is monotonically increasing as the distance from the target increases. At the location, the robot is subjected to the attractive potential field and moves toward the target area, while it is subjected to the repulsive potential field generated in the obstacle space and moves away from the obstacle. Finally, the robot moves in the direction of the combined force.
where, a U denotes the gravitational field, g  3. Bacterial foraging algorithm with potential field guidance mechanism

Improvement of Chemotaxis operation
The basic bacterial foraging algorithm updates the position by the swimming of bacteria, randomly initializes the swimming direction of bacteria to search the whole solution space, and if the adaptation is better in the swimming direction, the bacteria continue to swim in that direction until they swim to the maximum number of steps; otherwise the bacteria rotate in the same place. By this search strategy makes the bacterial foraging algorithm have a strong local search ability. However, randomly generating the direction of bacterial swimming will definitely lead to a higher number of swims for the whole algorithm to obtain a better solution, which slows down the convergence speed of the algorithm.
In order to accelerate the convergence speed of the bacterial foraging algorithm, the potential field guidance mechanism in the artificial potential field algorithm is introduced in this paper. The attraction force between bacteria and the acceleration generated between them are calculated, and the direction of the generated acceleration is used to replace the random direction of the individual bacteria during the swimming process. Under the effect of the attractive force, bacteria move toward the individual with higher inertial mass, and the bacteria with higher inertial mass occupy the position with better fitness. The attraction between individuals is used to share the better adapted position of bacteria, and the local optimization is performed according to the original swimming operation of the bacterial foraging algorithm. This operation accelerates the convergence speed of the algorithm without destroying the local mining ability of the original algorithm.
The movement of individual bacteria in the search space in the bacterial foraging algorithm with a potential field guidance mechanism and the basic bacterial foraging algorithm is illustrated by the process of the bacterial foraging algorithm and the gravitational bacterial foraging algorithm for the function finding. From Fig.4, it can be seen that in the absence of the potential field guidance mechanism, bacteria B2 are in a random wandering state. In Fig.5, since the direction of better adaptation can be transmitted by the attraction between individuals, bacteria B2, after being influenced by the attraction of bacteria B4 and repulse force derived from B1 and B3 in the population (the red line in Fig.5 indicates the combined direction of attraction of bacteria B2 by other bacteria), has a tendency to move in the direction of the current position of the optimal individual B4 in the population. The specific improvement process of the convergence operation is given. The size of the bacterial population is N and each bacterium has a D-dimensional space for finding the optimum. The tendency is to move towards the position of the former population optimum individual B4. The specific improvement process of the convergence operation is given. The size of the bacterial population is N, and each bacterium has a Ddimensional optimization space. The initial position of the bacteria is ( , , ) d i P j k l , which is the position of the bacteria i after j th chemotaxis, k th reproduction and l th elimination and dispersal, and the current fitness of the bacteria can be calculated as 1 2 ( , , ) ( ( , , ), ( , , ), , ( , , )) The definition of acting force ( , , )  ( , , ) ( , , ) A simpler acceleration can be obtained by combining Equations. (15) to (17)  ( 1, , ) ( , , ) )

Local dimension update
By using potential field guidance in the bacterial foraging algorithm, the overall swimming trend of the bacterial population starts to move toward the optimal solution. However, as the number of iterations increases, the diversity of the bacterial population keeps decreasing, and the gravitational interaction between bacteria will only be influenced by the optimal bacterial individuals in the population, and thus the algorithm tends to fall into the local optimum. When solving the high-dimensional multi-peak function, some dimensions will move toward the optimal solution in the process of moving the population toward the optimal solution, but some dimensions will move in the opposite direction, which is called "two steps forward, one step back" [15], which also makes some high-dimensional multi-peak functions difficult to optimize. In order not to completely destroy the optimal solution obtained by the potential field guidance mechanism search and to consider the phenomenon of "two steps forward, one step back" in the optimization of high-dimensional multi-peak functions, we perform a local dimensional update of the current bacteria after they have swum. The update process is as follows: (1) Randomly select the M th dimension on the current bacteria as the starting position for the local dimension update, in order to ensure that the dimension length of the local update is L, the starting point P should satisfy M≤D-L+1. (2) Replace the original position vector P(j,k,l) of bacteria i from dimension P to P+L-1 with the dimension value of the corresponding position of the vector Pbest(j,k,l)-Pworst(j,k,l), where Pbest(j,k,l) is the position of the best adapted bacteria in the current population, and Pworst(j,k,l) is the position of the worst adapted bacteria in the current population. Pnew(j,k,l) is the new position vector. (3) If the newly generated Pnew(j,k,l) has a better fitness value than P (j,k,l), then Pnew(j,k,l) is used to replace P(j,k,l), otherwise, the bacterial position P(j,k,l) of i is maintained unchanged.

Improvement of elimination and dispersal operation
In order to maintain the diversity of the population and help individuals jump out of the local optimal value, the bacterial foraging algorithm randomly assigns an elimination and dispersal probability Rand to each bacterium, and sets the elimination and dispersal threshold as Ped. When the elimination and dispersal probability rand of a bacterium in the population is less than the elimination and dispersal threshold, it is considered that the bacterium has died, need to reinitialize the location of the currently dead bacteria in the optimization space. However, this elimination and dispersal method may not make the individual near the local optimal solution jump out of the local extreme value. Random initialization also has a certain probability, resulting in the initialization solution near its original position, which is not conducive to the increase of bacterial population diversity. In order to avoid this phenomenon, this paper introduces the double Gaussian function to make the newly generated bacterial position value better and set it away from the original position [16][17]. Take the bacterial individual P to undergo elimination and dispersal operation as an example to illustrate the difference between the initialization of double Gaussian function and random initialization of bacterial position. The original position of point P is p(1,1) and the Elimination and dispersal range is [-8,8].
Observe the difference between the position after 100 times of random elimination and dispersal. In Figure 6, the red circle represents the point P to be migrated, the blue triangle represents the individual position of bacteria after random migration, and the green asterisk represents the individual position of bacteria after migration by using double Gaussian function. It can be seen that there are very few individuals near the original bacterial P position, and most bacterial positions are far away from bacterial P; With random initialization, bacteria are distributed in the whole solution space, and many individuals are initialized not far from the bacterial P position, which is not conducive to the increase of population diversity. Using double Gaussian function to complete the elimination and dispersal operation, the population has higher diversity and can enhance the global optimization ability of the algorithm.
The newly generated bacterial location formula is shown in Equation (20)

The process of proposed algorithm
The process of PBFO algorithm is as follows: Step 1: Initialize the population and set the parameters: chemotaxis time Nc, chemotaxis swimming step Ns, reproduction time Nre, elimination and dispersal time Ned, the probability of elimination Ped, population size N, local dimension update length L; Step 2: Adjust bacterial step size and choose a guided direction by formula (18); Step 3: Move one step on the selected direction by formula (19) and calculate the new fitness value by benchmark function; Step 4: Determine whether to continue chemotaxis. If the fitness value of new location is smaller that of initial location, turn back to Step 2 until the algorithm reaches the number of flipping or the fitness value cannot change. If the original value is smaller than the fitness value of new location, go to the next step; Step 5: Local dimension update operations according to the description of Section 3.2; Step 6: Choose half bacteria to reproduce and kill unselected bacteria; Step 7: Adjust the possibility of elimination and dispersal Ped by fitness value and produce a random number. If the random number is less than adjusted probability Ped, bacterium goes to Step 8. Otherwise, bacterium goes to Step 9; Step 8: Bacterial i Re-initialize its position according to the formula (20) in Section 3.3.
Step 9: Turn back to Step 1 until the algorithm reaches the number of iteration or get the optimal value. Therefore, the PBFO Algorithm flow chart is showed in Tab.1, which is depicted by the pseudo code.
Tab.1 The pseudo code of PBFO algorithm PBFO Algorithm 1 Initialization parameters: N, Nr NC, Ned, Ns, Ped, L 2 for l = 1: Ned//Elimination and dispersal cycle start 3 for k = 1: Nre // Reproduction cycle start 4 for J = 1: Nc // Chemotaxis cycle start 5 Calculate the adaptation of bacteria in the current population 6 The acceleration of each bacterium is calculated from the formula (18) in 3.1. 7 for i = 1: N 8 Keep bacteria's adaptivity value Jlast 9 Update the location of bacteria i by formula (19)  In this paper, 10 standard functions are selected to test the PBFO algorithm, and the test results are compared with the standard bacterial foraging algorithm (BFO), the standard particle swarm algorithm (PSO), the gravitational search algorithm (GSA) and some recently proposed improved intelligent algorithms including LAQBFO, QBFO, NAQBFO, and APSO-IV. The experimental data of LAQBFO, QBFO and NAQBFO experimental data are from the literature [12] and APSO-IV experimental data are from the literature [8].
The dimensions of these 10 test functions are all set to 30 dimensions and all of the optimal values are 0, as shown in Table 2. All simulation experiments were performed on a machine with windows10, Intel Core i7 CPU, main frequency 1.6 GHZ, and the software used for the experiments was Matlab2016a.
For the standard BFO and PBFO algorithm, the main parameters are set as follows: number of bacteria N=50, Number of elimination and dispersal Ned=4, number of reproduction Nre=3, number of chemotaxis Nc=100, number of swims m=5, probability of elimination and dispersal Ped=0.25, swim step C=0.01(ub-lb), where ub denotes the upper bound of the dimension of the optimization function, lb denotes the lower bound of the dimension of the optimization function, and for The PBFO algorithm also requires a separate local dimensional update parameter The value of L is set as follows: L=3. For the gravitational search algorithm, the parameters are set as follows: number of population particles N=50, parameter G=100,  =20, iter_max=1200. For the particle swarm algorithm, the parameters are set as follows: number of particles N=50, learning factor c1=2, c2=2, weight factor w1=0.9, w2=0.1, iter_max=1200.

Experimental results
The results in Tab.2 to Tab.4 are the best values obtained after the algorithm runs 30 times, the values in parentheses are the average of the results of 30 experiments for each benchmark function.
From the experimental results in Table 3, we can see that the PBFO algorithm on the 10 benchmark functions is basically close to the global optimal solution of the objective function. In terms of convergence accuracy, the convergence accuracy of the PBFO algorithm is significantly higher than that of the base BFO for all benchmark functions. Contrast the PSO algorithm, although the convergence accuracy is weak in the functionality F1, F2, F7, F9, the PBFO algorithm is solved on other functions, especially in F3, F8, F10 function, which is significantly better than PSO. Compared with the gravitational search algorithm (GSA), which only solves the F1, F8, and F10 functions, the accuracy of PBFO is significantly better than that of PSO. Compared with gravity search algorithm (GSA), GSA is only better than PBFO in the optimization results of F1, F2, F4 and F9 functions, and PBFO algorithm is ahead of GSA in solving other functions; Moreover, GSA algorithm can't optimize F3 and F10 functions, but PBFO algorithm obtains better results in optimizing the above two functions. Compared with LAQBFO, QBFO, NAQBFO and APSO-IV algorithms, PBFO is lower than APSO-IV only in the solution accuracy of F4 function. In other functions, PBFO algorithm has higher optimization accuracy Tab. 3 Comparison of PBFO algorithm, basic algorithm and LAQBFO, QBFO, NAQBFO, APSO-IV algorithm Tab. 4 Comparison of PBFO and derivative algorithm than these four improved intelligent algorithms.
To further validate the performance of the improved algorithm, the dimensionality of the test function in Table 1 is increased to 100 dimensions to test the performance of PBFO algorithm on high-dimensional functions and compare the experimental results with the performance of the basic BFO, ABC, CSO, HJCSO, BAABC, and SGHS algorithms. The experimental results of the ABC algorithm were obtained from the literature [18], CSO and HJCSO algorithms are from the literature [19], BAABC algorithm is from the literature [20], SGHS algorithm is from the literature [21]. The basic BFO algorithm and the parameter settings of PBFO algorithm are the same as those in this paper when solving 30dimensional functions except the number of elimination and dispersal operations is increased to Ned=10.
The experimental results are shown in Tab.5. From the experimental results, it can be seen that PBFO solves 100-dimensional functions, tested on 9 functions. Only for the F7 function, the results are worse than HJCSO and BAABC, and the results of the other functions are better than the remaining 6 comparison algorithms. In order to test the effectiveness of different improvement strategies in combination with the basic BFO and its derived 2 algorithms, PBFO_1 and PBFO_2, are compared in this paper. PBFO_1 is the basic BFO that introduces only the improved strategy in Section 3.1, and PBFO_2 introduces only the improved strategy in Section 3.2. The parameters of both algorithms are set as above.
Comparing the basic BFO with PBFO_1, tested in function F1, F2 and F4, the fitness value of the PBFO_1 algorithm is ahead of that of the BFO, which is PBFO_1 transmits the information about the optimal position of bacteria in the population through the potential field guidance mechanism, which makes the whole population maintain the tendency to move toward the current optimal solution. In contrast, there is no potential field guidance mechanism in BFO, and in its Chemotaxis operation, random swimming is performed, making many swimming steps are invalid. In the test of functions F5 to F10, the optimal solution in F7, F9, and F10 is superior to PBFO_1, which is due to the local extrema in the high-dimensional multi-peak function. There are more value points, resulting in the dispersion of the solution, and the joint force derived in a gravitational way. The direction of attractive force deviates too much from the direction of the global optimal solution, which makes the attractive direction interferes with the movement of the bacteria toward the global optimal solution instead. The data of standard BFO were compared with PBFO_2, and the gravitational direction of the highdimensional single-peak function F1~F4 was found to be too far from the global optimal solution. The solution of the high-dimensional single-peak functions F1 to F4 shows that the bacterial foraging algorithm, which only use local dimensional updates, has an improved ability to find the optimal solution of the function, but the effect is not very obvious. However, in the high dimensional multipeaked functions, it can be seen from Table 3 that solving the functions F8~F10, the improvement effect is very obvious, and all of them have at least one order of magnitude in solution accuracy. The PBFO algorithm is obtained by combining the improvement strategies in Sections 3.1 and 3.2, and it can be seen from Tab.4 that PBFO obtains significantly better results than BFO.

Convergence speed analysis
To demonstrate that the PBFO algorithm converges faster than that of the classical bacterial foraging algorithm, the convergence plots of BFO and PABFO on all functions are made in this paper, as shown in Fig.7 to Fig.16. Comparing the convergence effect of the two algorithms for solving the benchmark functions, it is obvious that the convergence speed of PBFO is significantly faster than that of the standard BFO, which is mainly due to the potential field guidance mechanism in the PBFO algorithm that conveys the information of the optimal solution in the population. The convergence plots of functions F2, F4, F8, F9, F10 show that PBFO has a much higher convergence accuracy than the basic BFO, and is able to continue to explore the global optimal solution when the BFO has already converged, and the algorithm has an extremely strong mining ability. In all convergence plots, there are spikes appearing, which are due to the fact that when migrating, some individuals due to migrating and resulting in a decrease in the average fitness value of the population. The average fitness of the population was able to continue to decrease and outperform the population after the spikes were generated by using the double Gaussian function to complete the elimination and dispersal operation. After the spikes were generated, the average fitness of the population was able to decrease consistently and better than that before the elimination and dispersal operation, indicating that the double Gaussian function approach effectively increased the population diversity and enabled the population to perform better for global search.

5.Conclusion
In this paper, by improving the basic BFO algorithm, we propose the PBFO algorithm. These improvements accelerate the convergence speed and improve the convergence accuracy of the bacterial foraging algorithm to a certain extent, and achieve better results in some multi-peak functions where optimization is difficult. The PBFO algorithm has better generalizability, but the accuracy of solving some special benchmark functions still needs to be improved. The main research point in the future is to further improve the accuracy of the algorithm on the benchmark functions and to apply the PBFO algorithm to more scenarios. The main research point is to further improve the accuracy of the algorithm on the benchmark functions and to apply the PBFO algorithm to more scenarios.