Function Optimization Algorithm Based on Black Widow Optimization Algorithm

1. Theoretical basis

1. Black Widow Optimization Algorithm

The Black Widow Optimization Algorithm (BWO) was proposed by Hayyolalam et al. in 2020, inspired by the unique mating behavior of black widow spiders, which simulates the life cycle of black widow spiders.
Each solution (potential solution) of BWO is a black widow spider whose length is equal to the dimension of the search space. BWO includes 5 stages including initial population, reproduction, cannibalism, mutation, and updating population. In addition to the initial population stage, the other 4 stages need to be iterated until the end conditions are met, and the black widow with the best fitness is returned.

1.1 Initialize the population

In BWO, a solution to the problem to be solved is a black widow spider, which can be regarded as a one-dimensional array: Widow = [ x 1 , x 2 , ⋯ , x N var ] (1) \text{Widow }=[x_1,x_2,\cdots,x_{\text{N}_\text{var}}]\tag{1}Widow=[x1,x2,,xNvar]( 1 ) where,N var \text{N}_\text{var}Nvaris the optimized dimension. When initialized, the value of each dimension is a random floating-point number. Each black widow has a fitness, and a fitness function is used to calculate the fitness of the black widow: Fitness = f ( widow ) = f ( x 1 , x 2 , ⋯ , x N var ) (2) \text{Fitness }=f(\text{widow})=f(x_1,x_2,\cdots,x_{\text{N}_\text{var}})\tag{2}Fitness=f(widow)=f(x1,x2,,xNvar)( 2 ) When initializing the population, it is necessary to generateN pop \text{N}_\text{pop}Npop(population size) black widow, get a N pop × N var \text{N}_\text{pop}\times\text{N}_\text{var}Npop×NvarBlack Widow Matrix.

1.2 Reproduction

