swarm intelligence algorithms

49
Swarm Intelligence Algorithms Dr. Hossam Mahmoud Moftah Beni Suef University, Dept. of Multimedia, Faculty of Computers and information ف ي وز س ى ن ب ات ب س حا ة ث ل ا ث ة ث س ل ة ص ص خ ت م رات ض حا م

Upload: aboul-ella-hassanien

Post on 25-Jul-2015

277 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: Swarm intelligence algorithms

Swarm Intelligence Algorithms

Swarm Intelligence Algorithms

Dr. Hossam Mahmoud MoftahBeni Suef University,

Dept. of Multimedia, Faculty of Computers and information

محاضرات متخصصة لسنة ثالثة حاسبات بنى سوزيف

Page 2: Swarm intelligence algorithms

2

AgendaAgenda

• Introduction• Bees Algorithms• Ant colony optimization

Page 3: Swarm intelligence algorithms

3

IntroductionIntroduction

• Swarm intelligence (SI) is the collective behavior of decentralized, self-organized systems, natural or artificial.

Page 4: Swarm intelligence algorithms

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

Page 5: Swarm intelligence algorithms

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)

Page 6: Swarm intelligence 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

Page 7: Swarm intelligence algorithms

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.

Page 8: Swarm intelligence algorithms

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)

Page 9: Swarm intelligence algorithms

9

Bees in NatureBees in Nature

2- Scout bees search randomly from one patch to another

Page 10: Swarm intelligence algorithms

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)

Page 11: Swarm intelligence algorithms

11

Bees in NatureBees in Nature

4- They deposit their nectar or pollen go to the “dance floor” to perform a “waggle dance”

Page 12: Swarm intelligence algorithms

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)

Page 13: Swarm intelligence algorithms

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

Page 14: Swarm intelligence algorithms

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

Page 15: Swarm intelligence algorithms

15

Bees algorithmBees algorithm

Page 16: Swarm intelligence algorithms

16

Bees algorithmBees algorithm

Page 17: Swarm intelligence algorithms

17

Bees algorithmBees algorithm

Page 18: Swarm intelligence algorithms

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

Page 19: Swarm intelligence algorithms

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)

Page 20: Swarm intelligence algorithms

20

Simple Example• The following figure shows the

mathematical function

Page 21: Swarm intelligence algorithms

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

Page 22: Swarm intelligence algorithms

22

Graph 1. Initialise a Population of (n=10) Scout Bees

with random Search and evaluate the fitness.

x

y

*

*

*

*

**

**

*

*

Simple Example

Page 23: Swarm intelligence algorithms

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

Page 24: Swarm intelligence algorithms

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

Page 25: Swarm intelligence algorithms

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

Page 26: Swarm intelligence algorithms

26

• 4- Select a neighborhood search site upon ngh size:

• Assign random neighborhood ngh as follow

Simple Example

Page 27: Swarm intelligence algorithms

27

x

y

Graph 3. Determine the Size of Neighbourhood (Patch Size ngh)

Simple Example

Page 28: Swarm intelligence algorithms

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

Page 29: Swarm intelligence algorithms

29

x

y

*

* *

*

Graph 4. Recruit Bees for Selected Sites

(more Bees for the e=2 Elite Sites)

*

*

*

*

**

**

**

* *

* ** *

Simple Example

Page 30: Swarm intelligence algorithms

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

Page 31: Swarm intelligence algorithms

31

x

y

*

* *

*

Graph 5. Select the Fittest Bee * from Each Site

*

*

*

*

**

**

**

Simple Example

Page 32: Swarm intelligence algorithms

32

• 7- initializes a new population:• Taking the old values (5) and assigning

random values (5) to the remaining values n-m

Simple Example

Page 33: Swarm intelligence algorithms

33

x

y

*

Graph 6. Assign the (n–m) Remaining Bees to Random Search

*

**

o*

o

o

o

om

e

Simple Example

Page 34: Swarm intelligence algorithms

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

Page 35: Swarm intelligence algorithms

35 35

x

y *

Graph 7. Find The Global Best point

*

*

*

*

Simple Example

Page 36: Swarm intelligence algorithms

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

Page 37: Swarm intelligence algorithms

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

Page 38: Swarm intelligence algorithms

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

Page 39: Swarm intelligence algorithms

39

Ant Colony OptimizationAnt Colony Optimization

• Cooperative search by pheromone trails

1

2

3

4

5

6

Page 40: Swarm intelligence algorithms

40

A simple TSP exampleA simple TSP example

A

ED

C

B1

[]

4

[]

3

[]

2

[]

5

[]

dAB =100;dBC = 60…;dDE =150

Page 41: Swarm intelligence algorithms

41

Iteration 1Iteration 1

A

ED

C

B1

[A]

5

[E]

3

[C]

2

[B]

4

[D]

Page 42: Swarm intelligence algorithms

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

Page 43: Swarm intelligence algorithms

43

Iteration 2Iteration 2

A

ED

C

B3

[C,B]

5

[E,A]

1

[A,D]

2

[B,C]

4

[D,E]

Page 44: Swarm intelligence algorithms

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]

Page 45: Swarm intelligence algorithms

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]

Page 46: Swarm intelligence algorithms

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]

Page 47: Swarm intelligence algorithms

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]

Page 48: Swarm intelligence algorithms

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

Page 49: Swarm intelligence algorithms

49

ConclusionsConclusions

Thanks