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.
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.
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 E1 and E2 respectively. Thus for each ant, the starting probability of selection of path (between E1 and E2) can be expressed as follows:
Evidently, if R1>R2, the probability of choosing E1 is higher and vice-versa. Now, while returning through this shortest path say Ei, 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 Vs (ant colony). Subsequently, ants move from Vs to Vd (food source) following step 1. Next, all ants conduct their return trip and reinforce their chosen path based on step 2.
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).
- Introduction to Particle Swarm Optimization(PSO)
- Uni-variate Optimization vs Multivariate Optimization
- Hyperparameters Optimization methods - ML
- Unconstrained Multivariate Optimization
- Optimization for Data Science
- Multivariate Optimization - KKT Conditions
- Multivariate Optimization - Gradient and Hessian
- Uni-variate Optimization - Data Science
- Multivariate Optimization with Equality Constraint
- Optimization techniques for Gradient Descent
- ADAM (Adaptive Moment Estimation) Optimization | ML
- Local and Global Optimum in Uni-variate Optimization
- Multivariate Optimization and its Types - Data Science
- Need for Intermediate Code and Code Optimization
- Introduction of LED
- CoffeeScript | Introduction
- Underscore.js | Introduction
- Introduction to OPSEC?
- Introduction to OpenCV
- ML | Introduction to Kernel PCA
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.