Skip to main content
. 2022 Jun 3;22(11):4275. doi: 10.3390/s22114275
Algorithm 2: OPGTOS2
Input: The maximum number of iterations T, the population size N, the lower boundary lb, the upper boundary ub, the dimension dim, the objective function fobj;
1:  Initialization: Generate the individual Xi(i=1,2,,N).
2:  %Opposition-based learning
3:  Calculate the opposition-based individual Xi(i=1,2,,N) using Equation (14). Select N individuals with the best fitness from Xi and Xi;
4:  Divide the population into g groups, every group is Group(j)(j=1,2,,g);
5:  The best gorilla in each group is Group(j).silverback and its fitness value is Group(j).bestfit;
6:  t = 1;
7: while t < T do
8:      %Multi-group competition communication strategy
9:      for i = 1:g do
10:          if t == R1 then
11:             Randomly select some individuals in Group(i)
12:             Mutate the selected individuals using Equation (18)
13:             Update Group(i).silverback using Equation (19)
14:          end if
15:          if t == R2 then
16:             Update BestGorilla using Equation (20)
17:             Update Group(i).silverback using Equation (21)
18:          end if
19:      end for
20:      for i = 1:g do
21:          Update Group(i) using GTO
22:          %Update the optimal individual for the entire population
23:          if Group(i).BestFitness<BestGorilla then
24:             BestGorilla=Group(i).silverback
25:             BestFitness=Group(i).bestfit
26:          end if
27:          if t > 100 then
28:             Opposition-based learning with sliding window strategy
29:          end if
30:      end for
31: end while
Output:BestGorilla and BestFitness.