Input: p(population quantity), M(iterations), dim(dimension), d(proportion of discoverers)

1. Define the objective function F(X), where the variable X = (X1, X2, …, Xn), the variable Xi = (x1, x2, …, xm)

2. Randomly initialize the positions of n sparrows X and define their relevant parameters

3. Use function F(X) to obtain the population fitness value matrix

4. for i ← 0 to M do

5. Sort the fitness value matrix from small to large to obtain a matrix named fit

6. R = min(fit)

7. if R < safety value then

8. for i ← 0 to p*d do

9. Update sparrow position using G r i d S e a r c h C V ( X i t , R ) in formula (3)

10. end for

11. else

12. for i ← 0 to p*d do

13. Update sparrow position using X i t + Q L in formula (3)

14. end for

15. for i ← 0 to p*(1-d) do

16. if (i + p*d) > p/2 then

17. Update sparrow position using X i t + I X w o r s t t X i t i 2 in formula (4)

18. else

19. Update sparrow position using X b e s t t + Q L in formula (4)

20. end for

21. θ ← 0.8

22. for i ← 0 to p do

23. if i >= θ*p then Update sparrow position using X i t + β ( f i f b e s t ) f w o r s t f b e s t ( X b e s t t X i t ) in formula (5)

24. end for

25. Update the global optimal fitness value and the individual optimal position of the population

26. end for

Outout:

BestX: location of global optimal fitness value

Convergence_Curve: global optimal fitness value for each iteration