| Input:N (Population size), D (Dimension size), PNum (Producers size), SNum (Scouters size), ST |
| (Safety threshold), t (Initial iteration), tmax (Maximum iterations) |
| Output:Xbest (Global optimal position), Fbest (Fitness of global optimal position) |
| 1: /Initializing/ |
| 2: Randomly generate the positions of N sparrows Xi,j by homogeneous chaotic system |
| (i=1,2,…,N, j=1,2,…,D); |
| 3: Calculate the fitness of each sparrow Fi; |
| 4: Find Xbest and Fbest; |
| 5: /Iterating/ |
| 6: whilet < tmaxdo |
| 7: Sort the Fi and find global worst position Xworst; |
| 8: R2 = rand(1); |
| 9: fori = 1 : PNum |
| 10: Evaluate and calculate the adaptive weight w; |
| 11: Update the position Xi,j by (7); |
| 12: Check and adjust position that overstep the boundary by Algorithm 1; |
| 13: end for |
| 14: Sort the Fi and find the best position of producers Xp; |
| 15: fori = (PNum + 1) : N |
| 16: Update the position Xi,j by (2); |
| 17: Check and adjust position that overstep the boundary by Algorithm 1; |
| 18: end for |
| 19: fori = 1 : SNum |
| 20: Update the position Xi,j by (3); |
| 21: Check and adjust position that overstep the boundary by Algorithm 1; |
| 22: end for |
| 23: Evaluate and update Xbest and Fbest; |
| 24: t = t + 1; |
| 25: end while |
| 26: returnXbest and Fbest; |