Skip to main content
. 2021 Jul 8;23(7):874. doi: 10.3390/e23070874
Algorithm 4 BA
  • Input: the parameters M, N, δ, Freq, A, α and γ

  • Begin

  • S1: initialize M individuals xi(t) randomly, 0<iM, iterative times t = 1;

  • S2: compute f(i), 0<iM, update pg(t); if it satisfies (t > N or precision δ), then go to step S4; otherwise, go to step S3;

  • S3: update Freq, xi(t) and vi(t) by Equation (6), generate a random number rand1, if rand1>r, the bat with the global optimum generates a new solution by Equation (7). Bats generate new solutions randomly, and BA generates a random number rand2; if rand2<A and the new solution is better than the old one, BA updates the corresponding position by Equation (7), and updates Ai and ri  by Equations (8) and (9); iterative times t = t + 1, go to step S2;

  • S4: output the optimized results.

  • End