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

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

  • 2:

    Initialize the position of each grasshopper: Xi (i = 1,2, …, n)

  • 3:

    Set the best solution as Target

  • 4:

    whiletMaxiter do

  • 5:

        Update c with Equation (6)

  • 6:

        for each agent do

  • 7:

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

  • 8:

            Update Xi using Equation (5)

  • 9:

            Update Target, if a better value is obtained

  • 10:

        end for

  • 11:

        t=t+1

  • 12:

    end while

  • 13:

    Output Target