The reproductive phase is the global search phase. First, the population is sorted according to the fitness, and the reproductive black widows in the population are calculated based on the procreating rate (PP), and then a pair of parents (male and female black widows) are randomly selected for mating and reproduction. In nature, each pair of black widows reproduces on its own spider web, separate from other black widows, producing about 1,000 eggs at a time, but only the smaller spiders with better fitness survive. In the black widow algorithm, each pair of parents uses α \alphaThe alpha array simulates the reproductive process: { y 1 = α × x 1 + ( 1 − α ) × x 2 y 2 = α × x 2 + ( 1 − α ) × x 1 (3) \begin{dcases}y_1=\ alpha\times x_1+(1-\alpha) \times x_2\\[2ex]y_2=\alpha\times x_2+(1-\alpha)\times x_1\end{dcases}\tag{3}and1=a×x1+(1a )×x2and2=a×x2+(1a )×x1( 3 ) where,x 1 x_1x1and x 2 x_2x2for parents, y 1 y_1and1y 2 y_2and2are descendants. This process is repeated for N var / 2 \text{N}_{\text{var}}/2Nvar/ 2 times.

1.3 Cannibalism

Cannibalism is when a well-fitted spider eats a poorly fit spider. Cannibalism of black widow spiders is divided into three types: sexual cannibalism, sibling cannibalism, and cannibalism. Sexual cannibalism means that female black widows will eat male black widows during or after mating. Males and females can be distinguished according to their fitness. Females with good fitness are females and males with poor fitness. Cannibalism occurs in siblings. On the mother spider web, the young spiders will live on the mother spider web for about a week after hatching, during which cannibalism of siblings will occur; cannibalism of offspring and mother spiders refers to the event that small spiders eat the mother spider under certain circumstances. In the Black Widow algorithm, sexual cannibalism and sibling cannibalism are simulated, and cannibalism is not involved yet. Sexual cannibalism is achieved by destroying the father, and sibling cannibalism is achieved by destroying a portion of the children according to the cannibalism rate (CR). Use fitness values ​​to determine the strength of the spiderlings.

1.4 Mutation

The mutation stage is the local search stage. The black widow algorithm randomly selects multiple black widows at this stage according to the mutation rate (PM), and each black widow randomly swaps two values ​​in the array.

1.5 Update the population

After one iteration, the black widow retained in the cannibalistic stage and the black widow obtained in the mutation stage are used as the initial population for the next iteration.

1.6 Stop Conditions

Three stopping conditions can be considered: the maximum number of iterations is set in advance; the best black widow is no longer changing; a preset level of accuracy is reached.

2. BWO algorithm pseudo code

The pseudo code of the BWO algorithm is shown in Figure 1.
insert image description here

Figure 1 Pseudo code of BWO algorithm

2. Simulation experiment and result analysis

Comparing BWO with PSO and ABC, the population size of the experiment is set to 30, the maximum number of iterations is 500, and each algorithm runs 30 times independently. Take F10, F11 (multimodal function/30-dimension), F18, F19 (fixed-dimension multimodal function/2-dimension, 3-dimension) as examples, the results are as follows:
insert image description hereinsert image description hereinsert image description hereinsert image description hereinsert image description hereinsert image description here

函数:F1
BWO:最差值: 0.00030359,最优值:5.2836e-17,平均值:2.8869e-05,标准差:7.3847e-05,秩和检验:1
PSO:最差值: 209.5923,最优值:50.3202,平均值:129.6523,标准差:43.5,秩和检验:3.0199e-11
ABC:最差值: 281.5418,最优值:0.014307,平均值:48.1786,标准差:62.0608,秩和检验:3.0199e-11
函数:F2
BWO:最差值: 0.0007229,最优值:1.0132e-10,平均值:9.2838e-05,标准差:0.00017549,秩和检验:1
PSO:最差值: 19.0667,最优值:5.9133,平均值:11.3296,标准差:3.3324,秩和检验:3.0199e-11
ABC:最差值: 150645.9013,最优值:109.854,平均值:28880.8751,标准差:40205.5077,秩和检验:3.0199e-11
函数:F10
BWO:最差值: 0.031705,最优值:5.0997e-09,平均值:0.0015844,标准差:0.0057894,秩和检验:1
PSO:最差值: 7.7718,最优值:3.682,平均值:5.8866,标准差:0.9542,秩和检验:3.0199e-11
ABC:最差值: 9.5322,最优值:0.057288,平均值:4.5495,标准差:2.0996,秩和检验:3.0199e-11
函数:F11
BWO:最差值: 0.52167,最优值:6.1541e-09,平均值:0.1289,标准差:0.17456,秩和检验:1
PSO:最差值: 3.0966,最优值:1.4632,平均值:2.1382,标准差:0.42955,秩和检验:3.0199e-11
ABC:最差值: 2.5162,最优值:0.24441,平均值:1.3038,标准差:0.60401,秩和检验:2.6099e-10
函数:F18
BWO:最差值: 23.1364,最优值:3,平均值:4.1975,标准差:3.86,秩和检验:1
PSO:最差值: 3,最优值:3,平均值:3,标准差:2.7843e-15,秩和检验:2.5749e-06
ABC:最差值: 4.3362,最优值:3.0118,平均值:3.2193,标准差:0.2827,秩和检验:0.07243
函数:F19
BWO:最差值: -3.7643,最优值:-3.8622,平均值:-3.839,标准差:0.024764,秩和检验:1
PSO:最差值: -3.8628,最优值:-3.8628,平均值:-3.8628,标准差:2.3456e-15,秩和检验:1.0598e-11
ABC:最差值: -3.8622,最优值:-3.8628,平均值:-3.8626,标准差:0.00013392,秩和检验:3.0199e-11

The experimental results show that the BWO algorithm has high precision and fast convergence in finding the global optimal solution.

3. References

[1] Vahideh Hayyolalam, Ali Asghar Pourhaji Kazem. Black Widow Optimization Algorithm: A novel meta-heuristic approach for solving engineering optimization problems [J]. Engineering Applications of Artificial Intelligence, 2020, 87: 103249.
[2] Li Zhiqin, Du Jianqiang, Nie Bin, et al. Research on Feature Selection Method Based on Black Widow Algorithm [J/OL]. Computer Engineering and Applications: 1-14 [2022-03-20].

Guess you like

Origin blog.csdn.net/weixin_43821559/article/details/123620426