You are on page 1of 43

Introduction

Algorithm
Examples
Conclusions

Genetic algorithms and evolutionary programming


Fabian J. Theis
Institute of Biophysics
University of Regensburg, Germany

fabian@theis.name

Regensburg 11-Jan-05

Theis Genetic algorithms and evolutionary programming


Introduction
Algorithm
Examples
Conclusions

Outline

Introduction Selection
Reinforcement learning Reproduction
Imitate nature Examples
Genetic algorithms 2d-function optimization
Algorithm Genetic Mastermind
Basic algorithm Hyerplane detection
Data representation Conclusions

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Algorithm

Introduction Selection
Reinforcement learning Reproduction
Imitate nature Examples
Genetic algorithms 2d-function optimization
Algorithm Genetic Mastermind
Basic algorithm Hyerplane detection
Data representation Conclusions

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Introduction

I idea of genetic algorithms (GAs)


I extract optimization strategies nature uses successfully →
Darwinian Evolution
I transform them for application in mathematical optimization
theory
I abstract goal: find the global optimum of a problem/function
in a defined phase space

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Introduction

I idea of genetic algorithms (GAs)


I extract optimization strategies nature uses successfully →
Darwinian Evolution
I transform them for application in mathematical optimization
theory
I abstract goal: find the global optimum of a problem/function
in a defined phase space

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Optimization

I GA as special kind of reinforcement learning


I no access to the full problem/function
I but: rewards are given for a given action/search space position
I goal: use rewards to find optimum
I this contrasts to learning by (given) examples as in supervised
learning e.g. using neural networks
I → traverse search space manually

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Optimization

I simple algorithm: random sampling


I pick a single location in the search space
I store it if reward is higher than at previous locations, discard it
otherwise
I repeat
I other such algorithms
I Markov-Chain-Monte-Carlo search (MCMC)
I simulated annealing
I if derivative of reward is available: (conjugated) gradient
ascent/descent etc.

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Optimization

I simple algorithm: random sampling


I pick a single location in the search space
I store it if reward is higher than at previous locations, discard it
otherwise
I repeat
I other such algorithms
I Markov-Chain-Monte-Carlo search (MCMC)
I simulated annealing
I if derivative of reward is available: (conjugated) gradient
ascent/descent etc.

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Genetic algorithms

I here: imitate nature’s robust way of evolving successful


organisms
I organisms ill-suited to an environment die off, whereas fit ones
reproduce
I offspring is similar to the parents, so population fitness
increases with generations
I mutation can randomly generate new species
I ‘The Origin of Species by Means of Natural Selection’, C.R.
Darwin, D. Appleton and Company, NY, 1897
I history:
I introduced by J. Holland 1975
I further invesigated by his students e.g. K. DeJong 1975
I more recently theoretical advances e.g. by M. Vose 1993

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Genetic algorithms

I what’s good for nature is good for artificial systems


I imagine population of individual ‘explorers’ sent into the
optimization phase-space
I explorer is defined by its genes, encoding his phase-space
position
I optimization problem is given by a fitness function
I the struggle of ‘life’ begins
I selection
I crossover
I mutation
I according to these rules populations tend to increase overall
fitness

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Genetic algorithms

I what’s good for nature is good for artificial systems


I imagine population of individual ‘explorers’ sent into the
optimization phase-space
I explorer is defined by its genes, encoding his phase-space
position
I optimization problem is given by a fitness function
I the struggle of ‘life’ begins
I selection
I crossover
I mutation
I according to these rules populations tend to increase overall
fitness

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Genetic algorithms

I what’s good for nature is good for artificial systems


I imagine population of individual ‘explorers’ sent into the
optimization phase-space
I explorer is defined by its genes, encoding his phase-space
position
I optimization problem is given by a fitness function
I the struggle of ‘life’ begins
I selection
I crossover
I mutation
I according to these rules populations tend to increase overall
fitness

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Genetic algorithms

I what’s good for nature is good for artificial systems


I imagine population of individual ‘explorers’ sent into the
optimization phase-space
I explorer is defined by its genes, encoding his phase-space
position
I optimization problem is given by a fitness function
I the struggle of ‘life’ begins
I selection
I crossover
I mutation
I according to these rules populations tend to increase overall
fitness

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Genetic algorithms

