Skip to main content
. 2023 Aug 29;23(17):7508. doi: 10.3390/s23177508
Algorithm 4 Parallel strategy for bi-directional ring topology
  • 1:

    for  g=1:4  do

  • 2:

        Use g+1 to find the remainder of 4 and record the remainder as sg

  • 3:

        Use g1 to find the remainder of 4 and record the remainder as vg

  • 4:

        if sg==0 then

  • 5:

            sg=4

  • 6:

        end if

  • 7:

        if vg==0 then

  • 8:

            vg=4

  • 9:

        end if

  • 10:

        Calculate the average position of the optimal particle in group sg and group vg and its fitness value

  • 11:

        if The fitness value of the average position < The fitness value of the optimal particle in group g then

  • 12:

            Replace the position of the optimal particle in group g and its fitness value using the average position and its fitness value

  • 13:

        end if

  • 14:

    end for