The Bees Algorithm




    photo by Arvind Balaraman



The pseudocode of the Bees Algorithm is shown in Fig. 1 and the flowchart in Fig. 2. The main procedure includes local and global search routines which are executed concurrently at each optimisation cycle. The algorithm uses a population of n artificial bees, divided into ns scouts and n-ns foragers. Each bee visits a location in the search space (i.e. a solution) and evaluates its food content (fitness). The routines composing the Bees Algorithm are outlined below. For more detailed information on the standard Bees Algorithm see [2]. A video tutorial on the Bees Algorithm is available [here].



A number of ns scout bees are randomly scattered across the solution space.


Waggle dance

The solutions visited by the ns scouts are ranked according to their fitness. The scouts that found the nb fittest solutions (best sites) perform the waggle dance. Of these scouts, those that landed on the ne best solutions (elite sites) recruit nre foragers each. The remaining nb-ne dancers recruit nrbnre foragers each.


Local search

The foragers perform exploitative local search in the proximity of the solutions advertised by the scouts. For each of the nb fittest sites, the recruited foragers are randomly scattered inside a hyperbox of sides s1,…,sn=a centred on the solution visited by the scout. In Bees Algorithm terminology, this hyperbox is called a ‘flower patch’. If a forager lands on a solution of higher fitness than the solution marked by the scout, that forager becomes the new scout.


Neighbourhood shrinking

If no forager improved the fitness of the solution found by the scout, the size of the flower patch is shrunk. The patches are usually initialised to cover a large region of the search space, often the whole space, and progressively reduced as the local search stagnates. The neighbourhood shrinking mechanism aims to focus progressively the search in a narrow area around the fitness peak, and is akin to the Simulated Annealing [5] procedure. At each cycle of stagnation, the size of the flower patch is customarily decreased using the following heuristic formula:


where a(t) is the side of the hyperbox defining the flower patch at iteration t of the Bees Algorithm.


Site abandonment

If the local search procedure fails to bring any fitness improvement in a flower patch for stlim consecutive Bees Algorithm cycles, the search is assumed to have found the local fitness optimum. In this case, the flower patch is abandoned and a new scout bee is re-initialised at a random location in the search space.


Global search

At each cycle of the Bees Algorithm’s main loop, global search is performed by ns-nb scout bees. These scouts are placed randomly in the search space.


Population update

At the end of each optimisation cycle, a new list of scouts is created using the nb scouts resulting from the local search procedure (for each flower patch, the bee that landed on the fittest solution), and the ns-nb scouts resulting from the global search procedure (randomly scattered bees).


Stopping criterion

The algorithm is stopped either when a solution of acceptable fitness has been found, or a given number of optimisation cycles have elapsed.



The total artificial bee colony size is n = ne· nre + (nb - ne)· nrb + ns (elite sites foragers + remaining best sites foragers + scouts) bees.



main Bees Algorithm parameters


number of scout bees


number of elite sites


number of best sites


recruited bees for elite sites


recruited bees for remaining best sites


initial size of neighbourhood


limit of stagnation cycles for site abandonment