swarm intelligence algorithms
TRANSCRIPT
Swarm Intelligence Algorithms
Swarm Intelligence Algorithms
Dr. Hossam Mahmoud MoftahBeni Suef University,
Dept. of Multimedia, Faculty of Computers and information
محاضرات متخصصة لسنة ثالثة حاسبات بنى سوزيف
2
AgendaAgenda
• Introduction• Bees Algorithms• Ant colony optimization
3
IntroductionIntroduction
• Swarm intelligence (SI) is the collective behavior of decentralized, self-organized systems, natural or artificial.
4
Swarm Intelligence (SI)Swarm Intelligence (SI)
An artificial intelligence (AI) technique based on the collective behavior in decentralized, self-organized systems
Generally made up of agents who interact with each other and the environment
No centralized control structures
Based on group behavior found in nature
5
Swarm-based Optimisation AlgorithmsSwarm-based Optimisation Algorithms
SOAs include:
The Ant Colony Optimisation (ACO) algorithm
The Genetic Algorithm (GA)
The Particle Swarm Optimisation (PSO) algorithm (for example the flocking of birds and the schooling of fish)
Others……(Bees (BA), BAT, Firefly Algorithms)
6
Examples of Swarms in Nature:Examples of Swarms in Nature:
Classic Example: Swarm of Bees
Can be extended to other similar systems:
Ant colony
Agents: ants
Traffic
Agents: cars
Crowd
Agents: humans
Flock of birds
Agents: birds
Immune system
Agents: cells and molecules
7
Bees algorithmBees algorithm• the Bees Algorithm is a
population-based search algorithm which was developed in 2005. It mimics the food foraging behaviour of honey bee colonies.
• The only condition for the application of the Bees Algorithm is that some measure of topological distance between the solutions is defined.
8
Bees in NatureBees in Nature
1- A colony of honey bees can extend itself over long distances in multiple directions (more than 10 km)
9
Bees in NatureBees in Nature
2- Scout bees search randomly from one patch to another
10
Bees in NatureBees in Nature
3- The bees who return to the hive, evaluate the different patches depending on certain quality threshold (measured as a combination of some elements, such as sugar content)
11
Bees in NatureBees in Nature
4- They deposit their nectar or pollen go to the “dance floor” to perform a “waggle dance”
12
Bees in NatureBees in Nature
5- Bees communicate through this waggle dance which contains the following information:
1. The direction of flower patches (angle between the sun and the patch)
2. The distance from the hive (duration of the dance)
3. The quality rating (fitness) (frequency of the dance)
13
Bees in NatureBees in Nature
These information helps the colony to send its bees precisely
6- Follower bees go after the dancer bee to the patch to gather food efficiently and quickly
14
Bees in NatureBees in Nature7- The same patch will be advertised in the waggle dance again when returning to the hive is it still good enough as a food source (depending on the food level) and more bees will be recruited to that source
8- More bees visit flower patches with plentiful amounts of nectar or pollen
15
Bees algorithmBees algorithm
16
Bees algorithmBees algorithm
17
Bees algorithmBees algorithm
18
ExampleExample
• n = 100 number of scout bees• m = 10 number of sites selected out of n
visited sites• e = 2 number of best sites out of m selected
sites• nep = 40 number of bees recruited for best e
sites• nsp = 20 number of bees recruited for other
(m-e) selected sites• ngh = 3 neighbourhood size
19
Simple Example: Function Optimisation
• Here are a simple example about how Bees algorithm works
• The example explains the use of bees algorithm to get the best value representing a mathematical function (functional optimal)
20
Simple Example• The following figure shows the
mathematical function
21
• 1- The first step is to initiate the population with any 10 scout bees with random search and evaluate the fitness. (n=10)
Simple Example
22
Graph 1. Initialise a Population of (n=10) Scout Bees
with random Search and evaluate the fitness.
x
y
*
*
*
*
**
**
*
*
Simple Example
23
• 2- Population evaluation fitness: • an array of 10 values in constructed and
ordered in ascending way from the highest value of y to the lowest value of y depending on the previous mathematical function
Simple Example
24
• 3- The best m site is chosen randomly ( the best evaluation to m scout bee) from n
• m=5, e=2, m-e=3
Simple Example
25
Graph 2. Select best (m=5) Sites for Neighbourhood Search:
(e=2) elite bees “▪” and (m-e=3) other selected bees“▫”
x
y
▪
▫
▪
▫
▫*
***
*
me
Simple Example
26
• 4- Select a neighborhood search site upon ngh size:
• Assign random neighborhood ngh as follow
Simple Example
27
x
y
▪
▫
▪
▫
▫
Graph 3. Determine the Size of Neighbourhood (Patch Size ngh)
Simple Example
28
• 5- recruits more bees to the selected sites and evaluate the fitness to the sites:
• Sending bees to e sites (rich sites) and m-e sites (poor sites).
• More bees will be sent to the e site.• n2 = 4 (rich)• n1 = 2 (poor)
Simple Example
29
x
y
▪
▫
▪
▫
▫
*
* *
*
Graph 4. Recruit Bees for Selected Sites
(more Bees for the e=2 Elite Sites)
*
*
*
*
**
**
**
* *
* ** *
Simple Example
30
• 6- Select the best bee from each location (higher fitness) to form the new bees population.
• Choosing the best bee from every m site as follow:
Simple Example
31
x
y
▪
▫
▪
▫
▫
*
* *
*
Graph 5. Select the Fittest Bee * from Each Site
*
*
*
*
**
**
**
Simple Example
32
• 7- initializes a new population:• Taking the old values (5) and assigning
random values (5) to the remaining values n-m
Simple Example
33
x
y
*
Graph 6. Assign the (n–m) Remaining Bees to Random Search
*
**
o*
o
o
o
om
e
Simple Example
34
• 8- the loop counter will be reduced and the steps from two to seven will be repeated until reaching the stopping condition (ending the number of repetitions imax)
• At the end we reach the best solution as shown in the following figure
• This best value (best bees from m) will represent the optimum answer to the mathematical function
Simple Example
35 35
x
y *
Graph 7. Find The Global Best point
*
*
*
*
Simple Example
36
• 8- the loop counter will be reduced and the steps from two to seven will be repeated until reaching the stopping condition (ending the number of repetitions imax)
• At the end we reach the best solution as shown in the following figure
• This best value (best bees from m) will represent the optimum answer to the mathematical function
Simple Example
37
BA pros and cons
The advantages of the BA
Very efficient in finding optimal solutions
The disadvantages of the BA
It is using a number of tunable parameters
38
Ant Colony OptimizationAnt Colony Optimization
• Ant Colony Optimization is an efficient method to finding optimal solutions to a graph
• Using three algorithms based on choosing a city, updating pheromone trails and pheromone trail decay, we can determine an optimal solution to a graph
• Ant Colony Optimization has been used to figure out solutions to real world problems, such as truck routing
39
Ant Colony OptimizationAnt Colony Optimization
• Cooperative search by pheromone trails
1
2
3
4
5
6
40
A simple TSP exampleA simple TSP example
A
ED
C
B1
[]
4
[]
3
[]
2
[]
5
[]
dAB =100;dBC = 60…;dDE =150
41
Iteration 1Iteration 1
A
ED
C
B1
[A]
5
[E]
3
[C]
2
[B]
4
[D]
42
How to choose next city?How to choose next city?
A
ED
C
B1
[A]
1
[A]
1
[A]1
[A]
1
[A,D]
otherwise 0
allowed j if k
kallowedk
ikik
ijij
kij
][)]t([
][)]t([
)t(p
43
Iteration 2Iteration 2
A
ED
C
B3
[C,B]
5
[E,A]
1
[A,D]
2
[B,C]
4
[D,E]
44
Iteration 3Iteration 3
A
ED
C
B4
[D,E,A]
5
[E,A,B]
3
[C,B,E]
2
[B,C,D]
1
[A,D,C]
45
Iteration 4Iteration 4
A
ED
C
B4
[D,E,A,B]
2
[B,C,D,A]
5
[E,A,B,C]
1
[A,DCE]
3
[C,B,E,D]
46
Iteration 5Iteration 5
A
ED
C
B
1
[A,D,C,E,B]
3
[C,B,E,D,A]
4
[D,E,A,B,C]
2
[B,C,D,A,E]
5
[E,A,B,C,D]
47
Path and Trace UpdatePath and Trace Update
1
[A,D,C,E,B]
5
[E,A,B,C,D]
L1 =300
otherwise 0
bestTour ),( ,
jiifL
Q
kkji
L2 =450
L3 =260
L4 =280
L5 =420
2
[B,C,D,A,E]
3
[C,B,E,D,A]
4
[D,E,A,B,C]
48
Path and Trace UpdatePath and Trace Update
ijijij tt )()1(
otherwise 0
bestTour ),( ,
jiifL
Q
kkji
otherwise 0
allowed j if k
kallowedk
ikik
ijij
kij
][)]t([
][)]t([
)t(p
49
ConclusionsConclusions
Thanks