Sei sulla pagina 1di 9

Evolutionary algorithms

Lecture 2 26.11. 2007

30/11/2007

Basics of EAs continues and genetic algorithms


Some more basics of evolutionary algorithms
Where do they locate in the field of sciences &
engineering

Genetic algorithms
Basic operators and some practical habits
Original Hollands Simple GA

41

Evolutionary algorithms

Evolution algorithms
What are evolutionary
algorithms, and where do
they locate in the world?

Universe

Borg

Vogons

Art

Life Sciences

Image taken from: A.E.


Eiben and J.E. Smith,
Introduction to
Evolutionary Computing

Earth

etc

Biotop

Society

Stones & Seas

etc

Science

Politics

Sports

etc

Social Sciences

Mathematics

30/11/2007

Exact Sciences

etc

Physics

Computer Science

etc

Software Engineering

Computational Intelligence

etc

Neural Nets

Evolutionary Computing

Fuzzy Systems

42

Evolutionary algorithms

Evolution algorithms

30/11/2007

Evolution algorithms are part of computer science and ICT


(Information and Communications Technology)
Evolution algorithms are not part of genetics, biology or
biosciences
Evolution algorithms have however got their inspiration from the
biological processes and terminology
Population, individual, parents, offspring, generations, gene, chromosome,
crossover, mutation, survival of the fittest etc.

Evolution algorithms can be applied to bioscience research

The main weakness of the EA methods are that there is


no complete theory that would explain their operation and
efficiency (we will talk about the suggested theories in
the 6. or 7. lecture)
43

Evolutionary algorithms

Evolution algorithms

30/11/2007

Evolution

Problem solving

Environment
Individual
Fitness

Problem
Solution candidate (trial)
Quality

Fitness

->

Quality

->

will define the probability to survive and


reproduce
will define the probability to act as a
model/basics to the new solution candidates

Individuals are points in the search or fitness space, together the


population individuals represent a cloud of points that moves
around the problem landscape (search space), while they evolve
and adapt

44

Evolutionary algorithms

Evolution algorithms

30/11/2007

Evolution algorithms are so called generate trial and test type


algorithms
Stochastic population based algorithms (a kind of hybrid of
heuristic and stochastic optimization)
Variation operators, crossover and mutation forms some necessary
diversity to the new trials
Selection reduce diversity and acts as a guiding force, that pushes
the mean population fitness higher
Diversity must not decrease too fast, because that usually leads
towards stuck to the local optimum
In nature, the environment is continuously changing, and thats
why species do not usually get stuck the local optimum (optimum
is continuously changing)
In evolutionary algorithms the much higher mutation probability
than in the nature, helps maintain the diversity
45

Evolutionary algorithms

Simplified models of nature

30/11/2007

Things that differs in EAs compared to the genetics in nature include e.g.:
Genotype and phenotype are usually the same, so they are directly coded and
encoded from each others (same genotype always lead the same phenotype and
vice versa), i.e. the environment do not have effect to the phenotype
The individuals do not have sex, there are no male or female, so all the
individuals can mate and crossover with any other individual in the population
The individuals usually have only one chromosome (haploid, gametes), not
chromosome pairs (diploid) or double helix as in real DNA (it is totally possible
to program diploid-EA, but no-one have proved it would be beneficial with any
real problems)
http://en.wikipedia.org/wiki/Gamete
http://en.wikipedia.org/wiki/Ploidy
http://en.wikipedia.org/wiki/Dna

The indivdual can have 1 to n parents, as in nature there can be only one (asexual
reproduction, mutation only) or two (sexual reproduction, crossover) parents
There exist many EAs where new individuals have more than two parents
http://en.wikipedia.org/wiki/Reproduction
http://en.wikipedia.org/wiki/Asexual_reproduction
http://en.wikipedia.org/wiki/Sexual_reproduction

Population size is usually constant during the EA optimization run

46

Evolutionary algorithms

Evolution

30/11/2007

The population consist of different individuals, often each have