I advantages
I global not only local optimization
I simple and hence easy to implement
I easy parallelization possible
I disadvantages
I how to encode phase-space position
I rather low speed and high computational cost
I parameter dependencies (population size, selection and
reproduction parameters)

Theis Genetic algorithms and evolutionary programming


Introduction
Reinforcement learning
Algorithm
Imitate nature
Examples
Genetic algorithms
Conclusions

Genetic algorithms

I advantages
I global not only local optimization
I simple and hence easy to implement
I easy parallelization possible
I disadvantages
I how to encode phase-space position
I rather low speed and high computational cost
I parameter dependencies (population size, selection and
reproduction parameters)

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Algorithm

Introduction Selection
Reinforcement learning Reproduction
Imitate nature Examples
Genetic algorithms 2d-function optimization
Algorithm Genetic Mastermind
Basic algorithm Hyerplane detection
Data representation Conclusions

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Basic genetic algorithm

Data : population, a set of individuals


fitness-function Fitness, a function measuring fitness
of an individual
Result: an individual
repeat
1 parents ← Selection (population, Fitness)
2 population ← Reproduction (parents)
until some individual is fit enough;
3 return the best individual in population according to Fitness

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Individual

I an individual encodes the data space position


I classic GA approach: representation by word (chromosome)
over a finite alphabet
I each letter is called gene
I real DNA: alphabet is {A, G , T , C }
I here: usually binary alphabet {0, 1}
I some authors speak more general of evolutionary programming
if alphabet is larger
I finite alphabet implies discrete search space
I continuous search space
I use continuous ‘alphabet’ i.e. genes ∈ R or bounded genes
∈ [a, b]
I so individual ∈ Rn respectively ∈ [a1 , b1 ] × . . . × [an , bn ]

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Individual

I an individual encodes the data space position


I classic GA approach: representation by word (chromosome)
over a finite alphabet
I each letter is called gene
I real DNA: alphabet is {A, G , T , C }
I here: usually binary alphabet {0, 1}
I some authors speak more general of evolutionary programming
if alphabet is larger
I finite alphabet implies discrete search space
I continuous search space
I use continuous ‘alphabet’ i.e. genes ∈ R or bounded genes
∈ [a, b]
I so individual ∈ Rn respectively ∈ [a1 , b1 ] × . . . × [an , bn ]

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Individual

I an individual encodes the data space position


I classic GA approach: representation by word (chromosome)
over a finite alphabet
I each letter is called gene
I real DNA: alphabet is {A, G , T , C }
I here: usually binary alphabet {0, 1}
I some authors speak more general of evolutionary programming
if alphabet is larger
I finite alphabet implies discrete search space
I continuous search space
I use continuous ‘alphabet’ i.e. genes ∈ R or bounded genes
∈ [a, b]
I so individual ∈ Rn respectively ∈ [a1 , b1 ] × . . . × [an , bn ]

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Selection
I goal: select individuals that produce the next generation
I probabilistic selection
I based on fitness function f
I better individuals have increased chance of reproduction
I usually selection with replacement → very fit individuals
reproduce several times
I selection probabilities
I roulette wheel (Holland 1975)
f (i)
P(choice of individual i) = P
j f (j)

problem: negative f ? minimization?


I ranking methods, i.e. choose individuals according to fitness
rank e.g. normalized geometric ranking (Joines and Houck
1994)
I tournament selection, i.e. select best among a randomly
selected subset
Theis Genetic algorithms and evolutionary programming
Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Selection
I goal: select individuals that produce the next generation
I probabilistic selection
I based on fitness function f
I better individuals have increased chance of reproduction
I usually selection with replacement → very fit individuals
reproduce several times
I selection probabilities
I roulette wheel (Holland 1975)
f (i)
P(choice of individual i) = P
j f (j)

problem: negative f ? minimization?


I ranking methods, i.e. choose individuals according to fitness
rank e.g. normalized geometric ranking (Joines and Houck
1994)
I tournament selection, i.e. select best among a randomly
selected subset
Theis Genetic algorithms and evolutionary programming
Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Selection
I goal: select individuals that produce the next generation
I probabilistic selection
I based on fitness function f
I better individuals have increased chance of reproduction
I usually selection with replacement → very fit individuals
reproduce several times
I selection probabilities
I roulette wheel (Holland 1975)
f (i)
P(choice of individual i) = P
j f (j)

problem: negative f ? minimization?


