0% found this document useful (0 votes)
73 views11 pages

Introduction To Ant Colony Optimization - GeeksforGeeks

Uploaded by

SHRUTI MISHRA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views11 pages

Introduction To Ant Colony Optimization - GeeksforGeeks

Uploaded by

SHRUTI MISHRA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

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:

Open In App
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.

Open In App
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:

1. 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)
2. 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.
3. 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.
4. 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: Open In App


Data Science IBM Certification Data Science Data Science Projects Data Analysis Data Visualiza
Data Science IBM Certification Data Science Data Science Projects Data Analysis Data Visualiza
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:

1. 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.
2. In accordance to evaporation rate of pheromone –
Open In App
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.

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

Open In App
Are you passionate about data and looking to make one giant leap into
your career? Our Data Science Course will help you change your game
and, most importantly, allow students, professionals, and working adults
to tide over into the data science immersion. Master state-of-the-art
methodologies, powerful tools, and industry best practices, hands-on
projects, and real-world applications. Become the executive head of
industries related to Data Analysis, Machine Learning, and Data
Visualization with these growing skills. Ready to Transform Your Future?
Enroll Now to Be a Data Science Expert!

Comment More info Next Article


Python Program to Create a Lap
Timer

Similar Reads

Uni-variate Optimization vs Multivariate Optimization


Wikipedia defines optimization as a problem where you maximize or
minimize a real function by systematically choosing input values from an…
4 min read

Hyperparameter Optimization Based on Bayesian Optimization


In this article we explore what is hyperparameter optimization and how can
we use Bayesian Optimization to tune hyperparameters in various machine…
7 min read

Grey wolf optimization - Introduction


Optimization is essentially everywhere, from engineering design to
Open In App
economics and from holiday planning to Internet routing. As money,…
5 min read

A Brief Introduction to Proximal Policy Optimization


Proximal Policy Optimisation (PPO) is a recent advancement in the field of
Reinforcement Learning, which provides an improvement on Trust Region…
4 min read

Optimization techniques for Gradient Descent


Gradient Descent is a widely used optimization algorithm for machine
learning models. However, there are several optimization techniques that…
4 min read

ML | ADAM (Adaptive Moment Estimation) Optimization


Prerequisite: Optimization techniques in Gradient Descent Gradient Descent
is applicable in the scenarios where the function is easily differentiable wit…
2 min read

Uni-variate Optimization - Data Science


Optimization is an important part of any data science project, with the help
of optimization we try to find the best parameters for our machine learning…
6 min read

Multivariate Optimization and its Types - Data Science


Wikipedia defines optimization as a problem where you maximize or
minimize a real function by systematically choosing input values from an…
4 min read

Multivariate Optimization - KKT Conditions


What's a multivariate optimization problem? In a multivariate optimization
problem, there are multiple variables that act as decision variables in the…
4 min read

Open In App
Multivariate Optimization - Gradient and Hessian
In a multivariate optimization problem, there are multiple variables that act
as decision variables in the optimization problem. z = f(x1, x2, x3.....xn) So,…
3 min read

Article Tags :

Machine Learning Write From Home Artificial Intelligence Genetic Algorithms

Practice Tags : Machine Learning

Corporate & Communications


Address:- A-143, 7th Floor, Sovereign
Corporate Tower, Sector- 136, Noida,
Uttar Pradesh (201305) | Registered
Address:- K 061, Tower K, Gulshan
Vivante Apartment, Sector 137,
Noida, Gautam Buddh Nagar, Uttar
Pradesh, 201305

Company Explore
About Us Job-A-Thon Hiring Challenge
Legal Hack-A-Thon
Careers GfG Weekly Contest
In Media Offline Classes (Delhi/NCR)
Contact Us DSA in JAVA/C++
Advertise with us Master System Design
GFG Corporate Solution Master CP
Placement Training Program GeeksforGeeks Videos
Geeks Community

Open In App
Languages DSA
Python Data Structures
Java Algorithms
C++ DSA for Beginners
PHP Basic DSA Problems
GoLang DSA Roadmap
SQL DSA Interview Questions
R Language Competitive Programming
Android Tutorial

Data Science & ML Web Technologies


Data Science With Python HTML
Data Science For Beginner CSS
Machine Learning JavaScript
ML Maths TypeScript
Data Visualisation ReactJS
Pandas NextJS
NumPy NodeJs
NLP Bootstrap
Deep Learning Tailwind CSS

Python Tutorial Computer Science


Python Programming Examples GATE CS Notes
Django Tutorial Operating Systems
Python Projects Computer Network
Python Tkinter Database Management System
Web Scraping Software Engineering
OpenCV Tutorial Digital Logic Design
Python Interview Question Engineering Maths

DevOps System Design


Git High Level Design
AWS Low Level Design
Docker UML Diagrams
Kubernetes Interview Guide
Azure Design Patterns
GCP OOAD
DevOps Roadmap System Design Bootcamp
Interview Questions

School Subjects Commerce


Mathematics Accountancy
Physics Business Studies
Chemistry Economics
Biology Management
Social Science HR Management
Open In App
English Grammar Finance
Income Tax

Databases Preparation Corner


SQL Company-Wise Recruitment Process
MYSQL Resume Templates
PostgreSQL Aptitude Preparation
PL/SQL Puzzles
MongoDB Company-Wise Preparation
Companies
Colleges

Competitive Exams More Tutorials


JEE Advanced Software Development
UGC NET Software Testing
UPSC Product Management
SSC CGL Project Management
SBI PO Linux
SBI Clerk Excel
IBPS PO All Cheat Sheets
IBPS Clerk Recent Articles

Free Online Tools Write & Earn


Typing Test Write an Article
Image Editor Improve an Article
Code Formatters Pick Topics to Write
Code Converters Share your Experiences
Currency Converter Internships
Random Number Generator
Random Password Generator

DSA/Placements Development/Testing
DSA - Self Paced Course JavaScript Full Course
DSA in JavaScript - Self Paced Course React JS Course
DSA in Python - Self Paced React Native Course
C Programming Course Online - Learn C with Data Django Web Development Course
Structures Complete Bootstrap Course
Complete Interview Preparation Full Stack Development - [LIVE]
Master Competitive Programming JAVA Backend Development - [LIVE]
Core CS Subject for Interview Preparation Complete Software Testing Course [LIVE]
Mastering System Design: LLD to HLD Android Mastery with Kotlin [LIVE]
Tech Interview 101 - From DSA to System Design [LIVE]
DSA to Development [HYBRID]
Placement Preparation Crash Course [LIVE]

Open In App
Machine Learning/Data Science Programming Languages
Complete Machine Learning & Data Science Program - C Programming with Data Structures
[LIVE] C++ Programming Course
Data Analytics Training using Excel, SQL, Python & Java Programming Course
PowerBI - [LIVE] Python Full Course
Data Science Training Program - [LIVE]
Mastering Generative AI and ChatGPT
Data Science Course with IBM Certification

Clouds/Devops GATE
DevOps Engineering GATE CS & IT Test Series - 2025
AWS Solutions Architect Certification GATE DA Test Series 2025
Salesforce Certified Administrator Course GATE CS & IT Course - 2025
GATE DA Course 2025

@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved

Open In App

You might also like