Skip to main content
. 2021 Feb 9;21(4):1224. doi: 10.3390/s21041224
Algorithm 1 The framework of CASSA
/*Initialization*/
1. Set the maximum iterations as Tmax;
2. Set the number of finders as Fd;
3. Set the number of threatened sparrows as Sd;
4. Set the alarm value as G;
5. Set the number of sparrows as n;
6. Initialize the position of n sparrows using Equation (5);
/*Iterative search*/
7. while (t<Tmax)
8. Rank the fitness values and find the best individual and the worst individual currently;
9.  G=rand(1);
10. for i=1:Fd
11.   Update the finder’s position using Equation (7);
12. end for
13. for i=(Fd+1):n
14.   Update the entrant’s position using Equation (3);
15. end for
16. for i=1:Sd
17.   Update the threatened sparrow’s position using Equation (4);
18. end for
19. Select the top S elite individuals and implement adaptive mutation for them by Equation (9);
20. Get the current new position;
21. If the new position is better than before, update it;
22. t=t+1;
23. end while
24. Output the best solution