I ranking methods, i.e. choose individuals according to fitness
rank e.g. normalized geometric ranking (Joines and Houck
1994)
I tournament selection, i.e. select best among a randomly
selected subset
Theis Genetic algorithms and evolutionary programming
Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Reproduction

I typically consists of two stages


I crossover (or mating): selected individuals are randomly paired
and (usually two) children are produced
I mutation: genes can be altered by random mutation to a
different value according to a small probability
I use genetic operators to produce and alter new offspring →
basic search mechanism in GAs

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Reproduction

I typically consists of two stages


I crossover (or mating): selected individuals are randomly paired
and (usually two) children are produced
I mutation: genes can be altered by random mutation to a
different value according to a small probability
I use genetic operators to produce and alter new offspring →
basic search mechanism in GAs

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Crossover
I let x, y ∈ An be the genes of the two parents
I simple crossover
I choose r randomly in {1, . . . , n}
I generate children x0 , y0 ∈ An by

xi if i < r
xi0 :=
yi otherwise

yi if i < r
yi0 :=
xi otherwise

I in the case of continuous genes: arithmetic crossover


I choose r randomly in [0, 1]
I generate children x0 , y0 ∈ An by
x0 := r x + (1 − r )y
y0 := (1 − r )x + r y
Theis Genetic algorithms and evolutionary programming
Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Crossover
I let x, y ∈ An be the genes of the two parents
I simple crossover
I choose r randomly in {1, . . . , n}
I generate children x0 , y0 ∈ An by

xi if i < r
xi0 :=
yi otherwise

yi if i < r
yi0 :=
xi otherwise

I in the case of continuous genes: arithmetic crossover


I choose r randomly in [0, 1]
I generate children x0 , y0 ∈ An by
x0 := r x + (1 − r )y
y0 := (1 − r )x + r y
Theis Genetic algorithms and evolutionary programming
Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Crossover
I let x, y ∈ An be the genes of the two parents
I simple crossover
I choose r randomly in {1, . . . , n}
I generate children x0 , y0 ∈ An by

xi if i < r
xi0 :=
yi otherwise

yi if i < r
yi0 :=
xi otherwise

I in the case of continuous genes: arithmetic crossover


I choose r randomly in [0, 1]
I generate children x0 , y0 ∈ An by
x0 := r x + (1 − r )y
y0 := (1 − r )x + r y
Theis Genetic algorithms and evolutionary programming
Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Mutation

I let xi ∈ A be the gene of an individual that is to be mutated


I binary gene: binary mutation
I xi0 := 1 − xi
I discrete or continuous bounded A: uniform mutation
I set xi0 to be a uniformly randomly chosen element of A
I also possible: non-uniform mutation
I needs fixed distribution for element choice

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Mutation

I let xi ∈ A be the gene of an individual that is to be mutated


I binary gene: binary mutation
I xi0 := 1 − xi
I discrete or continuous bounded A: uniform mutation
I set xi0 to be a uniformly randomly chosen element of A
I also possible: non-uniform mutation
I needs fixed distribution for element choice

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Mutation

I let xi ∈ A be the gene of an individual that is to be mutated


I binary gene: binary mutation
I xi0 := 1 − xi
I discrete or continuous bounded A: uniform mutation
I set xi0 to be a uniformly randomly chosen element of A
I also possible: non-uniform mutation
I needs fixed distribution for element choice

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

Mutation

I let xi ∈ A be the gene of an individual that is to be mutated


I binary gene: binary mutation
I xi0 := 1 − xi
I discrete or continuous bounded A: uniform mutation
I set xi0 to be a uniformly randomly chosen element of A
I also possible: non-uniform mutation
I needs fixed distribution for element choice

Theis Genetic algorithms and evolutionary programming


Introduction Basic algorithm
Algorithm Data representation
Examples Selection
Conclusions Reproduction

One generation example

Theis Genetic algorithms and evolutionary programming


Introduction
2d-function optimization
Algorithm
Genetic Mastermind
Examples
Hyerplane detection
Conclusions

Algorithm

Introduction Selection
Reinforcement learning Reproduction
Imitate nature Examples
Genetic algorithms 2d-function optimization
Algorithm Genetic Mastermind
Basic algorithm Hyerplane detection
Data representation Conclusions

Theis Genetic algorithms and evolutionary programming


Introduction
2d-function optimization
Algorithm
Genetic Mastermind
Examples
Hyerplane detection
Conclusions

Examples

