Skip to main content
. 2025 Jan 20;15(1):95. doi: 10.3390/brainsci15010095
Algorithm 1 Reptile Search Algorithm (RSA)
1: Input:Population size N, maximum iterations T, search spacebounds LB, UB
2: Initialize population P = {X1, X2, …, XN} randomly within [LB,UB]
3: Initialize bestsolution Xbest and its fitness fbest
4: for each individual Xi inpopulation P do
5: Calculate fitness fi = f(Xi)
6: if fi < fbest then
7: Update Xbest = Xi
8: Update fbest = fi
9: end if
10: end for
11: for iteration t = 1 to T do
12: for each individual Xi in population P do
13: Generate a movement vector Vi based on reptile-inspired strategies
14: Update position Xnew = Xi + Vi
15: Apply boundary constraints on Xnew to keep with in [LB,UB]
16: Calculate fitness fnew = fi(Xinew)
17: if fnew < fi then
18: Accept The New Position Xi = Xinew
19: Update fitness fi = finew
20: end if
21: if fi < fbest then
22: Update Xbest = Xi
23: Update fbest = fi
24: end if
25: end for
26: Optionally: Apply reptile-specific strategies like warm-up or local search
27: end for
28: Output: Best solution Xbest and its fitness fbest