Skip to main content
. 2022 Apr 8;24(4):525. doi: 10.3390/e24040525
Algorithm 1. The pseudo-code of HFBOA
Generate the initialize population of the butterflies Xi(i=1,2,,n) randomly;
Initialize the parameters β0,γ, and μ
Define sensory modality c, power exponent a and switch probability p
   for i=1:n
      Calculate the fitness value of each butterflies
   end for
   while t<Tmax
   for i=1:n
      Update the fragrance of current search agent by Equation (6)
   for j=1:n
   if fitnessi<fitnessj
      Update the attractiveness β and Rij by Equation (9) and Equation (10) respectively
   else
      Continue
   end if
% Case1
   if rand<sp
      Update the position using Equation (7)
   else
      Update the position using Equation (8)
   end if
% Case2
   if rand<sp
      Update the position using Equation (3)
   else
      Update the position using Equation (8)
   end if
      Calculate the fitness value of each butterflies
      Find the best fitness Fi
   end for
   end for
      Update the value of power exponent c and parameter α using Equations (11) and (12)
      t=t+1
   end while
Output the best fitness