Artificial Bee Colony Algorithm

Exploring swarm intelligence

Swarm intelligence (SI) is the collective behavior of decentralized, self-organized systems, whether natural or artificial. It’s an emerging field of biologically-inspired artificial intelligence based on the behavioral models of social insects such as ants, bees, wasps, termites, etc.

All swarm intelligence agents have two properties in common:

  1. Self-organization: Any interaction is executed based on local information rather than the global context.
  2. Division of Labor: Task/Workload is distributed among the entire population as needed.

To learn more about the foundations of swarm intelligence, refer to this post:

An Artificial Bee Colony (ABC) is one of the most recently defined algorithms by Dervish Karaboga under the larger umbrella of swarm intelligence, motivated by the intelligent behavior of honey bees, who aim to discover food sources with progressively higher amounts of nectar. The base paper can be found here.

Main Components of Honey Bee Swarms

Compared to the natural swarms of bees, these main components can be somewhat linked to our model replicating honey bee movements.

  1. Food Source: Represented by profitability, whose value depends on proximity, richness, and how easily it can be extracted.
  2. Employed foragers: The foragers exploit a particular food source (solution) and pass information about the direction and profit value to other agents, with a certain probability.
  3. Unemployed foragers: The agents that are not currently looking for a solution. These “onlookers” are a type of unemployed bee that watches the activity of the employed ones and starts searching for a source while scouts start in its neighborhood or nest.

A comparative study of real honey bee swarms and the algorithm variety:

  • The swarm size can be considered to be our search space
  • The food source replicates our solutions (as the bee looks for the food source with the most nectar, we look for the most optimized solution)
  • Employee bees and onlooker bees are components in our model that work in the same way as the bees do (division of labor).
  • The better the food source, the more fit it is for the bee, which can be linked to our objective function.

If the swarm size is S, then we can consider the number of food sources, employee bees, and onlooker bees to be S/2.

Before looking at how this kind of model works to find the most optimized solution, I should first introduce you to the various applications of the ABC algorithm in AI-related area.

When to use artificial bee colony algorithm?

The ABC algorithm is an optimization approach that requires a search space, a set of decision variables, and an objective function. Some of its popular use cases are in fields of:

  1. Time series forecasting
  2. Clustering problems
  3. Feature selection for classification problems
  4. Cost estimation problems

Phases in searching of a solution

The meta-heuristic artificial bee colony algorithm finds its applications in the optimization of numerical problems. The intelligent searching behavior of honey bees forms the base of this algorithm. The artificial bee colony algorithm is responsible for performing both a global and local search, just like the bees do.

Employed bee phase

In the employed bee phase, each bee is associated with a solution, and the bees start to identify a better food source than the one they’re currently associated with. They generate a new solution based on the partner solution and the algorithm undergoes a greedy selection between them.

In an ABC algorithm, the fitness value directly corresponds to the objective function value(f), following the below formula:

Since each employee bee is exploiting a particular food source, there is a one-to-one connection. Each bee evolves the solution by exploiting by the formula:

Φ is a random number in the range [-1,1], and i,j is the dimension of the decision variables of the solution. Below is an example showing how a new solution is generated by a randomly-selected variable:

If the fitness of current solution (X) is less than the new solution (Xnew), the new solution is greedily considered more optimum.

A trial counter is used to keep track of failures encountered by each solution. A trial value mapped with the current solution is increased by one every time a new solution is inferior. The trial value is set to zero if a new optimum solution is generated.

Onlooker bee phase

Onlookers bees evaluate food sources based on an employee bee’s waggle dance (movement done by bees to inform other bees of nectar). Talking about its counterpart in the algorithm, it implies the solutions exploited by the employed bees are the ones mapped to the onlooker bee in this phase. Each bee is not necessarily linked with a food source. Onlooker bees may/may not exploit a particular food source (i) based on the probability determined by the below equation:

So the probability of all solutions is determined beforehand, and solutions associated with a higher fitness value (objective function value) have a higher probability of being exploited in the onlooker phase.

For every onlooker bee, a random number (r) is generated. An onlooker bee will exploit a food source (solution) only if it meets the below criteria:

If the value of trial that’s associated with a particular solution becomes greater than the limit (a user-defined variable), then that particular solution enters scout phase.

Scout phase

Solutions with a trial value greater than the user-defined limit are the candidate solutions to be discarded. For every discarded solution, a new random solution is created to replace it.

The overall objective function should result in the following slope that depicts that the optimized solution is achieved.


There are a ton of applications for these algorithms, like image segmentation, the actual training of neural networks, digital image processing and pattern recognition, protein structure predictions, and much more, if modified in certain ways.

There are also some other powerful SI algorithms like Particle Swarm Optimization (PSO), Fish School Search (FSS), and the Cuckoo Search Algorithm,which are also very well-known techniques and have some interesting applications.

Avatar photo


Our team has been at the forefront of Artificial Intelligence and Machine Learning research for more than 15 years and we're using our collective intelligence to help others learn, understand and grow using these new technologies in ethical and sustainable ways.

Comments 0 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *