lecture 09: swarm intelligenceqf-zhao/teaching/mh/lec09.pdf · what is swarm intelligence? •...

22
Lecture 09: Swarm Intelligence An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/1

Upload: others

Post on 20-May-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Lecture 09: Swarm Intelligence

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/1

Page 2: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

What is swarm intelligence?

• Swarm intelligence (SI) is also a group of population based optimization/search algorithms.

• Instead of trying to emulate the evolution process, SI tries to emulate the “collective behaviors” of bacterial, ants, bugs, birds, fish, animals, etc.

• In nature, different “agents” are often governed by some very simple rules. They often make decisions in a local and decentralized way, but as a whole, some “intelligent” behaviors often emerge.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/2

Page 3: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Ant colony optimization (ACO)

• ACO was first studied by Marco Dorigo in his doctor thesis in 1991.

• It simulates the collective behavior of an ant colony.

• ACO can be used directly for solving problems related to finding the shortest paths to reach some goal, such as traveling salesman problem (TSP).

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/3

http://en.wikipedia.org/wiki/

Page 4: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Why ant colony?

• Properties of ants:

– Cannot see well (can only “feel” locally).

– Deliver a chemical trail called pheromone while wandering around and searching for food.

– The ants choose their paths according to the strength of the pheromone deployed by its family members.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/4

?

Page 5: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Why ant colony?

• Properties of the pheromone:

– The pheromone is olfactive and volatile.

– The pheromone is stronger if more ants go along the same path (reinforced by number).

– The pheromone is stronger if the path from the nest to the food is shorter

(less evaporation).

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/5

After a while, the shortest path will be found automatically!

Page 6: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

A general algorithm

• Step 1: Initialize the pheromone information;

• Step 2: For each ant, do the following:

– Find a solution (a path) based on the current pheromone trail;

– Reinforcement: Add pheromone;

– Evaporation: Reduce pheromone;

• Step 3: Stop if terminating condition satisfied; return to Step 2 otherwise.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/6

Page 7: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

ACO for TSP

• Step 1: Initialize the pheromone information.

• Step 2: For each ant, do the following:

– Specify the initial node (fixed, or select at random);

– Find a solution by repeating the following steps until all nodes are visited:

• i=current node;

• Select an un-visited child node (linked to i) j with a probability pij.

• Step 3: Update the pheromone trails:

– Evaporation of pheromone value on each edge;

– Reinforcement of pheromone value on each edge contained in the found routes.

• Step 4: Stop if terminating condition satisfied; return to Step 2 otherwise.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/7

Page 8: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Representation of pheromone

• For solving the TSP problem, the pheromone is represented in a matrix T=[tij].

• Each element tij is the amount of pheromone on the edge (i,j) of the graph.

• Initially, all elements take the same value.

• During search, pheromones associated with edges contained in shorter routes will become stronger and stronger.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/8

Page 9: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Probability of path selection

• The probability pij should be

– proportional to the pheromone value tij and

– proportional to the heuristic value hij (inverse of distance) of the edge.

𝑝𝑖𝑗 =𝜏𝑖𝑗𝛼 × ℎ𝑖𝑗

𝛽

σ𝑘∈Ω 𝜏𝑖𝑘𝛼 × ℎ𝑖𝑘

𝛽, ∀𝑗 ∈ Ω

where W is the set of not yet visited nodes, a and b are parameters representing the relative influence of the pheromone values and the heuristic values.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/9

Page 10: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Updating the pheromone:Evaporation

• After finding the routes for all ants, the pheromone values associated with all edges are updated as follows:

