SlideShare a Scribd company logo
Swarm
Intelligence
Muhammad Haroon
Lecturer
University of Gujrat Lahore Sub Campus
Swarm intelligence and particle swarm optimization
Lecture Overview
• Real world insect examples
• Theory of Swarm Intelligence
• Ant Pheromone and Food Foraging Demo
• PARTICLE SWARM INTELLIGENCE (PSO)
• PSEUDO CODE / ALGORITHM
• Ant Colony Optimization
Real World
Insect
Examples
Bees
Bees
• Colony cooperation
• Regulate hive temperature
• Efficiency via Specialization: division of labour in
the colony
• Communication : Food sources are exploited
according to quality and distance from the hive
Ants
Ants
• Organizing highways to and from their foraging
sites by leaving pheromone trails
• Form chains from their own bodies to create a
bridge to pull and hold leafs together with silk
• Division of labour between major and minor ants
Swarm
Intelligence in
Theory
An In-depth Look at Real
Ant Behaviour
Interrupt The Flow
The Path Thickens!
The New Shortest Path
Adapting to Environment
Changes
Adapting to Environment
Changes
Ant Pheromone and
Food Foraging
How Ants Communicate with
Each Other?
• If you watch ants on a trail, you will
notice that they often touch each other
with their antennae (long feelers on the
head) when they meet.
• All ants can produce pheromones,
which are scent chemicals used for
communication and to make trails.
PARTICLE SWARM
OPTIMIZATION
(PSO)
What is Particle?
• A Particle is a small localized object that
have several physical or chemical
properties such as volume or mass.
What is Swarm?
• Collection of something that can move
in large number collectively.
• For Example:
– Bird’s Flock
– Animal Crowd
– Ant Swarm
What is Optimization?
• The action to get the best or the most
effective use of a resource.
• For example:
– Minimize the total time to travel from one
city to another city.
Particle Swarm Optimization
(PSO)
• Particle Swarm Optimization (PSO) is a
population based stochastic
optimization technique developed by Dr.
Eberhart and Dr. Kennedy in 1995,
inspired by social behaviour of Bird
Flocking or Ant Swarm.
• This technique works on population
(large amount of data) and does
optimization (gets the best or the most
effective results).
Flock of Birds
PSO Technique by Example
• PSO Simulates the behaviour of Bird
Flocking.
• Suppose the following Scenario:
• A group of birds are randomly searching
for food in an area.
• There is only one piece of food in an
area.
• All the birds don’t know where the food
is. But they know (in each iteration) how
far the food is?
• So what’s the best strategy to find the
food?
• The effective way is to follow the bird
which is nearest to the food.
PSO Technique by Example
• In PSO, each single solution is called a
“bird” in the search space.
• The particles (birds) fly through the
problem space by following current
optimum particle.
• Each bird has its value pBest (Personal
Best) which means that how much a
single bird is near to food.
• There is a value gBest (Group Best)
which is a combine value of a swarm
means that how much a complete flock
of birds is near to food.
PSEUDO CODE /
ALGORITHM
• X (t+1) = X(t) + V(t+1) → (i)
• V(t+1) = wV(t) + c1 × rand ( ) × ( Xpbest –
X(t)) + c2 ×rand ( ) × ( Xgbest - X(t)) → (ii)
Terminologies Used…
V(t) velocity of the particle at time t
X(t) Particle position at time t
w Inertia weight
c1 , c2 learning factor or accelerating factor
rand uniformly distributed random number between 0 and 1
Xpbest particle’s best position
Xgbest global best position
Input: Randomly initialized position and velocity of Particles:
Xi (0) andVi (0)
Output: Position of the approximate global minimum X*
1: while terminating condition is not reached do
2: for i = 1 to number of particles do
3: Calculate the fitness function f
4: Update personal best and global best of each particle
5: Update velocity of the particle using Equation (ii)
6: Update the position of the particle using equation (i)
7: end for
8: end while
Ant Colony Optimization
“Ant Colony Optimization (ACO) studies artificial
systems that take inspiration from the
behavior of real ant colonies and which are
used to solve discrete optimization problems.”
ACO Website [1]
Source: http://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Aco_branches.svg/2000px-
Aco_branches.svg.png
Ant Colony Optimization
 Probalistic Techniques to solve optimization Problem
 It is a population based metaheuristic used to find approximate
solution to an optimization problem.
 The Optimization Problem must be written in the form of path
finding with a weighted graph
Application of ACO
 Shortest paths and routing
 Assignment problem
 Set Problem
