Introduction to Ant Colony Optimization
Last Updated :
17 May, 2020
The algorithmic world is beautiful with multifarious strategies and tools being developed round the clock to render to the need for high-performance computing. In fact, when algorithms are inspired by natural laws, interesting results are observed. Evolutionary algorithms belong to such a class of algorithms. These algorithms are designed so as to mimic certain behaviours as well as evolutionary traits of the human genome. Moreover, such algorithmic design is not only constrained to humans but can be inspired by the natural behaviour of certain animals as well. The basic aim of fabricating such methodologies is to provide realistic, relevant and yet some low-cost solutions to problems that are hitherto unsolvable by conventional means.
Different optimization techniques have thus evolved based on such evolutionary algorithms and thereby opened up the domain of metaheuristics.
Metaheuristic has been derived from two Greek words, namely,
Meta meaning
one level above and
heuriskein meaning
to find. Algorithms such as the Particle Swarm Optimization (PSO) and Ant Colony Optimization (ACO) are examples of swarm intelligence and metaheuristics. The goal of swarm intelligence is to design intelligent multi-agent systems by taking inspiration from the collective behaviour of social insects such as ants, termites, bees, wasps, and other animal societies such as flocks of birds or schools of fish.
Background:
Ant Colony Optimization technique is purely inspired from the
foraging behaviour of ant colonies, first introduced by Marco Dorigo in the 1990s. Ants are eusocial insects that prefer community survival and sustaining rather than as individual species. They communicate with each other using sound, touch and pheromone.
Pheromones are organic chemical compounds secreted by the ants that trigger a social response in members of same species. These are chemicals capable of acting like hormones outside the body of the secreting individual, to impact the behaviour of the receiving individuals. Since most ants live on the ground, they use the soil surface to leave pheromone trails that may be followed (smelled) by other ants.
Ants live in community nests and the underlying principle of ACO is to observe the movement of the ants from their nests in order to search for food in the shortest possible path. Initially, ants start to move randomly in search of food around their nests. This randomized search opens up multiple routes from the nest to the food source. Now, based on the quality and quantity of the food, ants carry a portion of the food back with necessary pheromone concentration on its return path. Depending on these pheromone trials, the probability of selection of a specific path by the following ants would be a guiding factor to the food source. Evidently, this probability is based on the concentration as well as the rate of evaporation of pheromone. It can also be observed that since the evaporation rate of pheromone is also a deciding factor, the length of each path can easily be accounted for.

In the above figure, for simplicity, only two possible paths have been considered between the food source and the ant nest. The stages can be analyzed as follows:
- Stage 1: All ants are in their nest. There is no pheromone content in the environment. (For algorithmic design, residual pheromone amount can be considered without interfering with the probability)
- Stage 2: Ants begin their search with equal (0.5 each) probability along each path. Clearly, the curved path is the longer and hence the time taken by ants to reach food source is greater than the other.
- Stage 3: The ants through the shorter path reaches food source earlier. Now, evidently they face with a similar selection dilemma, but this time due to pheromone trail along the shorter path already available, probability of selection is higher.
- Stage 4: More ants return via the shorter path and subsequently the pheromone concentrations also increase. Moreover, due to evaporation, the pheromone concentration in the longer path reduces, decreasing the probability of selection of this path in further stages. Therefore, the whole colony gradually uses the shorter path in higher probabilities. So, path optimization is attained.
Algorithmic Design:
Pertaining to the above behaviour of the ants, an algorithmic design can now be developed. For simplicity, a single food source and single ant colony have been considered with just two paths of possible traversal. The whole scenario can be realized through weighted graphs where the ant colony and the food source act as vertices (or nodes); the paths serve as the edges and the pheromone values are the weights associated with the edges.
Let the graph be
G = (V, E) where V, E are the edges and the vertices of the graph. The vertices according to our consideration are
Vs (Source vertex - ant colony) and
Vd (Destination vertex – Food source), The two edges are
E1 and
E2 with lengths
L1 and
L2 assigned to each. Now, the associated pheromone values (indicative of their strength) can be assumed to be
R1 and
R2 for vertices E
1 and E
2 respectively. Thus for each ant, the starting probability of selection of path (between E
1 and E
2) can be expressed as follows:

Evidently, if R
1>R
2, the probability of choosing E
1 is higher and vice-versa. Now, while returning through this shortest path say E
i, the pheromone value is updated for the corresponding path. The updation is done based on the length of the paths as well as the evaporation rate of pheromone. So, the update can be step-wise realized as follows:
- In accordance to path length -
In the above updation, i = 1, 2 and ‘K’ serves as a parameter of the model. Moreover, the update is dependent on the length of the path. Shorter the path, higher the pheromone added.
- In accordance to evaporation rate of pheromone -
The parameter ‘v’ belongs to interval (0, 1] that regulates the pheromone evaporation. Further, i = 1, 2.
At each iteration, all ants are placed at source vertex V
s (ant colony). Subsequently, ants move from V
s to V
d (food source) following step 1. Next, all ants conduct their return trip and reinforce their chosen path based on step 2.
Pseudocode:
Procedure AntColonyOptimization:
Initialize necessary parameters and pheromone trials;
while not termination do:
Generate ant population;
Calculate fitness values associated with each ant;
Find best solution through selection methods;
Update pheromone trial;
end while
end procedure
The pheromone update and the fitness calculations in the above pseudocode can be found through the step-wise implementations mentioned above.
Thus, the introduction of the ACO optimization technique has been established. The application of the ACO can be extended to various problems such as the famous
TSP (Travelling Salesman Problem).
References:
https://www.ics.uci.edu/~welling/teaching/271fall09/antcolonyopt.pdf
Similar Reads
Grey wolf optimization - Introduction
Optimization is essentially everywhere, from engineering design to economics and from holiday planning to Internet routing. As money, resources and time are always limited, the optimal utilization of these available resources is crucially important. In general, an optimization problem can be written
5 min read
Introduction to Optimization with Genetic Algorithm
Optimization is the process of finding the best solution after evaluating all possible combinations. When dealing with complex problems, finding the optimal solution becomes crucial. One powerful tool in machine learning for solving such optimization problems is the genetic algorithm. Inspired by th
10 min read
Brain storm optimization
Optimization is usually tasked to identify the best solution(s) for some specific problem. A problem with optimization in Rn or simply a problem with optimization is f: R_n \rightarrow R_m , whereby Rn and Rm represent decision space and objective space respectively. The fitness value or fitness val
5 min read
What is Artificial Intelligence Optimization?
Have you ever been impressed by how AI systems know what you need? From personalizing recommendations to smart devices that learn from you or autonomous vehicles that move through busy streets with ease, AI plays a huge role in making our lives more convenient and efficient. Behind the scenes, AI is
10 min read
Implementation of Henry gas solubility optimization
Article Henry gas solubility optimization (HGSO) talked about the inspiration of Henry gas solubility optimization, its mathematical modelling and algorithm. In this article, we will implement Henry gas solubility optimization (HGSO) for the Sphere fitness function. Sphere Fitness function Sphere fu
5 min read
Implementation of Whale Optimization Algorithm
Previous article Whale optimization algorithm (WOA) talked about the inspiration of whale optimization, its mathematical modeling and algorithm. In this article we will implement a whale optimization algorithm (WOA) for two fitness functions 1) Rastrigin function   2) Sphere function  The algorithm
6 min read
Dragon fly Optimization
Due to its simplicity, easy operation, capacity to protect against local optima, and the problem of derivatives free, Metaheuristic was frequently employed throughout the previous three decades. Exploration and exploitation are two fundamental metaheuristic features. The first one shows how the algo
4 min read
Implementation of Grey Wolf Optimization (GWO) Algorithm
Previous article Grey wolf optimization- Introduction talked about inspiration of grey wolf optimization, and its mathematical modelling and algorithm. In this article we will implement grey wolf optimization (GWO) for two fitness functions - Rastrigin function and Sphere function. The aim of Grey w
7 min read
Bayesian Optimization in Machine Learning
Bayesian Optimization is a powerful optimization technique that leverages the principles of Bayesian inference to find the minimum (or maximum) of an objective function efficiently. Unlike traditional optimization methods that require extensive evaluations, Bayesian Optimization is particularly effe
8 min read
Pathfinder Optimization Algorithm
Nature is full of social behaviours for performing different tasks. Although the ultimate goal of all individuals and collective behaviours is survival, creatures cooperate and interact in groups, herds, schools, colonies, and flocks for several reasons: hunting, defending, navigating, and foraging.
3 min read