Skip to main content
. 2025 Dec 26;28(1):30. doi: 10.3390/e28010030
Algorithm 1 Global Foraging Strategy of the API Algorithm
  • 1:

    Initialize the nest position NOrand

  • 2:

    T0                            ▹ Iteration counter

  • 3:

    while stopping condition not met do

  • 4:

          for each ant aiA do

  • 5:

                Perform local exploration: API ← Foraging(ai)

  • 6:

          end for

  • 7:

          if nest relocation condition is satisfied then

  • 8:

                NS+                  ▹ Move the nest to the best site

  • 9:

                Reset ant memories

  • 10:

        end if

  • 11:

        TT+1

  • 12:

    end while

  • 13:

    return best solution S+ and its evaluation f(S+)