Algorithm 1

Binary bat algorithm

1:

Set the initial value of swarm size SS(N), a, r, Q min, Qmax and maxiter.

2:

Randomly initialize the population as xi = (xi1, xi1,… , xiD) ∈ S for each solution, the frequency vectors Q as D dimensional zero vectors as in Eq. (3) and the velocity vectors v as D dimensional zero vectors as in Eq. (4).

3:

Evaluate fitness of each solution using Eq. (2).

4:

Initialize fitness as D dimensional zero vectors.

5:

Store the best solution in best and minimum fitness in Fmin

6:

Set t := 0. {Counter initialization}

7:

for(i = l;j <SS;i + +) do

8:

for(j = 1; J < D; J + +) do

9:

   Qi= Q min + (QminQmax) • rand

10:

   v(i, j) = v(i,j) + (x(i, j) - best(j)) • Qi

11:

   x˜(i,j)=x(i,j)+v(i,j)

12:

  Binarize x˜(i,j)

13:

   Vvalue =2πarctanπ2v(i,j)

14:

   if(rand < V_ value) then

15:

    xtemp (i,j)=x˜(i,j)

16:

   else

17:

    xtemp (i,j) =x(i, j)

18:

   end if

19:

   if(rand > r) then

20:

    xtemp (i,j) = best(j)

21:

   end if

22:

end for

23:

fit = fitness of xtemp.

24:

if(fit < Fmin & rand <a) then

25:

   x(i) = Xtemp (i)

26:.

  update fitness

27:

end if

28:

 update best and Fmin.

29:

end for

30:

t = t +1 {Iteration counter is increasing}

31:

until(t <maxiter) {Termination criteria are satisfied}.

32:

Produce the best solution best.

or Create an Account

Close subscription notice
Close access options