Skip to main content
. 2025 Aug 1;10(8):504. doi: 10.3390/biomimetics10080504
Algorithm 1 Pseudo-code of the BWSMA
Begin:
 //Initialization
  Initialize z, N, T, lb, ub;
  Initialize the population Xini by Equation (1)
 //Main loop
  While (t < T) do
   Calculate the fitness of X and obtain Xbest
   Calculate the C by Equation (13)//Best–worst management strategy
   Obtain index by sorting the population X according to fitness
   For i = 1: N do
    If index(i) < 0.3N then
     Update the position by Equation (11)//Best–worst management strategy
    Else if index(i) < 0.7N then
     Update positions by Equations (3) and (4)
    Else
     Update the position by Equation (12)//Best–worst management strategy
    End if
    End if
   End For
   Select the next population//Adaptive greedy mechanism
   Calculate the S by Equation (10)//Adaptive greedy mechanism
   For i = 1: N do
    Update positions by Equation (15)//Stagnant replacement mechanism
   End for
   t = t + 1
  End While
Return: the best fitness and Xbest