Skip to main content
. 2023 Jun 25;23(13):5881. doi: 10.3390/s23135881
Algorithm 6 FFA main steps
  • Define: Nv, D, f(x), γ, N

  • Generate firefly positions xi, i=(1,,Nv)

  • Compute emission light intensity Ii using f(xi);

  • t: = 1

  • while (tNGmax) and (solution not yet found) do

  •    for i: = 1,,Nv do

  •      for j: = 1,,Nv do

  •         if (Ij>Ii) then

  •           Move firefly i towards j

  •         end if

  •         Compute firefly perceived attraction

  •         Evaluate solution via f(x)

  •         Update light intensity

  •      end for

  •    end for

  •    Sort fireflies;

  •    t: = t + 1

  • end while

  • Return best solution