different genotype and represents one point in the search space (this
can be forced by preventing and removing possible twins from the population)
Individuals are the units of selection (http://en.wikipedia.org/wiki/Selection)

In crossover the genetic information is rearranged, so the genotype


of the offspring is different than any of old individuals (again this can
be forced)
Population is the unit of evolution

The properties of new individuals are random


The system itself lacks any guiding force or intelligence that would
develop the individuals to some direction

However, the so-called survival of the fittest or only the strong


will survive, and the fact that only the fittest reproduce will
guide the population towards higher fitness and causes the
population to adapt to the environment (problem)
(http://en.wikipedia.org/wiki/Survival_of_the_fittest), (http://en.wikipedia.org/wiki/Adaptation)

47

Evolutionary algorithms

Electronic population in computer

30/11/2007

In evolutionary algorithms the problem and its environment is


modeled and solution trials are encoded to a chromosome
(genotype)

Genotype must be able to represent all the possible solutions inside the
search space
Sometimes this means that it can also represent illegal solutions, and they
must be rule out with other means
Small changes in the genotype must lead to small changes in the organism
(e.g. height, hair color etc.), same with EAs, otherwise they will not work

If we are trying to solve several problems, that are connected,


together or also the optimization environment changes

The we can use so-called co-evolution, where the population contains


individuals from several different species. The fitness value for members of
different species are calculated by the help of other species. The different
species will found some ecological niche, i.e. balance in respect of other
species.
In nature, most of the DNA within a species are the same. This is often fact
with EAs too, the population will converge so that the individuals do not
have much difference

48

Evolutionary algorithms

Crossover

30/11/2007

In nature, most of the species reproduce asexually, e.g.


bacteria, which one may claim are the most successful
species of all (their number is the highest)
If reproduction is asexual, the only way to change the genetic
information is mutation -> this is the basis of mutation only
evolution algorithms that do not use crossover

Most of the evolutionary algorithms use crossover, which


means we select parents, which genotypes are combined
somehow in order to form the genotype of the new
individual, offspring (http://en.wikipedia.org/wiki/Offspring)
The crossover only EAs do not work, because during
the crossover some genetic information is lost, and the
population will not obtain new information without a
mutation
49

Evolutionary algorithms

Crossover

30/11/2007

The crossover only EAs do not work, because during the


crossover some genetic information is lost, and the population will
not obtain new information without a mutation
Below is the example why crossover only wont work; if we are optimizing
all-ones and there does not exist value 1 for some gene in the current
population, the optimum can never be reached without mutation and new
possible value for that gene location
Population of 4 individuals
Individual 1:

The gene values in 8 gene locations:


1

Individual 2:

Individual 3:

Individual 4:

[0, 1]

[0, 1]

[0, 1]

[0, 1]

[0, 1]

The possible values of


each gene location
1
after the crossovers:

50

Evolutionary algorithms

Selecting the parents

30/11/2007

Usually we use methods that favor those individuals that


possess high fitness value
However, totally random parent selection is sometimes used

In the original Holland simple GA parent were selected


by roulette wheel method where each individual got as
big share of wheel as their fitness value compared to the
sum of all fitness values
The parents can also be selected with tournament
selection, where two or more individuals are randomly
selected, and the one with the best fitness value of them is
selected
Most common ways nowadays are ranking based, so the
population is sorted according the fitness values and the
parents will be selected by favoring more with either
linearly or logarithmically raising scale
51

Evolutionary algorithms

Selecting the parents


Likelihood to be
selected as parent

Equal
chance

Elitism
High

Rank of the individual

Elitism

Elitism

low

Linearly
proportional

30/11/2007

Different favoring methods


Equal chance, no favoring
Linear, the chance gets linearly
higher with fitness order
Exponential, the change
increases exponentially with
higher fitness order
Note that even the worst
individual must have chance to
become parent

Exponentially Image also shows that there


proportional
can always be different

amount of elitism used

52

Evolutionary algorithms

Selecting the survivors

30/11/2007

There are different methods how the population is update


=reinserted
Generational GA: every member of old population is
replaced with new individuals
Rarely used in the optimization, because we lose the best candidate so far

Steady state GA: Parents may exist in the population


together with offspring

Elitist GA: Some percentage % of old individuals will survive to the next generation

Again there can be random selection, tournament selection, or ranking based selection.
Ranking based with some % of best is the most common.
If the problem is deterministic we do not need to evaluate the old individuals fitness value
again. If the problem is noisy or nondeterministic, the old individuals must be re-evaluated.

Tournament selection is usually applied so that the new individual will duel
with some random population member, and the more fit will gain the place in
the new population
Often we also use model where the child duel with one of its parents

We can also define lifetime, so that one individual can live in the
population a certain maximum number of generations

53

Evolutionary algorithms

Real coded GA
In the floating point coded GA the
chromosome of GA consist of real
numbers that are within some
boundaries, e.g. [0, 1]
In real coded GA we can use onepoint, multipoint, uniform or
arithmetic crossovers
In real coded GA the mutation can
be random between the boundaries
or Gaussian (adding Gaussian
distributed random number to the
current value)
It is also possible to use binary
coded GA and interpret the bit
vector into floating point numbers

30/11/2007

Arithmetic crossover and mutation:


0.12 0.15 0.72 0.66 0.98 0.11 Parent 1
0.56 0.76 0.28 0.99 0.55 0.88 Parent 2
0.34 0.46 0.50 0.43 0.77 0.50
0.21 0.78 0.63 0.73 0.89 0.26

Child 1
Child 2

The child 1 formed: crossover by


arithmetic mean:
GeneParent1 +GeneParent2
2
The child 2 formed: crossover by
weighted arithmetic mean:
0.8*GeneParent1+0.2*GeneParent2
The mutated gene in bold and is most
likely result of random mutation in child
1 (large change) and Gaussian mutation
in child 2 (small change)
54

Evolutionary algorithms

Arithmetic crossover

30/11/2007

Note!
The arithmetic crossover is an averaging method!
All the non-mutated values of child 1 and child 2 in the
previous slide are between the gene values of parent 1 and
parent 2

Therefore arithmetic crossover always require


mutation, and cannot work and find optimum with
crossover only version
Mutation is the only way to obtain new gene values
that are higher or lower than any of the individuals in
the current population possess
55

Evolutionary algorithms

Mutation

30/11/2007

The role of mutation is to generate and maintain


population diversity
Generates randomness to the method
Also may guarantee connectedness of search space and
convergence proof

mutation probability more than zero, for all gene locations,


means that, in theory, it is possible to travel from all search
space points to the any other point within the search space
during the reproduction
Can be bit flipping in bit coded EAs, and random or Gaussian
distributed with real or integer coded EAs

There is no optimal value for mutation probability, all


problems are different, and different mutation-% is best
The mutation probability can also often change during the
optimization run

56

Evolutionary algorithms

Crossing the border

30/11/2007

If we use Gaussian mutation by adding a Gaussian distributed


random value to the old gene value, it is possible that the gene
value x leave the permitted value area [min, max].

The value can be returned to the permitted area with e.g. following methods:
if (x > max) x=random([min, max]);
(random value within the permitted area)
if (x > max) x=max;
(if over, set vale to the border value)
if (x > max) x=max-(x-max);
(reflect back from the border)
if (x > max) x=min+x-max;
(think area as continuous max=min)
if (x > max) x= max*(max/x);
(turn back to the permitted area)
if (x < min) x=random([min, max]);
if (x < min) x=min;
if (x < min) x=min-(x-min);
if (x < min) x=max-min+x;
if (x < min) x= min*(min/x);

(random value within the permitted area)


(if below, assign the border value)
(reflect as far as it would go over)
(continue from the opposite border)
(turn back to the permitted area)

Sometimes the returned value is still out of permitted area, so we need value
check inside while loop that continues as long as the gene value is not in the
permitted area
57

Evolutionary algorithms

Simple GA

30/11/2007

In the original GA by John Holland

Use binary coding


Random initial population
One-point, or multi-point crossover
Crossover more important than mutation
The roulette wheel parent selection, each individual had a chance to
become parent that was linearly dependent of its fitness value =>
each individual got as big share of the roulette wheel as its fitness
value compared to the sum of fitness values of all individuals.
Mutation: bit flipping with constant probability
All old individuals are replaced, so there was no elitism
Nowadays this Hollands original GA is called as Simple GA (SGA).
It is rarely used any more, mainly it can be used as comparison
level, when the new evolution algorithms are tested.

58

Potrebbero piacerti anche