Skip to main content
. 2023 Jun 25;23(13):5881. doi: 10.3390/s23135881
Algorithm 7 FWA main steps
  • Define: Nf, a, b, m, ξ, f(x), T

  • Select randomically Nf sites for fireworks detonation;

  • t: = 1

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

  •    Detonate the Nf fireworks in the selected locations with si=m·ξ+yworstf(xi)ξ+i=1n(yworstf(xi)) sparks each

  •    for i: = 1,,Nf do

  •      if si<a·m, then

  •         Compute s^i=a·m

  •      else if si>b·m, a<b<1,

  •         Compute s^i=b·m

  •      else

  •         Compute s^i=si

  •      end if

  •      Yield location of s^i sparks xi using the 5 steps:

  •        Initiate a spark location x^j=xi

  •        Compute z=d·r

  •        Choose randomically z dimensions of x^j

  •        Compute displacement h=Ai·r

  •        for each dimension x^kjz do

  •               x^kj=x^kj+h

  •               if (x^kj<x^kmelhor) or (x^kj>x^kpior) then

  •                        x^kj=x^kbest+|x^kj| % (x^kworstx^kbest)

  •               end if

  •        end for

  •      end for

  •      for k: = 1,,m^ do

  •         Select randomically firework xj.

  •         Yield one spark using the 5 steps:

  •        Initiate a spark location x^j=xi

  •        Compute z=d·r

  •        Choose randomically z dimensions of x^j

  •        Compute Gaussian explosion coefficient g

  •        for each diemnsion x^kjz do

  •                x^kj=x^kj·g

  •                if (x^kj<x^kbest) or (x^kj>x^kworst) then

  •                          x^kj=x^kbest+|x^kj|%(x^kworstx^kbest)

  •                end if

  •           end for

  •         end for

  •         Select the best site and keep for the next iteration

  •         Select randomically Nf1 locations for 2 spark types

  •         Select Current fireworks;

  •         t: = t + 1

  •      end while

  •      Return best solution