Research Article
An Improved Sparrow Search Algorithm and Its Application in HIFU Sound Field
Algorithm 1
The improved sparrow search algorithm.
| Input: | | : the number of sparrows | | : the total number of iterations | | : the number of producers | | : the number of scouters | | : the safety value | | Output: | | : the optimal solution | | : the global optimal position | (1) | Using (5) and (6) to initialize a population of sparrows; | (2) | whiledo | (3) | Calculating the fitness value of individuals; | (4) | Ranking the fitness values and finding the current best and worst individual; | (5) | fordo | (6) | Using equations (7) and (11) to update the producers’ position; | (7) | end for | (8) | fordo | (9) | Using (2) or (12) to update the scroungers’ position; | (10) | end for | (11) | fordo | (12) | Using equation (3) to update the scouters’ position; | (13) | end for | (14) | fordo | (15) | if the new position is better than the previous position then | (16) | Using the new position to update the previous position; | (17) | end if | (18) | if the new position is better than the optimal position then | (19) | Using the new position to update the optimal position; | (20) | end if | (21) | end for | (22) | | (23) | end while | (24) | return, |
|