Skip to main content
. 2025 Nov 13;25(22):6943. doi: 10.3390/s25226943
Algorithm 4. The pseudocode of the EJSARO
Inputs: number of search agents (N), number of iterations (mi), problem dimension (d), and lower (LB) and upper (UB) boundaries of search space
Outputs: the best search agent (XB) and its fitness (FB)
//Initialization
i=1;    ci= 1;
while (iN)
   Initialize Xi by Equation (39)
   Calculate Fi using PMSE formulated by Equation (42)
   cti=0;    i=i+1;
end for
Find XB and FB
//Optimization
while (cimi)
   i=1
   while (iN)
     j=randint(N);
     if rand0,1<0.5
      //Modified Detour foraging (ARO)
      Calculate R, Z, and L using Equations (20), (21), and (23), respectively
      newXi=XB+R.(XiXj)+Z
     else
      //Modified Random hiding (JS)
      Compute step using Equation (15)
      newXi = XB + r5.step
     end if
     //Check and rectify the new solution
     Calculate φ using Equation (46)
     newXi = φ.r13 ×(UBLB)+LB × + newXi ×φ¯
     //Elitism (greedy selection)
     Compute newFi using Equation (42)
     if (newFi< Fi)
      Xi= newXi;    Fi=newFi;    cti=0;
     else
      cti= cti+1
     end
     if (newFi< FB)
      XB= newXi;    FB=newFi;
     end
     //Levy flight-based motion
     Calculate Lvi using Equation (48)
     newXi=Xi+Lvi
     //Check and rectify the new solution
     newXi = φ.r13 ×(UBLB)+LB × + newXi ×φ¯
     //Elitism (greedy selection)
     Compute newFi using Equation (43)
     if (newFi< Fi)
      Xi= newXi;    Fi=newFi;    cti=0;
     else
      cti= cti+1
     end
     if (newFi< FB)
      XB= newXi;    FB=newFi;
     end
     //Local departure mechanism
     if (ctiTh)
      Reset cti and reinitialize Xi using Equation (39)
     end
     i=i+1
   end for
   //Proposed local search procedure
   Improve XB using Equation (52) and the proposed local search
   ci= ci+ 1
end while
Return XB and FB