Evolutionary computation Evolutionary Computation

Evolutionary Computation
Inspiring principle: theory of natural selection
Evolutionary computation
“Species face the problem of searching for beneficial
adaptations to the environment. The knowledge that each
species has gained is embodied in the makeup of the
chromosomes of its members.” (Davis, Genetic Algorithms
and Simulated Annealing, 1987)
Andrea Roli
[email protected]
Dipartimento di Scienze
Università degli Studi “G. D’Annunzio”
Chieti-Pescara
Example: rabbits
Evolutionary computation – p.1
Evolutionary Computation
Evolutionary computation – p
Evolutionary Computation
Evolutionary Computation (EC) encompasses:
Genetic Algorithms
Genetic Programming
Evolution Strategies
Estimation of Distribution Algorithms
Evolutionary computation – p.2
Evolutionary computation – p
Problem solving
Time series analysis and forecasting (e.g., financial
forecasting)
More applications
Artificial Life (e.g., cellular automata, analysis of
complex adaptive systems)
Objectives
Games (e.g., Prisoner’s Dilemma)
Optimization
Adaptive systems design
Simulation
Challenge: find a problem where EC has NOT been
applied!
Evolutionary computation – p.5
Evolutionary computation – p
Optimization (discrete and continuous)
NATURAL EVOLUTION
Individual
Fitness
Environment
Evolutionary computation – p.6
Signal processing (e.g., artificial vision)
Neural network training (e.g., robotics)
The Metaphor
System design (e.g., airplanes, electronic circuits,
mechanical elements)
Genetic Algorithms
Some applications
ARTIFICIAL SYSTEMS
A possible solution
Quality
Problem
Evolutionary computation – p
A bit of terminology
Genetic operators
A population is the set of individuals (solutions)
Mutation
Individuals are also called genotypes or
chromosomes (if one solution
one chromosome)
Recombination
Chromosomes are made of units called genes
Replacement/insertion
Selection
The domain of values of a gene is composed of alleles
(e.g., a binary variable/gene has two alleles)
Evolutionary computation – p.9
Evolutionary computation – p.
The Evolutionary Cycle
EC algorithms define a basic computational procedure
which uses the genetic operators.
PARENTS
The definition of the genetic operators specifies the actual
algorithm.
SELECTION
Genetic operators
RECOMBINATION
POPULATION
The definition of the genetic operators depends upon the
MUTATION
REPLACEMENT
problem at hand.
OFFSPRING
Evolutionary computation – p.10
Evolutionary computation – p.
Genetic Algorithms
Simple Genetic Algorithm
Developed by John Holland (early ’70) with the aim of:
Understand adaptive processes of natural systems
Solutions are coded as bit strings
CHROMOSOME
Design robust (software) artificial systems
Integer
Real
0 1 1 0 0 1 0 1 1 1
Plan
GENE
Rules
.....
PHENOTYPE
GENOTYPE
Evolutionary computation – p.13
Evolutionary computation – p.
Example
Optimization of a function of integer variable
Derived from the natural metaphor
string of 7 bit
binary coding
‘Programming oriented’
4 bits per digit
string of 12 bit
Very simple model
:
Simple Genetic Algorithm
You can take it as a first step toward evolutionary algorithms
in general
Evolutionary computation – p.14
Evolutionary computation – p.
Genetic operators (1)
Mutation: each gene has probability
(’flipped’)
Genetic operators (3)
of being modified
Selection acts in the choice of parents and produces the
mating pool.
Proportional selection: the probability for an individual
to be chosen is proportional to its fitness.
0 1 1 0 0 1 0 1 1 1
0 1 1 0 0 1 0 0 1 1
Evolutionary computation – p.17
Evolutionary computation – p.
Genetic operators (2)
Genetic operators (3)
Roulette wheel
Crossover: cross-combination of two chromosomes
(loosely resembling human crossover)
10%
0 1 1 0 0 1
1 1 0 1 0 0
0 1 1 1
0 0 1 0
0 1 1 0 0 1
1 1 0 1 0 0
0 0 1 0
10%
0 1 1 1
25%
Evolutionary computation – p.18
50%
5%
50
25
10
10
5
Evolutionary computation – p.
Genetic operators (4)
Termination conditions
Generational replacement: The new generation replaces
entirely the old one.
Advantage: very simple, computationally not
(extremely) expensive, easier theoretical analysis.
Disadvantage: we could loose good solutions
The basic question is: when to stop?
Execution time limit reached
We are satisfied with the solution(s) obtained
Stagnation (limit: the population converged to the same
individual)
Evolutionary computation – p.21
!! *
has fitness
}
* * , '(&
+ )
$%
Evaluate Population{Individual
for
to
do
Eval( )
end for
Evolutionary computation – p.22
}
* '(&
+ )
Initialize Population{
individuals
for
to
do
InitialSolution() {e.g., random}
end for
*,
Initialize Population
Evaluate Population
while Termination conditions not met do
while New population not completed do
Select two parents for mating
Apply crossover
Apply mutation to each new individual
end while
New population
Population
Evaluate Population
end while
$#"
Simple Genetic Algorithm
!
High-level algorithm
Evolutionary computation – p.
Evolutionary computation – p.
Simple Genetic Algorithm
Apply mutation to individual
for
to
do
Random(0,1)
then
if
Complement
end if
end for
E
& D
H
FG
'6
7
)
end for
for
to do
Random(0,
);
while
AND
;
end while
)
4
+
&
+
6
90
90 6 5
*,
& 90
+ & 6:
5 8
)
3
;
do
6
+
*
<;-
90
+
&:
2 /0
+
8
;B
+
8
8
3
2 + /0
102/ ('&
do {all fitness values are summed up}
3 5
*,
to
)
for
;A
?@
> /
)
+
('&
4
{Roulette wheel selection}
3
102/
.-
Select parents:
Simple Genetic Algorithm
end for
Evolutionary computation – p.25
Evolutionary computation – p.
Simple Genetic Algorithm
. - = - = ('& +
& DE & DE
)
+ +
.- - 8C
& DE & DE
) ></
?@
;A
;B
8
. - = - = ('&
& DE & DE
8
+ +
- .- > /
& DE & DE ; ?@
A
;B
end for
for
to
-=
. -=
we get
){crossover point}
.-
Apply crossover: from
Random(1,
for
to
do
SGA: Example
Maximization of a real function
Taken from:
http://www.evonet.polytechnique.fr/CIRCUS2/
do
end for
Evolutionary computation – p.26
Evolutionary computation – p.
Fitness Landscape
Why does it work?
Representation of the space of all possible genotypes,
along with their fitness.
Intuition:
Crossover combines good parts from good solutions
(but it might also destroy sometimes)
Mutation introduces diversity
Selection drives the population toward high fitness
Evolutionary computation – p.29
Evolutionary computation – p.
Fitness Landscape
SGA: pros and cons
Pros:
Caution!
Extremely simple
Different landscapes for different operators
General purpose
In many cases fitness landscapes are dynamic
Theoretical models
Landscape ‘intuition’ might be misleading
Cons:
Use of term local optimum used and abused
everywhere
Coding
Too simple genetic operators
Evolutionary computation – p.30
Evolutionary computation – p.
A recipe
Multi-point crossover
The ingredients to prepare a GA:
Solution coding (e.g., bit strings, programs, arrays of real
variables, etc.)
Define a way of evaluating solutions (e.g., objective
function value, result of a program, behavior of a system,
etc.)
1 1
0 1 1 0 0 1
0 1 1 1
1 0
1 1 0 1 0 0
0 0 1 0
1 0
0 1 1 0 0 1
0 0 1 0
Define recombination operators (crossover , mutation)
Define the selection and replacement/insertion
mechanisms
Evolutionary computation – p.33
Toward less simple GA
Evolutionary computation – p.
Multi-parent crossover
Recombination:
Multi-point crossover (recombination of more than 2
“pieces” of chromosomes)
Multi-parent crossover (an individual is generated by
more than 2 parents)
Uniform crossover (children created by randomly
shuffling the parent variables at each site)
1 1
0 1 1
0 1 1
0 1 1 1
1 0
1 1 0
0 0 0
0 0 1 0
1 0
1 1 0
0 1 0
1 1 0 0
0 0
0 1 1
1 1 1
0 1 1 0
1 1 1 1 0 0 1 0 0 1 1 0
Evolutionary computation – p.34
Evolutionary computation – p.
Toward less simple GA
Mutation:
- Solution:
I
J
I
J
K
Ex: real valued variables
L
M
, accepted if
P
P
, with
P
R
P
Q
ON
- Crossover: linear combination
such that
.
S
N
I
S
J
In optimization, hill-climbing or more complex local
search algorithms can be applied
L
M
I
J
- Mutation: random perturbation
Learning applied to modify the chromosome
Interesting topic: Evolution & Learning,
www.cogs.susx.ac.uk/users/ezequiel/alife-page/evolearn.html
Evolutionary computation – p.37
Evolutionary computation – p.
Toward less simple GA
VU
W
is a permutation of
Different probability distribution (e.g., probability
distribution based on the ranking of individuals)
Y W O
- Solution:
T
X
Selection:
T
Example: permutations
Evolutionary computation – p.38
Y
Tournament Selection (iteratively pick two or more
individuals and put in the mating pool the fittest)
- Mutation: random exchange of two elements in the
-ple
- Crossover: like 2-point crossover, but avoiding value
repetition (see next example).
Evolutionary computation – p.
Eight Queens
Eight Queens
Mutation: exchanging two numbers
1
2
1
3
5
4
8
7
1
2
4
3
5
1
8
7
Z[
Z
Place 8 queens on a
chessboard in such a way that
the queens cannot attack each other.
Evolutionary computation – p.41
Evolutionary computation – p.
Eight Queens
Eight Queens
Genotype: a permutation of the numbers 1 through 8
3
2
4
6
5
8
7
1
Evolutionary computation – p.42
Crossover: combining two parents
1
3
5
2
6
4
7
8
1
3
5
4
2
8
7
6
8
7
6
5
4
3
2
1
8
7
6
2
4
1
3
5
Evolutionary computation – p.
Eight Queens
Mondriaan Art
Fitness: penalty of a queen is the number of queens it can
check.
The fitness of the configuration is the sum of the single
penalties.
Mondriaan Art
Taken from:
http://www.evonet.polytechnique.fr/CIRCUS2/
Evolutionary computation – p.45
Evolutionary computation – p.
Example
Genetic Programming
Can be seen as a ‘variant’ of GA: individuals are
programs
Taken from:
\
http://ouray.cudenver.edu/ da0todd/neural/third_homework/
dave/test/TSP_Genetic_Algorithm.htm
Evolutionary computation – p.46
Used to build programs that solve the problem at hand
( specialized programs)
]
Traveling Salesman Problem
Extended to automatic design in general (e.g.,
controllers and electronic circuits)
Evolutionary computation – p.
Genetic Programming
Operators
Individuals are trees which encode programs.
Crossover: Exchange two randomly picked subtrees.
1
1
2
2
IF
>
3
1
2
+
IF
3
>
T
+
+
+
4
IF
Fitness given by the evaluation of the program “behavior”
(based upon some defined criteria)
<
4
5
6
T
6
4
2
5
IF
<
+
4
T
2
IF
>
3
6
Evolutionary computation – p.49
Operators
+
T
Evolutionary computation – p.
Operators
Mutation: Random selection of a subtree which is
substituted by a well formed random generated subtree
1
4
Selection and replacement
Fitness is evaluated depending on the application.
+
2
IF
>
3
1
4
6
2
IF
>
3
4
6
*
Y
For assembler worms the fitness can be the memory
they occupied.
For controllers, the fitness can be the percentage of
correct actions
2
Evolutionary computation – p.50
Evolutionary computation – p.
Competitive Coevolution
The realm of GP
Programming the unprogrammable, involving the
automatic creation of computer programs for
unconventional computing devices. E.g.,cellular
automata, parallel systems, multi-agent systems, etc.
Species evolve trying to face each other
Black art problems. E.g.,automated synthesis of analog
electrical circuits, controllers, antennas, and other areas
of design
E.g., prey/predator, herbivore/plants.
Applications: ALU design for Cray computer,
(pseudo-)random number generator.
Evolutionary computation – p.53
Evolutionary computation – p.
Cooperative Coevolution
Coevolution
Species evolve complementary capabilities to survive in
their environment
Species evolve in the same environment
dynamic environment
E.g., host/parasite.
Two kinds:
Applications: ‘niche’ genetic algorithms for multi-criteria
optimization.
Competitive
Cooperative
Evolutionary computation – p.54
Evolutionary computation – p.
Some references
M.Mitchell. Genetic Algorithms. MIT Press, 1999.
Z.Michalewicz. Genetic Algorithms + Data Structures =
Evolution Programs, Springer, 1992.
D.E.Golberg. Genetic Algorithms in Search,
Optimization and Machine Learning. Addison-Wesley,
1989.
W.B.Langdon, R.Poli. Foundations of Genetic
Programming. Springer, 2001.
Evolutionary computation – p.57
On the Internet
EvoNet: http://www.evonet.polytechnique.fr/
www.genetic-programming.com
GALib http://lancet.mit.edu/ga/
http://www.aic.nrl.navy.mil/galist/
www.isgec.org
Evolutionary computation – p.58