Skip to main content
. 2023 Oct 1;8(6):462. doi: 10.3390/biomimetics8060462
Algorithm 1: The framework of the TLOCTO algorithm
1: Initialize the solution’s positions of population N randomly;
2: Set the maximum number of iterations (Tmax) and other parameters;
3: For t = 1 to Tmax do;
4: Calculate the average of the population;
5: Select the teacher;
6: Calculate the fitness function for the given solutions using Equation (1);
7: Find the best solution position and fitness value so far;
8: For i = 1 to N do;
9: Update the individual position using Equation (2);
10: Update the individual position using Equation (3);
11: Compare and select the one that generates the smaller value as the update position;
12: For i = 1 to N do;
13: Update the individual position using Equation (4);
14: Update the individual position using Equation (11);
15: Calculate the fitness values Fitness (SjCadres ) and Fitness (SjTu);
16: If Fitness (SjCadres ) < Fitness (SjTu), then
17: Obtain the best position and the best fitness value of the current iteration using Equation (4);
18: else;
19: Obtain the best position and the best fitness value of the current iteration using Equation (11);
20: end if;
21: end for;
22: end for;
23: Return the best solution.