Skip to main content
. 2024 Aug 30;9(9):524. doi: 10.3390/biomimetics9090524
Algorithm 1 Pseudo code of ASFFOX algorithm
1: Initialize the population according to Equation (11);
2: While it < Maxit
3:     Initialize Dist_S_T,Sp_S,Time_S_T,BestX,Dist_Fox_Prey,Jump,MinT,a,BestFitness,ω(t);
4:     Calculate the fitness of each search agent
5:     Select BestX and BestFitness among the population(X) in each iteration;
6:     If1 fitness(Xit) > fitness(Xit+1)
7:        BestFitness = fitness(Xit+1);
8:        BestX = X(i,:);
9:     Endif1
10:    If2 r ≥ 0.5
11:       If3 p > 0.18
12:           Initialize time randomly;
13:           Calculate Distance_Sound_travels using Equation (1);
14:           Calculate Sp_S from Equation (2);
15:           Calculate distance from fox to prey using Equation (3);
16:           Tt = average time;
17:           T = Tt/2;
18:           Calculate jump using Equation (4)
19:           Find Xit+1 using Equation (13);
20:       Elseif p ≤ 0.18
21:           Initialize time randomly;
22:           Calculate Distance_Sound_travels using Equation (1)
23:           Calculate Sp_S from Equation (2)
24:           Calculate distance from fox to prey using Equation (3)
25:           Tt = average time;
26:           T = Tt/2;
27:           Calculate jump using Equation (4)
28:           Find Xit+1 using Equation (14);
29:       EndIf3
30:    else
31:       Find MinT using Equation (7);
32:       Explore Xit+1 using Equations (19) and (20);
33:    EndIf2
34:    Explore Xit+1 using Equations (15)–(18);
35:    Check and amend the position if it goes beyond the limits;
36:    Evaluate search agents by their fitness;
37:    Update BestX;
38:    it = it + 1;
39: End while
40: return BestX and BestFitness