| HABC algorithm |
| Set ; |
| INITIALIZE. |
| Randomly divide the whole population into N species () each possesses sub-populations ), each possesses bees; |
| Randomize ’s D-dimensions food source positions ; , , . |
| Each sub-population with S dimensions (where S is randomly chosen from a set G, and ). |
| WHILE (the termination conditions are not met) |
| for each species i, |
| Initialize D-dimensions complete vector (, , |
| which consists of the S-dimensions |
| best solution . |
| Randomly all D dimension indices; |
| WHILE (the termination conditions are not met) |
| for each sub-population do |
| repeat |
| Employed Bees’ Phase: |
| For each employed bee |
| Produce a new solution by using (2) |
| Evaluate the new solution |
| Apply Greedy selection choosing the better solution |
| end |
| Calculate the probability values Pi for the solution by using (2) |
| Onlooker Bees’ Phase: |
| for each employed bee |
| Probabilistically choose a solution according to |
| Produce a new solution by (2) |
| Evaluate the new solution |
| Apply Greedy selection choosing the better solution |
| end |
| Re-initialize solutions not improved for Limit cycles |
| Memorize the best solution |
| for each individual of , do |
| Place best solution in the complete solution newGbest by: |
| , |
| Update complete solution if it improves: |
| If (newGbest) < f (Gbest)) |
| Then · |
| end |
| end |
| end WHILE |
| Select elites form neighborhood of |
| BPL = the top best individuals of the ring topology |
| Crossover and Mutation by (4) |
| Update with applying Greedy selection mechanism from |
| end |
| find the global best solution gbest from the whole population P |
| memorize the best solution of each |
| Set ; |
| end WHILE |