Skip to main content
. 2025 Jun 29;10(7):420. doi: 10.3390/biomimetics10070420
Algorithm 1: DBO (Dung Beetle Optimizer)
Input: population size: N; problem dimension: d; search boundary: [lb, ub]; maximum number of iterations: Tmax; fitness function: f(x)
Output: Optimal position: Xbest
1:      Initialize Xi ∼ Uniform(lb, ub) for i = 1…N ←Calculated using Equation (1)
2:      Evaluate fi = f(Xi), set Xbest = argmin fi, Xworst = argmax fi
3:      for t = 1 to Tmax do
4:              p = ⌊0.2·N⌋
5:              // Rolling stage
6:              for i = 1 to p do
7:                    if rand() < 0.9 then
8:                            Xi ←Calculated using Equation (2)
9:                    else
10:                          Xi ←Calculated using Equation (3)
11:                  end if
12:            end for
13:            // Reproduction stage
14:            R = 1 − t/Tmax
15:            [Lb*, Ub*] ←Calculated using Equation (4)
16:            for i = p + 1 to p + m do
17:                  Xi ←Calculated using Equation (5)
18:            end for
19:            // Foraging stage
20:            for i = p + m+1 to p + m+q do
21:                  Xi ←Calculated using Equation (6)
22:            end for
23:            // Stealing stage
24:            for i = p + m+q + 1 to N do
25:                  Xi ←Calculated using Equation (7)
26:            end for
27:            // Boundary check
28:            for i = 1 to N do
29:                  Xi = clip(Xi, lb, ub)
30:            end for
31:            Evaluate all fi, update Xbest, Xworst
32:    end for
33:    return Xbest