Skip to main content
. 2024 May 9;9(5):283. doi: 10.3390/biomimetics9050283
Algorithm 2 The pseudocode of the BGO algorithm.
  • Input: N(populationsize),D(populationdimension),ub,lb,P1=5, P2=0.001, P3=0.3, FEs=0

  • Output: Global optimal solution: gbestx

  • 1. Initialize the population using x=randint(N,D) and evaluate (i=1,,N)

  • while FEsMaxFEs do

  •     [,ind]=sort(GR)

  •     xbest=x(ind(1),:)

  •     %Learning phase:

  •     for i=1 to N do

  •         xbetter=x(ind(randi([2,1+P1],1)),:)

  •         xworse=x(ind(randi([NP1,N],1)),:)

  •         Find two random individuals that are different from xi: xL1 and xL2

  •         Compute Gapk, k=1,2,3,4 by Equation (4)

  •         Compute LFk, k=1,2,3,4 according to Equation (5)

  •         Compute SFi according to Equation (6)

  •         Compute KAk, k=1,2,3,4 according to Equation (8)

  •         Complete the learning process for the i-th individual once according to Equation (7)

  •         Complete the update of the i-th individual according to Equation (9)

  •         Real-time update gbestx

  •         FEs=FEs+1

  •     end for

  •     %Reflection phase:

  •     for i=1 to N do

  •         Complete the reflection process for the i-th individual once according to Equations (10) and (11)

  •         Complete the update of the i-th individual according to Equation (9)

  •         Real-time update gbestx

  •         FEs=FEs+1

  •     end for

  •     %Two-Step Binarization:

  •     for i=1 to N do

  •         Compute the transfer function of the i-th individual

  •         Complete the binarization of the i-th individual based on the binarization function selected

  •     end for

  • end while

  • Output: gbestx