Idea
• The way ants find their food in shortest
path is interesting.
• Ants hide pheromones to remember their
path.
• These pheromones evaporate with time.
• Whenever an ant finds food , it marks its
return journey with pheromones.
• Pheromones evaporate faster on longer
paths.
• Shorter paths serve as the way to food
for most of the other ants.
• The shorter path will be reinforced by the
pheromones further.
• Finally , the ants arrive at the shortest
path.
Idea (cont.)
ACO Concept
• Ants navigate from nest to food source. Ants
are blind!
• Shortest path is discovered via pheromone
trails. Each ant moves at random
• Pheromone is deposited on path
• More pheromone on path increases probability
of path being followed
36
Source: http://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Aco_branches.svg/2000px-
Aco_branches.svg.png
37
Ant Colony Optimization
• ConstructAntSolutions: Partial solution extended by adding
an edge based on stochastic and pheromone
considerations.
• ApplyLocalSearch: problem-specific, used in state-of-art
ACO algorithms.
• UpdatePheromones: increase pheromone of good
solutions, decrease that of bad solutions (pheromone
evaporation).
Ant Colony Algorithm

More Related Content

PDF
Explainable AI
PPTX
Expert systems
PPTX
Cyber & Process Attack Scenarios for ICS
PPTX
Realizing the Full Potential of Cloud-Native Application Security
PPTX
SOC training
PPTX
Anomaly Detection - Real World Scenarios, Approaches and Live Implementation
PPTX
CART – Classification & Regression Trees
PPTX
Juspay Case study(Doubling Revenue Juspay's Success).pptx
Explainable AI
Expert systems
Cyber & Process Attack Scenarios for ICS
Realizing the Full Potential of Cloud-Native Application Security
SOC training
Anomaly Detection - Real World Scenarios, Approaches and Live Implementation
CART – Classification & Regression Trees
Juspay Case study(Doubling Revenue Juspay's Success).pptx

What's hot (20)

PDF
Incident Response
PDF
Nature-Inspired Optimization Algorithms
PDF
PPTX
Application of Expert Systems in System Analysis & Design
PPTX
Gradient Boosted trees
PPTX
Expert system in computer
PPTX
Artificial Intelligence Notes Unit 5
PPTX
Privacy preserving computing and secure multi party computation
PPTX
Genetic Algorithm
PDF
La gestion du risque et de la sécurité en mode Agile
PPTX
Kaspersky endpoint security business presentation
PPTX
Anomaly Detection Technique
PDF
Kubernetes Summit 2021: Multi-Cluster - The Good, the Bad and the Ugly
PDF
Support Vector Machines for Classification
PPTX
How to create a business case for expanding your AppSec program
PDF
Upgrade Your SOC with Cortex XSOAR & Elastic SIEM
PPTX
Bayesian Belief Network and its Applications.pptx
PDF
Stochastic gradient descent and its tuning
PPTX
Machine learning
PPTX
Cloud Security_ Unit 4
Incident Response
Nature-Inspired Optimization Algorithms
Application of Expert Systems in System Analysis & Design
Gradient Boosted trees
Expert system in computer
Artificial Intelligence Notes Unit 5
Privacy preserving computing and secure multi party computation
Genetic Algorithm
La gestion du risque et de la sécurité en mode Agile
Kaspersky endpoint security business presentation
Anomaly Detection Technique
Kubernetes Summit 2021: Multi-Cluster - The Good, the Bad and the Ugly
Support Vector Machines for Classification
How to create a business case for expanding your AppSec program
Upgrade Your SOC with Cortex XSOAR & Elastic SIEM
Bayesian Belief Network and its Applications.pptx
Stochastic gradient descent and its tuning
Machine learning
Cloud Security_ Unit 4
Ad

Similar to Swarm intelligence and particle swarm optimization (20)

PPTX
PSO-ACO-Presentation.pptx
PPTX
B-PSO-ACO-Presentation .pptx
PPTX
11-Optimization algorithm with swarm.pptx
PPT
Cs621 lect7-si-13aug07
PPT
cs621-lect7-SI-13aug07.ppt
PPTX
Bio-inspired computing Algorithms.pptx
PPTX
SWARM INTELLIGENCE
PDF
computitional intelligence Chapter 6 - Swarm Intelligence.pdf
PPT
Swarm intelligence pso and aco
PPTX
Swarm Intelligence - An Introduction
PDF
Swarm Intelligence from Natural to Artificial Systems: Ant Colony Optimization
PDF
SWARM INTELLIGENCE FROM NATURAL TO ARTIFICIAL SYSTEMS: ANT COLONY OPTIMIZATION
PPTX
Particle Swarm Optimization.pptx
PDF
ECE-Swarm-Intelligence-SI-PPT.pdf.......
PPTX
PSO-ACO-Presentation Particle Swarm Optimization (PSO)
PPTX
AI Week 11 - Swarm Intelligenceeeeeeeeee
PPTX
SWARM ROBOTICS TECHNOLOGYzzzzzzzzzzz.pptx
PPTX
ECE CSE Soft Computing Swarm Intelligence (SI) PPT.pptx
PPT
Swarm intel
PPT
SI and PSO --Machine Learning
PSO-ACO-Presentation.pptx
B-PSO-ACO-Presentation .pptx
11-Optimization algorithm with swarm.pptx
Cs621 lect7-si-13aug07
cs621-lect7-SI-13aug07.ppt
Bio-inspired computing Algorithms.pptx
SWARM INTELLIGENCE
computitional intelligence Chapter 6 - Swarm Intelligence.pdf
Swarm intelligence pso and aco
Swarm Intelligence - An Introduction
Swarm Intelligence from Natural to Artificial Systems: Ant Colony Optimization
SWARM INTELLIGENCE FROM NATURAL TO ARTIFICIAL SYSTEMS: ANT COLONY OPTIMIZATION
Particle Swarm Optimization.pptx
ECE-Swarm-Intelligence-SI-PPT.pdf.......
PSO-ACO-Presentation Particle Swarm Optimization (PSO)
AI Week 11 - Swarm Intelligenceeeeeeeeee
SWARM ROBOTICS TECHNOLOGYzzzzzzzzzzz.pptx
ECE CSE Soft Computing Swarm Intelligence (SI) PPT.pptx
Swarm intel
SI and PSO --Machine Learning
Ad

More from Muhammad Haroon (20)

PDF
Basic blocks and flow graph in Compiler Construction
PDF
Address in the target code in Compiler Construction
PDF
Code generator in Compiler Construction
PDF
Target language in compiler design
PDF
Heap management in Compiler Construction
PDF
Storage organization and stack allocation of space
PDF
Backpatching in Compiler Construction
PDF
Type checking in Compiler Construction
PDF
Type conversion in Compiler Construction
PDF
Semantic analysis in Compiler Construction
PDF
Intermediate code and three address instructions
PDF
LALR(1) parser
PDF
LR(0) parser in Compiler Consturction
PDF
SLR(1) parser
PDF
LR(1) CLR(1) Parser with Example
PDF
Powerful presentation components and skills
PDF
Terms of reference in Professional Practices
PDF
Code of conduct .
PDF
Misuse of computer
PDF
7 habits of highly effective people
Basic blocks and flow graph in Compiler Construction
Address in the target code in Compiler Construction
Code generator in Compiler Construction
Target language in compiler design
Heap management in Compiler Construction
Storage organization and stack allocation of space
Backpatching in Compiler Construction
Type checking in Compiler Construction
Type conversion in Compiler Construction
Semantic analysis in Compiler Construction
Intermediate code and three address instructions
LALR(1) parser
LR(0) parser in Compiler Consturction
SLR(1) parser
LR(1) CLR(1) Parser with Example
Powerful presentation components and skills
Terms of reference in Professional Practices
Code of conduct .
Misuse of computer
7 habits of highly effective people

Recently uploaded (20)

PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Complications of Minimal Access Surgery at WLH
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
01-Introduction-to-Information-Management.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Institutional Correction lecture only . . .
PPTX
Presentation on HIE in infants and its manifestations
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Pharma ospi slides which help in ospi learning
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
O7-L3 Supply Chain Operations - ICLT Program
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Complications of Minimal Access Surgery at WLH
O5-L3 Freight Transport Ops (International) V1.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
01-Introduction-to-Information-Management.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Institutional Correction lecture only . . .
Presentation on HIE in infants and its manifestations
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Supply Chain Operations Speaking Notes -ICLT Program
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
GDM (1) (1).pptx small presentation for students
102 student loan defaulters named and shamed – Is someone you know on the list?
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Pharma ospi slides which help in ospi learning
FourierSeries-QuestionsWithAnswers(Part-A).pdf

Swarm intelligence and particle swarm optimization

  • 3. Lecture Overview • Real world insect examples • Theory of Swarm Intelligence • Ant Pheromone and Food Foraging Demo • PARTICLE SWARM INTELLIGENCE (PSO) • PSEUDO CODE / ALGORITHM • Ant Colony Optimization
  • 6. Bees • Colony cooperation • Regulate hive temperature • Efficiency via Specialization: division of labour in the colony • Communication : Food sources are exploited according to quality and distance from the hive
  • 8. Ants • Organizing highways to and from their foraging sites by leaving pheromone trails • Form chains from their own bodies to create a bridge to pull and hold leafs together with silk • Division of labour between major and minor ants
  • 10. An In-depth Look at Real Ant Behaviour
  • 17. How Ants Communicate with Each Other? • If you watch ants on a trail, you will notice that they often touch each other with their antennae (long feelers on the head) when they meet. • All ants can produce pheromones, which are scent chemicals used for communication and to make trails.
  • 19. What is Particle? • A Particle is a small localized object that have several physical or chemical properties such as volume or mass.
  • 20. What is Swarm? • Collection of something that can move in large number collectively. • For Example: – Bird’s Flock – Animal Crowd – Ant Swarm
  • 21. What is Optimization? • The action to get the best or the most effective use of a resource. • For example: – Minimize the total time to travel from one city to another city.
  • 22. Particle Swarm Optimization (PSO) • Particle Swarm Optimization (PSO) is a population based stochastic optimization technique developed by Dr. Eberhart and Dr. Kennedy in 1995, inspired by social behaviour of Bird Flocking or Ant Swarm.
  • 23. • This technique works on population (large amount of data) and does optimization (gets the best or the most effective results).
  • 25. PSO Technique by Example • PSO Simulates the behaviour of Bird Flocking. • Suppose the following Scenario:
  • 26. • A group of birds are randomly searching for food in an area. • There is only one piece of food in an area. • All the birds don’t know where the food is. But they know (in each iteration) how far the food is? • So what’s the best strategy to find the food? • The effective way is to follow the bird which is nearest to the food.
  • 27. PSO Technique by Example • In PSO, each single solution is called a “bird” in the search space. • The particles (birds) fly through the problem space by following current optimum particle.
  • 28. • Each bird has its value pBest (Personal Best) which means that how much a single bird is near to food. • There is a value gBest (Group Best) which is a combine value of a swarm means that how much a complete flock of birds is near to food.
  • 29. PSEUDO CODE / ALGORITHM • X (t+1) = X(t) + V(t+1) → (i) • V(t+1) = wV(t) + c1 × rand ( ) × ( Xpbest – X(t)) + c2 ×rand ( ) × ( Xgbest - X(t)) → (ii)
  • 30. Terminologies Used… V(t) velocity of the particle at time t X(t) Particle position at time t w Inertia weight c1 , c2 learning factor or accelerating factor rand uniformly distributed random number between 0 and 1 Xpbest particle’s best position Xgbest global best position
  • 31. Input: Randomly initialized position and velocity of Particles: Xi (0) andVi (0) Output: Position of the approximate global minimum X* 1: while terminating condition is not reached do 2: for i = 1 to number of particles do 3: Calculate the fitness function f 4: Update personal best and global best of each particle 5: Update velocity of the particle using Equation (ii) 6: Update the position of the particle using equation (i) 7: end for 8: end while
  • 32. Ant Colony Optimization “Ant Colony Optimization (ACO) studies artificial systems that take inspiration from the behavior of real ant colonies and which are used to solve discrete optimization problems.” ACO Website [1] Source: http://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Aco_branches.svg/2000px- Aco_branches.svg.png
  • 33. Ant Colony Optimization  Probalistic Techniques to solve optimization Problem  It is a population based metaheuristic used to find approximate solution to an optimization problem.  The Optimization Problem must be written in the form of path finding with a weighted graph Application of ACO  Shortest paths and routing  Assignment problem  Set Problem
  • 34. Idea • The way ants find their food in shortest path is interesting. • Ants hide pheromones to remember their path. • These pheromones evaporate with time. • Whenever an ant finds food , it marks its return journey with pheromones. • Pheromones evaporate faster on longer paths.
  • 35. • Shorter paths serve as the way to food for most of the other ants. • The shorter path will be reinforced by the pheromones further. • Finally , the ants arrive at the shortest path. Idea (cont.)
  • 36. ACO Concept • Ants navigate from nest to food source. Ants are blind! • Shortest path is discovered via pheromone trails. Each ant moves at random • Pheromone is deposited on path • More pheromone on path increases probability of path being followed 36
  • 38. • ConstructAntSolutions: Partial solution extended by adding an edge based on stochastic and pheromone considerations. • ApplyLocalSearch: problem-specific, used in state-of-art ACO algorithms. • UpdatePheromones: increase pheromone of good solutions, decrease that of bad solutions (pheromone evaporation). Ant Colony Algorithm