Skip to main content
. 2019 Dec 13;19(24):5526. doi: 10.3390/s19245526
Algorithm 2: Firefly algorithm based NBSs selection
  1: Initialize populationnbs=(nbs1,nbs2,nbsi)T
  2: Perform the generation of initial firefly population, (1,2,…i)
  3: Calculate the light intensity I at nbsi using Equation (7) and obtain the Ibest.
  4: While t < MAXGeneration
  5: For every i
  6: For every j
  7: update fitness function and find light intensity.
  8: Fornf=1:Nflies
  9: Ifmax(Inf > Ibest) then
 10: Replace with updated firefly.
 11: Else Randomly change function and generate new intensity.
 12: End If
13: End For
 14: Determine the new solution using Equation (8) and update the light intensity.
 15: End For
 16: End For
 17: Make a ranking of the fireflies to locate the present best.
 18: End While