Genetic Algorithm
Genetic Algorithm
Repeat
Generate a random possible solution
Test the solution and see how good it is until solution
is good enough
CAN WE USE THIS DUMB IDEA?
Sometimes - yes:
if there are only a few possible solutions
and you have enough time
then such a method could be used
For most problems - no:
many possible solutions
with no time to try them all
so this method can not be used
A “LESS-DUMB” IDEA (GA)
Generate a set of random solutions
Repeat
Test each solution in the set (rank them)
Remove some bad solutions from set
Duplicate some good solutions
make small changes to some of them
Until best solution is good enough
COMPONENTS OF A GA
children
reproduction modification
modified
parents children
population evaluation
evaluated children
deleted
members
discard
POPULATION
population
parents
population
children
modification
modified children
Crossover (recombination)
EVALUATION
modified
evaluated children
children
evaluation
population
discarded members
discard
Generational GA:
entire populations replaced with each iteration
ENCODING
• Binary Encoding
• Permutation Encoding
• Value Encoding
• Tree Encoding
SELECTION
• Roulette Wheel Selection
– Calculate sum of all chromosome fitnesses in population and generate random number
from interval. Go through the population and sum fitnesses from 0 - sum s. When the
sum s is greater then r, stop and return the chromosome where you are.
• Rank Selection
– First ranks the population and then every chromosome receives fitness from this
ranking. The worst will have fitness 1, second worst 2 etc. and the best will have
fitness N (number of chromosomes in population).
• Steady State Selection
– In every generation are selected a few (good - with high fitness) chromosomes for
creating a new offspring. Then some (bad - with low fitness) chromosomes are
removed and the new offspring is placed in their place. The rest of population survives
to new generation.
• Elitism
– Elitism is name of method, which first copies the best chromosome (or a few best
chromosomes) to new population. The rest is done in classical way. Elitism can very
rapidly increase performance of GA, because it prevents losing the best found
solution.
CROSSOVER OPERATOR
Rate of Mutation
BitInversion Mutation
Order Changing Mutation
CROSSOVER OR MUTATION
Decade long debate: which one is better?
Mainly depends on the problem
Generally it is good to have both
Certainly both have different role
Exploration: Discovering promising areas in the search space, i.e.
gaining information on the problem
Exploitation: Optimising within a promising area, i.e. using information
There is co-operation AND competition between them
Crossover is explorative, it makes a big jump to an area somewhere “in
between” two (parent) areas
Mutation is exploitative, it creates random small diversions, thereby
staying near (in the area of ) the parent
CROSSOVER OR MUTATION
Random initialization
Termination Criteria
Solution is only as good as the evaluation function (often
hardest part)
BENEFITS OF GENETIC ALGORITHMS