Artificial bee colony and its applications to optimization problems

Honey bees' foraging behaviour inspired the development of artificial bee colony.
Listen to this story

Many natural phenomena are the motivation for creating population-based optimization algorithms. Two major forms of population-based algorithms are evolution and swarm intelligence algorithms. The Artificial Bee Colony (ABC) algorithm is a swarm-based meta-heuristic technique used for numerical problem optimization. It was inspired by honey bees’ clever foraging behaviour. The model is made up of three key components: employed and unemployed foraging bees, as well as food sources. In this article, we will understand the core functioning of the bee colony algorithm and its utilization in the optimization of problems. Following are the topics to be covered.

Table of contents

  1. About Bee Colony
  2. About Artificial Bee Colony (ABC)
  3. Working of ABC
  4. How it is utilized to optimize problems?
  5. Realtime industry use cases of ABC


Sign up for your weekly dose of what's up in emerging technology.

To understand the ABC algorithm, one needs to understand the Bee Colony.

About Bee Colony

Food sources, employed bees, unemployed bees, foraging behaviour, and dances may all be summarised in the brains of genuine honey bees.

Food sources 

Bee chooses a certain flower (food source) when hunting for food. The amount of nectar in this food source, efforts to put in to collect this nectar, and distance to be travelled and in which direction it is from the nest. This information that the bee gathers from this food supply. For the purpose of ease and simplicity, Bee maintains this information as a single amount which could be referred to as overall profitability for this particular food source. 

Are you looking for a complete repository of Python libraries used in data science, check out here.

Employed bees 

A certain group of bees takes use of the available food sources. These bees are known as employed bees, and each of them maintains the profitability of the linked food supply i.e., richness, distance, and orientation from the hive.

Unemployed bees 

With a certain likelihood, employed bees communicate their information with another set of bees known as unemployed bees. Unemployed bees are in charge of summarising information from employed bees and choosing a food source to exploit. These unemployed bees are further separated into two groups. 

  • The Onlooker bees are the bees who gather information from the colony’s hired workers and, after analysing the data, build a food source for the colony. 
  • The Scouts bees are in charge of locating new food sources around the hive. 

Foraging behaviour 

Foraging behaviour is the most significant attribute of a honey bee swarm. During the foraging phase, the bee exits the hive and begins looking for food. When a bee finds a food supply, it extracts and stores the nectar. The honey-making process then begins with the production of enzymes, and after reaching the hive, nectar is unloaded in empty cells. Finally, the bee uses various sorts of dance to convey the knowledge to other bees in the hive. 


To communicate with other bees in the hive about the information collected about food sources the employed bee performs a dance on various portions of the hive area. Employed bees execute one of the following dance types depending on the profitability of the food supply. 

  • The round dance is done when the food source is close to the hive.
  • Waggle dance notifies other bees about the direction of the food supply in relation to the sunlight. This also indicated that the food source is far away from the hive. The distance between the food source and the hive is proportional to the speed of the dance. 
  • If a bee takes a long time to discharge nectar, then begins to tremble, indicating that the present profitability of the food supply is unaware.

About Artificial Bee Colony (ABC)

Honey bees’ foraging behaviour inspired the ABC algorithm. The honey bee swarm is an example of a natural swarm that searches for food in a coordinated and intelligent manner. The honey bee swarm has several characteristics, including the ability to convey information, memorise the surroundings, retain and distribute knowledge, and make decisions based on that information. The swarm adapts to changes in the environment by dynamically assigning jobs and progressing through social learning and teaching.

ABC algorithm is a population-based optimisation method that evaluates fitness, therefore the population of candidate solutions is predicted to gravitate toward the search space’s better fitness areas. Through natural motivation, population-based optimisation algorithms find near-optimal solutions to challenging optimisation problems.

Working of ABC

Swarm-based optimization algorithms use collaborative trial and error approaches to identify solutions. The ABC optimisation algorithms are driven by the peer-to-peer learning behaviour of social colonies. ABC consists of a population of potential solutions and finds the optimal solution with an iterative process. 

The two essential factors that determine the development of an ABC population are variation and selection. The variation process explores diverse sections of the search space. The selecting procedure guarantees that past experiences are utilised. 

The ABC algorithm is divided into four phases: the initialization phase,  the employed bees phase, the scout and the onlooker bees phase.

In the initialisation of the population, ABC generates a uniformly distributed population of solutions where each solution is a dimensional vector.  The number of dimensions depends on the number of variables in the optimization problem for a particular food source in the population. 

The employed bees modify the current solution based on the information from individual experiences and the fitness value of the new solution. If the fitness value of the new food source is higher than that of the old food source, the bee updates the position with the new one and discards the old one. The position is updated using the dimensional vectors defined earlier in the initial phase with the size of steps needed to get the updated positions. Step size is a random number between –1 to 1. 

