Skip to main content
. 2022 Dec 3;15(23):8630. doi: 10.3390/ma15238630
Algorithm 1 the firefly algorithm
Initialize the parameters(α, β, γ, n)
Initialize randomly a population of n fireflies
   Evaluate the fitness of the initial population at xi by       objective function
        While (k < MaxGen) do
           For i =1:n
              For j = 1:n
                 If Firefly j is better than i
                       Firefly i moves towards j
                 End if
              End for
              Evaluate the new solution
           End for
           Rank and update the best solution found so far
           Update iteration counter k;
           Update α
        End while