Skip to main content
. 2016 Dec 14;16(12):2122. doi: 10.3390/s16122122
Algorithm 1. The pseudo-code of the ABC algorithm
Generate the initial solution population using Equation (6)
Set Cycle = 1
Repeat until Cycle ≤ the maximum iteration number
 Produce positions (new solutions or food source positions) for worker bees by Equation (7) and evaluate them
 Apply the greedy selection process to select worker bees
 Calculate the probability values pi using Equations (8) and (9)
If pi > rand(0,1), then
  Produce positions (the new solutions) for onlooker bees using Equation (7) and evaluate them
  Apply the greedy selection process to select onlooker bees
End if
 Determine the abandoned position (solution), if exists
 Replace it with a new randomly produced position for the scout using Equation (7)
 Record current best solution
Cycle = Cycle + 1
End repeat