where n is the total number of nodes in the graph, and r in [0,1] is the reduction (evaporation) rate of the pheromone.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/10

],1[, , njiijij rtt

Page 11: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Updating the pheromone:Reinforcement

• After finding the routes for all ants, the pheromone values associated with edges contained in the k-throute (found by the k-th ant) are updated as follows:

where Q>0 is a constant, and L(k) is the total length of the k-th route.

• The above reinforcement is conducted for all routes.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/11

routeth ),(if ),(/ kjikLQijij tt

Page 12: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Parameters and Their Values

• a: Pheromone influence (is fixed to 1).

• b: Heuristic influence (takes value from [1,15]).

• r: Evaporation rate (takes value from [0,1]).

• m: Number of ants.

• n: Number of nodes.

• Q: Constant (amount of pheromone that can be delivered by each ant).

• dij: Distance between the i-th node and the j-th node (the heuristic value hij is the inverse of dij).

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/12

Page 13: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Basic concept of ACO

• In ACO, in each iteration (generation) each ant (agent) generates a solution based on the information collected by all ants so far.

• The pheromone trail actually plays the role of a “message board”. All ants post some message to the board, and each ant tries to generate a better solution next time based on the information on the message board.

• The message board itself can be considered as the “culture” of the ant colony. In this sense, ACO is also a memetic algorithm.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/13

Page 14: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Coffee Break

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/14

http://www.youtube.com/watch?v=VPrBmQER8LE&feature=relmfu

http://www.youtube.com/watch?v=qJjeHLcbQJ0

Page 15: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Particle Swarm Optimization (PSO)

• PSO is also a population based search algorithm.

• Instead of posting information to the message board as in ACO, in PSO, each agent tries to learn something directly from its “leader”.

• The leader can be a local one, or a global one.

• Through this kind of direct learning, the agents can become “good” much faster (compared with conventional EAs).

• In this sense, PSO is a kind of non-Darwinian evolution.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/15

Page 16: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Basic considerations

• In PSO, the population is called swarm, and each individual is called a particle.

• For each particle, we need to record

– The current position x;

– The best position pb found so far; and

– The velocity v.

• For the whole swarm, we need to record the best particle (the global leader pg) found so far.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/16

Page 17: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

The algorithm

• Step 1: Randomly initialize the swarm.

• Step 2: Evaluate all particles.

• Step 3: For each particle

– Update its velocity;

– Update its position;

– Evaluate the particle.

• Step 4: Update if necessary the leader of the swarm and the best position obtained by each particle.

• Step 5: Stop if terminating condition satisfied; return to Step 3 otherwise.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/17

Page 18: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Update the velocity

• The velocity of a particle in the k-th iteration is updated as follows:

𝑣𝑖 𝑘 + 1 = 𝑎𝑣𝑖 𝑘 + 𝑏𝑤1 𝑝𝑏 𝑘 − 𝑥 𝑘 + 𝑐𝑤2(𝑝𝑔 𝑘 − 𝑥 𝑘 )

• Where k is the iteration number, 𝑎 is the inertia weight, 𝑏 and 𝑐 are the learning factors called personal influence and social influence, respectively, and w1 and w2 are random numbers taken from [0,1].

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/18

Page 19: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Update the position

• Based on the new velocity, the new position is obtained as follows:

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/19

)1()()1( kvkxkx

x(k)

x(k+1)pg(k)

pb(k)

v(k)

Page 20: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Physical meaning of PSO

• Each particle tries to learn from the current leader as well as the best position found by itself.

• The amount of information (influence) obtained from the leader and the best position found so far depends on the learning factors b and c.

• Also depends on the random factors w1 and w2. Thus, we will obtain a different solution in a different run.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/20

Page 21: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Parameters and Their Values

• n: Number of particles (population size).

• a: the inertia weight, usually increases linearly during learning from a0 (=0.4) to a1 (=0.9).

• b:Cognitive (personal) learning factor which controls the movement towards its own success (=2).

• c: Social learning factor which controls the movement towards the leader (=2).

• A neighborhood size will also be used to define local leaders for different regions.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/21

Page 22: Lecture 09: Swarm Intelligenceqf-zhao/TEACHING/MH/Lec09.pdf · What is swarm intelligence? • Swarm intelligence (SI) is also a group of population based optimization/search algorithms

Team Work II

• Select one of the following topics:

– Try to solve the TSP problem with 10 nodes using GA, and ACO, and compare their performance.

– Try to find the minimum points of the following functions, using GA, DE, and PSO, and compare their performance.

An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec09/22

048.2047.2,)1()(100),(

12.511.5,),,(

2

1

2

2

2

1212

3

1

2

3211

i

i

i

i

xxxxxxf

xxxxxf