I continuous example
I global optimization of continuous function f : [a, b] → R
I binary example
I genetic Mastermind
I select optimal guess using GA
I example from our research
I perform overcomplete blind source separation by sparse
component analysis
I key problem: hyperplane detection
I solution: optimize cost function using GAs

Theis Genetic algorithms and evolutionary programming


Introduction
2d-function optimization
Algorithm
Genetic Mastermind
Examples
Hyerplane detection
Conclusions

Examples

I continuous example
I global optimization of continuous function f : [a, b] → R
I binary example
I genetic Mastermind
I select optimal guess using GA
I example from our research
I perform overcomplete blind source separation by sparse
component analysis
I key problem: hyperplane detection
I solution: optimize cost function using GAs

Theis Genetic algorithms and evolutionary programming


Introduction
2d-function optimization
Algorithm
Genetic Mastermind
Examples
Hyerplane detection
Conclusions

Examples

I continuous example
I global optimization of continuous function f : [a, b] → R
I binary example
I genetic Mastermind
I select optimal guess using GA
I example from our research
I perform overcomplete blind source separation by sparse
component analysis
I key problem: hyperplane detection
I solution: optimize cost function using GAs

Theis Genetic algorithms and evolutionary programming


Introduction
2d-function optimization
Algorithm
Genetic Mastermind
Examples
Hyerplane detection
Conclusions

2d-function optimization

multipeak

50 50

45
45
40

35
40

30

25 35

20

30
15

10
25
5

−10 −8 −6 −4 −2 0 2 4 6 8 10 20
x 0 10 20 30 40 50 60 70 80 90 100

f performance (optimal individual and mean)

Theis Genetic algorithms and evolutionary programming


Introduction
2d-function optimization
Algorithm
Genetic Mastermind
Examples
Hyerplane detection
Conclusions

Genetic Mastermind

Theis Genetic algorithms and evolutionary programming


Introduction
2d-function optimization
Algorithm
Genetic Mastermind
Examples
Hyerplane detection
Conclusions

Hyerplane detection

1 1

0.5
0.5

0
0
−0.5
1 −0.5 1
−1
1
0.5 −1 0.5
0.5 −1
0 −0.5 0
0
0
−0.5 −0.5
−0.5
0.5

−1 −1 1 −1

I perform overcomplete blind source separation by sparse


component analysis Georgiev et al. [2004], Theis et al. [2004]
I key problem: hyperplane detection
I solution: optimize cost function using GAs

Theis Genetic algorithms and evolutionary programming


Introduction
Algorithm
Examples
Conclusions

Algorithm

Introduction Selection
Reinforcement learning Reproduction
Imitate nature Examples
Genetic algorithms 2d-function optimization
Algorithm Genetic Mastermind
Basic algorithm Hyerplane detection
Data representation Conclusions

Theis Genetic algorithms and evolutionary programming


Introduction
Algorithm
Examples
Conclusions

Conclusions

I genetic algorithms perform global optimization


I they mimic nature by letting a population evolve according to
their fitness
I algorithm
I selection
I reproduction: by crossover and mutation
I simple applicability in real-world situations

Theis Genetic algorithms and evolutionary programming


Introduction
Algorithm
Examples
Conclusions

I Resources I References
I books: Goldberg [1989], P. Georgiev, F. Theis, and A. Cichocki. Sparse
component analysis and blind source
Schöneburg et al. [1994] separation of underdetermined mixtures.
IEEE Trans. on Neural Networks in print,
I Matlab GA optimization
2004.
toolbox: D. Goldberg. Genetic Algorithms in Search
Optimization and Machine Learning.
http://www.ie.ncsu.edu/ Addison Wesley Publishing, 1989.
mirage/GAToolBox/gaot E. Schöneburg, F. Heinzmann, and
S. Feddersen. Genetische Algorithmen und
I Details and papers on my Evolutionsstrategien. Addison Wesley
Publishing, 1994.
website F. Theis, P. Georgiev, and A. Cichocki. Robust
http://fabian.theis.name overcomplete matrix recovery for sparse
sources using a generalized hough
transform. In Proc. ESANN 2004, pages
I This research was supported 343–348, Bruges, Belgium, 2004. d-side,
by the DFG1 and BMBF2 . Evere, Belgium.

1
graduate college: Nonlinearity and Nonequilibrium in Condensed Matter
2
project ’ModKog’
Theis Genetic algorithms and evolutionary programming

You might also like