Skip to main content
. 2024 Dec 1;9(12):732. doi: 10.3390/biomimetics9120732
Algorithm 1 Rat optimization algorithm without Levy flight strategy
Begin
Step 1. Set the initial position of the rat swarm Xi(i=1,2,…,n)
Step 2. Determine all the search agents’ fitness
     X∗ = the best search agent
Step 3. while (t<Intermax) do
       for each search agent
Update A, C, R, q, r, and a
         if 1 (q<0.5)
if 2 (A<2.5)
Update the location of the current search agent employing Equation (2)
else if 2 (A≥2.5)
Randomly choose a search agent Xrand
Update the location of the current search agent employing Equation (5)
end if 2
         else if 1 (q≥0.5)
Update the location of the current search agent employing Equation (7)
end if 1
end for
       Verify whether any search agents cross the search space and make the necessary changes
       Determine all the search agents’ fitness
If a better solution exists, update X∗
t=t+1
     end while
     return X∗
End