Skip to main content
. 2022 May 31;24(6):777. doi: 10.3390/e24060777
Algorithm 2: Pseudocode of new BGOA
  • 1:

    Initialize Cmax, Cmin (two extreme values of parameter c), Max_iter (iterations’ maximum) and N (population of grasshoppers)

  • 2:

    Set the best solution as Target

  • 3:

    whilet ≤ Maxiter do

  • 4:

        Update c with Equation (6)

  • 5:

        for each agent do

  • 6:

            Normalize the distance among two individuals to [1, 4]

  • 7:

            Calculate probability using Equation (9) or Equation (10) or Equation (11)

  • 8:

            Update Xi using Equation (12) or Equation (13)

  • 9:

            Update Target, if a better value is obtained

  • 10:

        end for

  • 11:

        t=t+1

  • 12:

    end while

  • 13:

    Output Target