Online lecture at the School of Computer Science, University of Hertfordshire, Hatfield, UK, as part of the 10th Europe Week from 3rd to 7th March 2014.
Genetic Algorithms and Ant Colony Optimisation (lecture slides)
1. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Genetic Algorithms and
Ant Colony Optimisation
- An Introduction -
Prof. Dr. Dagmar Monett Díaz
Computer Science Dept.
Faculty of Cooperative Studies
Berlin School of Economics and Law
dagmar@monettdiaz.com
Europe Week, 3rd – 7th March 2014
2. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 2
Can you guess what it is?
3. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
4. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
5. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
6. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
7. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
8. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
9. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
By Roger Alsing
At http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/
After 904 314 iterations, the evolution of only 50 semi-
transparent polygons is almost perfect to Mona Lisa!!
Evolution of Mona Lisa
10. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 10
Agenda
11. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 11
Agenda
Where does the major content come from?
What are metaheuristics?
What is to be optimised?
Examples of metaheuristics
What do GA and ACO have in common?
Genetic Algorithms
Ant Colony Systems
Metaheuristics: current trends
Further reading, sources of inspiration, and more…
13. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Genetic Algorithms in
Search, Optimization, and
Machine Learning
David E. Goldberg
432 pp.
Addison-Wesley, 1989
ISBN-13: 978-0201157673
What I also use in my
lectures at the HWR…
13
14. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Genetic Algorithms
+ Data Structures
= Evolution Programs
Zbigniew Michalewicz
3rd, revised and extended Edition
Springer-Verlag, 1999
ISBN-13: 978-3540606765
What I also use in my
lectures at the HWR…
14
15. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Ant Colony Optimization
Marco Dorigo and Thomas Stützle
MIT Press, Cambridge, MA, 2004
ISBN-13: 978-3540606765
15
Further reading
16. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Further reading
M. Dorigo, M. Birattari and T. Stützle (2006): “Ant Colony
Optimization: Artificial Ants as a Computational Intelligence
Technique”.
Available at
http://iridia.ulb.ac.be/IridiaTrSeries/rev/IridiaTr2006-
023r001.pdf
M. Dorigo and K. Socha (2007): “An Introduction to Ant
Colony Optimization”.
Available at
http://iridia.ulb.ac.be/IridiaTrSeries/rev/IridiaTr2006-
010r003.pdf
16
17. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 17
What are metaheuristics?
18. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
A metaheuristic is…
„[…] a master strategy that guides and modifies
other heuristics (like local search procedures) to
produce solutions beyond those that are normally
generated in a quest for local optimality.“
18
According to Laguna (2002)
19. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 19
What is to be optimised?
20. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Bowled function
20
Z = X.^2 + Y.^2
21. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Mexican hat
21
Z = sin(sqrt(X.^2+Y.^2)) ./ sqrt(X.^2+Y.^2)
29. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Other domains
29
Quadratic assignment problems
Scheduling problems
Vehicle routing
Routing in communication networks
Graph colouring
Design problems in engineering
And many, many more!
30. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 30
Examples of metaheuristics
31. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Metaheuristics
31
Traditional approaches:
32. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Metaheuristics
32
Traditional approaches:
EC (Evolutionary Computation)
• GA (Genetic Algorithms), ES (Evolution
Strategies), GP (Genetic Programming), etc.
33. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Metaheuristics
33
Traditional approaches:
EC (Evolutionary Computation)
• GA (Genetic Algorithms), ES (Evolution
Strategies), GP (Genetic Programming), etc.
SA (Simulated Annealing), TS (Tabu Search),
ANN (Artificial Neural Networks), EDA (Estimation
of Distribution Algorithms), ACO (Ant Colony
Optimization), etc.
34. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Metaheuristics
34
Traditional approaches:
EC (Evolutionary Computation)
• GA (Genetic Algorithms), ES (Evolution
Strategies), GP (Genetic Programming), etc.
SA (Simulated Annealing), TS (Tabu Search),
ANN (Artificial Neural Networks), EDA (Estimation
of Distribution Algorithms), ACO (Ant Colony
Optimization), etc.
Hybrid metaheuristics recent approaches!
35. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 35
What do GA and ACO have in
common?
36. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA and ACO
36
37. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA and ACO
37
Nature-inspired algorithms
GA (Holland, 1975): simulates the process of
natural selection (i.e. Darwin’s theory of evolution)
ACO (Dorigo, 1991): simulates behaviour of ant
colonies
38. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA and ACO
38
Nature-inspired algorithms
GA (Holland, 1975): simulates the process of
natural selection (i.e. Darwin’s theory of evolution)
ACO (Dorigo, 1991): simulates behaviour of ant
colonies
Population-based algorithms
39. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA and ACO
39
Nature-inspired algorithms
GA (Holland, 1975): simulates the process of
natural selection (i.e. Darwin’s theory of evolution)
ACO (Dorigo, 1991): simulates behaviour of ant
colonies
Population-based algorithms
Stochastic search methods (probabilities are used)
40. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA and ACO
40
Nature-inspired algorithms
GA (Holland, 1975): simulates the process of
natural selection (i.e. Darwin’s theory of evolution)
ACO (Dorigo, 1991): simulates behaviour of ant
colonies
Population-based algorithms
Stochastic search methods (probabilities are used)
Near-optimal solutions are to be found (global
convergence is not guaranteed)
41. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA and ACO
41
Nature-inspired algorithms
GA (Holland, 1975): simulates the process of
natural selection (i.e. Darwin’s theory of evolution)
ACO (Dorigo, 1991): simulates behaviour of ant
colonies
Population-based algorithms
Stochastic search methods (probabilities are used)
Near-optimal solutions are to be found (global
convergence is not guaranteed)
Parameter tuning plays an important role
42. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 42
Genetic Algorithms
– Pseudo code –
43. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA pseudo code
43
begin GA;
t = 0;
random P( t );
evaluate P( t );
statistics P( t );
while not done {
t = t+1;
P' = select P( t );
recombine P'( t );
evaluate P'( t );
P = survive P( t ), P'( t )
statistics P( t );
}
end GA;
44. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA pseudo code
44
begin GA;
t = 0;
random P( t );
evaluate P( t );
statistics P( t );
while not done {
t = t+1;
P' = select P( t );
recombine P'( t );
evaluate P'( t );
P = survive P( t ), P'( t )
statistics P( t );
}
end GA;
Initialize a usually random
population of individuals
45. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA pseudo code
45
begin GA;
t = 0;
random P( t );
evaluate P( t );
statistics P( t );
while not done {
t = t+1;
P' = select P( t );
recombine P'( t );
evaluate P'( t );
P = survive P( t ), P'( t )
statistics P( t );
}
end GA;
Evaluate the fitness of all
individuals
46. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA pseudo code
46
begin GA;
t = 0;
random P( t );
evaluate P( t );
statistics P( t );
while not done {
t = t+1;
P' = select P( t );
recombine P'( t );
evaluate P'( t );
P = survive P( t ), P'( t )
statistics P( t );
}
end GA;
Compute statistics, keep
the best individual so far,
etc.
47. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA pseudo code
47
begin GA;
t = 0;
random P( t );
evaluate P( t );
statistics P( t );
while not done {
t = t+1;
P' = select P( t );
recombine P'( t );
evaluate P'( t );
P = survive P( t ), P'( t )
statistics P( t );
}
end GA;
Test for termination criteria
48. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA pseudo code
48
begin GA;
t = 0;
random P( t );
evaluate P( t );
statistics P( t );
while not done {
t = t+1;
P' = select P( t );
recombine P'( t );
evaluate P'( t );
P = survive P( t ), P'( t )
statistics P( t );
}
end GA;
Select a sub-population for
offspring production
49. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA pseudo code
49
begin GA;
t = 0;
random P( t );
evaluate P( t );
statistics P( t );
while not done {
t = t+1;
P' = select P( t );
recombine P'( t );
evaluate P'( t );
P = survive P( t ), P'( t )
statistics P( t );
}
end GA;
Stochastically perturb
genes of selected
parents (apply mutation
operators) and recombine
them (apply crossover
operators)
50. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA pseudo code
50
begin GA;
t = 0;
random P( t );
evaluate P( t );
statistics P( t );
while not done {
t = t+1;
P' = select P( t );
recombine P'( t );
evaluate P'( t );
P = survive P( t ), P'( t )
statistics P( t );
}
end GA;
Evaluate the new fitness
of all individuals
51. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA pseudo code
51
begin GA;
t = 0;
random P( t );
evaluate P( t );
statistics P( t );
while not done {
t = t+1;
P' = select P( t );
recombine P'( t );
evaluate P'( t );
P = survive P( t ), P'( t );
statistics P( t );
}
end GA;
Select the survivors for
next generations. Should
you apply elitism?
52. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
GA pseudo code
52
begin GA;
t = 0;
random P( t );
evaluate P( t );
statistics P( t );
while not done {
t = t+1;
P' = select P( t );
recombine P'( t );
evaluate P'( t );
P = survive P( t ), P'( t )
statistics P( t );
}
end GA;
Compute new statistics
54. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 54
Genetic Algorithms
– Basic components –
55. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Basic components
55
56. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Basic components
56
A genetic representation of solutions to the
problem,
57. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Basic components
57
A genetic representation of solutions to the
problem,
a way to create an initial population of solutions,
58. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Basic components
58
A genetic representation of solutions to the
problem,
a way to create an initial population of solutions,
an evaluation function (i.e., the environment),
rating solutions in terms of their ‘fitness’
59. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Basic components
59
A genetic representation of solutions to the
problem,
a way to create an initial population of solutions,
an evaluation function (i.e., the environment),
rating solutions in terms of their ‘fitness’
‘genetic’ operators that alter the genetic
composition of children during reproduction, and
60. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Basic components
60
A genetic representation of solutions to the
problem,
a way to create an initial population of solutions,
an evaluation function (i.e., the environment),
rating solutions in terms of their ‘fitness’
‘genetic’ operators that alter the genetic
composition of children during reproduction, and
values for the parameters (population size,
probabilities of applying genetic operators, etc.)
61. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 61
Genetic Algorithms
– Genetic operators –
62. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Example of crossover operator
62
Single point crossover (Also “Simple crossover”)
Parents:
Offspring:
Crossover point: kth position
. . . . . .
1 k k+1 q
P1=(x1, …, xq)
P2=(y1, …, yq)
O1=(x1, …, xk, yk+1, …, yq)
O2=(y1, …, yk, xk+1, …, xq)
63. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Example of mutation operator
63
Boundary mutation
When using floating point representation: assign the new
allele the value of one of the boundaries:
if r < 0.5 then
NewAllele := LowerBound;
else NewAllele := UpperBound;
with r generated at random in [0, 1]
LowerBound UpperBound
NewAllele = or
OldAllele
64. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 64
Genetic Algorithms
– Other issues –
65. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Other issues
65
Representation of individuals
Selection mechanisms
Parallel implementations
Adaptive Genetic Algorithms
Other evolutionary algorithms
Application domains
66. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 66
Ant Colony Optimization
67. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
ACO
67
Strategies of real ants (e.g. to find food) are used
to solve optimisation problems
The behaviour of the system (swarm) emerges as
a result of the indirect communication of individuals
through the environment (‘stigmergy’)
Ants lay and follow pheromone trails
Deposited pheromone on a path depends on the
quality of that solution. It evaporates with time.
Ants collectively search the solution space
68. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 68
Ant Colony Optimization
– Pseudo code –
79. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 79
Metaheuristics: current trends
80. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Current trends
Combination of aspects from different
metaheuristics, Artificial Intelligence, Operations
Research techniques, etc.
Parallel algorithms to distribute the
computational effort.
Optimization of parameters (i.e. configuration
process) is a relevant issue
Application to other domains
81. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Configuration of algorithms
(or “fine-tuning” of algorithms)
Not all metaheuristic algorithms are auto-adaptive (in
particular the hybrid approaches)
Usually, control parameters are set by hand or in the spirit
of brute-force mechanisms; time-consuming task
Few published research works; not yet an established
research area
Distributed, remote or parallel execution of configuration
algorithms: not existing (?)
Shortcomings:
Special topic in most recent conferences and workshops;
current open question!!
84. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Questions
84
Mention and comment three similarities
between Genetic Algorithms and Ant Colony
Optimisation!
Mention and comment three differences!
PLEASE ANSWER AT:
https://docs.google.com/forms/d/1Mog_vgm1hFV4CLnM1XjYUYVmPlepH6iu9OTeivKONQA/viewform
85. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 85
References
86. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Others…
86
87. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Further reading and sites…
Metaheuristics Network, at
http://www.metaheuristics.net/
Ant Colony Optimization, official Web site of the
ant colony metaheuristic, at http://www.aco-
metaheuristic.org/
87
88. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 88
Can you guess what it is?
89. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
516 – 7
90. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
1 013 – 9
91. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
2 520 – 15
92. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
3 519 – 16
93. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
5 012 – 21
94. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
7 015 – 21
95. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
10 016 – 24
96. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
15 017 – 25
97. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
20 039 – 27
98. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
35 008 – 38
99. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
51 479 – 52
100. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
160 768 – 86
101. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
356 051 – 103
102. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
1 008 736 – 140
103. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 103
?
104. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield
Timmy
105. D. Monett – Europe Week 2014, University of Hertfordshire, Hatfield 105
Slides of the talk per request:
dagmar@monettdiaz.com
Prof. Dr. Dagmar Monett Díaz
monettdiaz
@dmonett
http://monettdiaz.com