Skip to main content
. 2021 Jul 8;23(7):874. doi: 10.3390/e23070874
Algorithm 6 FA
  • Input: the parameters M, N, δ, I0, β0 and step

  • Begin

  • S1: initialize M individuals xi(t) randomly, 0<i≤M, iterative times t = 1;

  • S2: compute f(i),0<i≤M, if t > 1 and the new position is better than the old one, update xi(t) and pg(t); if it satisfies (t > N or precision ≤δ), then go to step S4; otherwise, go to step S3;

  • S3: for the ith firefly xi(t), FA searches another firefly (suppose the jth firefly xj(t), and i≠j) in the population that has the luminance calculated with Equation (14). If the luminance of xj(t) is larger than that of xi(t), xi(t) moves toward xj(t) by Equation (17), iterative times t = t + 1; go to step S2;

  • S4: output the optimized results.

  • End