Skip to main content
. 2025 Nov 19;10(11):787. doi: 10.3390/biomimetics10110787
Algorithm 2 The pseudocode of the FBCA
  •   1:

    Input: Population Size: N, Problem Dimension: D, Max Iteration: Max_Gen, The Number Of Soldiers: nSoldiers

  •   2:

    Output: Obtained best solution

  •   3:

    Initialize the solutions’ positions randomly

  •   4:

    Initialize the velocities and BCB parameters

  •   5:

    while t ← 1 to Max_Gen do

  •   6:

         for i ← 1 to nArmies do

  •   7:

               for j ← 1 to nSoldiers do

  •   8:

                     for d1 to D do

  •   9:

                           if rand < BCB then

  • 10:

                                if rand < p1 then

  • 11:

                                     Creation1: Sine-Guided Soft Asymmetric Gaussian Perturbation

  • 12:

                                     initial Gaussian perturbation item N

  • 13:

                                     Update the soldier position by Equation (9)

  • 14:

                                     End Creation1

  • 15:

                                else

  • 16:

                                     Creation2: Exponentially Modulated Spiral Perturbation

  • 17:

                                     Update Spiral_Factor by Equation (10)

  • 18:

                                     Update the soldier position by Equation (11)

  • 19:

                                     End Creation2

  • 20:

                                end if

  • 21:

                                Update the soldier position that exceeds the search boundaries By Equation (3)

  • 22:

                           else

  • 23:

                                Update p2 by Equation (16)

  • 24:

                                if rand < p2 then

  • 25:

                                     Creation3: Nonlinear Cognitive Velocity Update

  • 26:

                                     Update vi,d by Equation (14)

  • 27:

                                     Update the position by Equation (13)

  • 28:

                                     End Creation3

  • 29:

                                else

  • 30:

                                     Update the position by Equation (2)

  • 31:

                                end if

  • 32:

                                Update the soldier position that exceeds the search boundaries By Equation (4)

  • 33:

                           end if

  • 34:

                     end for

  • 35:

               end for

  • 36:

         end for

  • 37:

         Update gBest and gBestPos.

  • 38:

    end while