The accompanying diagram depicts the position updating procedure in the employed bee phase. A two-dimensional search space is used. The highlighted box depicts the randomly chosen direction, while  Xi displays the current position of a bee. Xk is the chosen bee at random. The direction of a random bee is subtracted from the same direction of the specified group of bees in this phase. This difference is compounded by the step size, which is a random integer. Finally, the dimension of the new food position ‘V’ is calculated by adding this quantity to the dimensional vector of  Xi. This vector is formed in the vicinity of  Xi and has the same other dimensions as  Xi.

With the spectator bees in the hive, the employed bees communicate the fitness information (nectar) of the updated solutions (food sources) as well as their location information. Onlooker bees evaluate the given data and choose a solution based on its fitness likelihood. As with the employed bee, the observer bee modifies its memory location and assesses the suitability of the prospective source. The bee memorises the new location and forgets the old one if the fitness is higher than the previous one.

The position of a food source is deemed to be abandoned if it is not updated for a predefined amount of cycles. The abandoned food source’s bee transforms into a scout bee, and the food source is replaced with a randomly selected food source inside the search space. The set number of cycles, known as the limit for abandonment in ABC, is a critical control parameter.

How is it utilized to optimize problems?

In order to customise the ABC algorithm for issue solving. Deb’s constrained handling approach is utilised instead of the ABC algorithm’s greedy selection procedure since Deb’s method only has three heuristic criteria. Deb’s technique employs a tournament selection operator, which compares two solutions at a time and always enforces the following requirements.

  • Any viable solution is preferred over an infeasible solution. 
  • The one with a higher objective function value is preferred between the two feasible solutions.
  • The one with a lower constraint violation is preferred between the two infeasible alternatives. 

The ABC method does not regard the initial population to be viable since initialization with feasible solutions is a time-consuming procedure. In certain circumstances, it is impossible to construct a feasible solution randomly. Because Deb’s principles were used instead of greedy selection, the structure of the algorithm already steers the solutions to a viable area in the running process. The algorithm’s scout creation process provides a diversity mechanism that permits new and likely impossible individuals to enter the population.

Real time industry use cases of ABC

The ABC algorithm has become prominent because of its robustness and ease of application. Here are some applications listed. 

Recommendation system used in Facebook

The suggested method’s goal was to efficiently find appropriate learning resources. The ABC was used to create a customised auxiliary material recommendation system on Facebook, which would suggest relevant auxiliary items for a student based on their learning style, interests, and difficulty.

Optimizing network configuration 

The algorithm was used to solve the network reconfiguration problem in a radial distribution system in order to reduce actual power loss, enhance voltage profile, and balance feeder load, all while adhering to the radial network structure’s requirement that all loads be turned on. In terms of solution quality and computing efficiency, the ABCA produced superior results to the other approaches tested. 

Optimizing Camera calibration

The ABCA was used to solve direct linear transformation (DLT), a camera calibration approach that establishes a linear relationship between 3D object coordinates and 2D picture planes. The ABCA algorithm’s output was compared to the DE algorithm’s output.

Image template matching

The goal was to locate a pattern or reference picture (template) of an item in a target landscape scene that has been moved, scaled, rotated, and/or partially obscured. As a consequence, the specified reference picture will be located in the target landscape image. Experiments with grayscale and colour pictures revealed that the ABC is quicker and more accurate than other evolutionary algorithms.

Segmentation of medical images

Segmentation of Magnetic Resonance (MR) images of the brain is complex and is considered a huge challenge in image processing. The ABC algorithm with the fuzzy C-mean (FCM) algorithm was used to segment brain images. The aim of using the ABC algorithm was to reduce the time as well as to reach higher quality than that obtained by the previous algorithm.


The ABC algorithm is unaffected by rising issue complexity and is unaffected by beginning parameter values. ABC has the flaw of early convergence, which results in the loss of ABC’s exploration and exploitation capabilities. With this article, we have understood the operation and resemblance of the Artificial Bee Colony algorithm with the bee colony and its utilization in optimizing problems.


More Great AIM Stories

Sourabh Mehta
Sourabh has worked as a full-time data scientist for an ISP organisation, experienced in analysing patterns and their implementation in product development. He has a keen interest in developing solutions for real-time problems with the help of data both in this universe and metaverse.

Our Upcoming Events

Masterclass, Virtual
How to achieve real-time AI inference on your CPU
7th Jul

Conference, in-person (Bangalore)
Cypher 2022
21-23rd Sep

Conference, Virtual
Deep Learning DevCon 2022
29th Oct

3 Ways to Join our Community

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Telegram Channel

Discover special offers, top stories, upcoming events, and more.

Subscribe to our newsletter

Get the latest updates from AIM