Date post: | 02-Jan-2016 |
Category: |
Documents |
Upload: | ashlie-williams |
View: | 215 times |
Download: | 1 times |
1 Genetic Algorithms
“Genetic Algorithms are good at taking large,
potentially huge search spaces and navigating
them, looking for optimal combinations of things, solutions you might not
otherwise find in a lifetime.”
- Salvatore Mangano
Computer Design, May 1995
Genetic Algorithms:Genetic Algorithms:Soft Computing Week Soft Computing Week
1313
2 Genetic Algorithms
The Genetic Algorithm Directed search algorithms based on
the mechanics of biological evolution Developed by John Holland, University
of Michigan (1970’s) To understand the adaptive processes of
natural systems To design artificial systems software that
retains the robustness of natural systems
3 Genetic Algorithms
The Genetic Algorithm (cont.)
Provide efficient, effective techniques for optimization and machine learning applications
Widely-used today in business, scientific and engineering circles
4 Genetic Algorithms
Evolution in the real world
Each cell of a living thing contains chromosomes - strings of DNA
Each chromosome contains a set of genes - blocks of DNA
Each gene determines some aspect of the organism (like eye colour)
A collection of genes is sometimes called a genotype
5 Genetic Algorithms
Evolution in the real world
A collection of aspects (like eye colour) is sometimes called a phenotype
Reproduction involves recombination of genes from parents and then small amounts of mutation (errors) in copying
The fitness of an organism is how much it can reproduce before it dies
Evolution based on “survival of the fittest”
6 Genetic Algorithms
Start with a Dream… Suppose you have a problem You don’t know how to solve it What can you do? Can you use a computer to somehow
find a solution for you? This would be nice! Can it be done?
7 Genetic Algorithms
A dumb solution
A “blind generate and test” algorithm:
RepeatGenerate a random possible solution
Test the solution and see how good it is
Until solution is good enough
8 Genetic Algorithms
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: Too many possible solutions No time to try them all So this method can not be used
9 Genetic Algorithms
A “less-dumb” idea (GA)
Generate a set of random solutions
RepeatTest 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
10 Genetic Algorithms
How do you encode a solution?
Obviously this depends on the problem! GA’s often encode solutions as fixed length
“bitstrings” (e.g. 101110, 111111, 000101) Each bit represents some aspect of the
proposed solution to the problem For GA’s to work, we need to be able to
“test” any string and get a “score” indicating how “good” that solution is
11 Genetic Algorithms
Adding Sex - Crossover Although it may work for simple search
spaces our algorithm is still very simple It relies on random mutation to find a good
solution It has been found that by introducing “sex”
into the algorithm better results are obtained This is done by selecting two parents during
reproduction and combining their genes to produce offspring
12 Genetic Algorithms
Adding Sex - Crossover Two high scoring “parent” bit strings
(chromosomes) are selected and with some probability (crossover rate) combined
Producing two new offspring (bit strings) Each offspring may then be changed
randomly (mutation)
13 Genetic Algorithms
Selecting Parents Many schemes are possible so long as better
scoring chromosomes more likely selected Score is often termed the fitness “Roulette Wheel” selection can be used
14 Genetic Algorithms
Example populationNo. Chromosome Fitness
1 1010011010 1
2 1111100001 2
3 1011001100 3
4 1010000000 1
5 0000010000 3
6 1001011111 5
7 0101010101 1
8 1011100111 2
15 Genetic Algorithms
Roulette Wheel Selection
1 2 3 1 3 5 1 2
0 18
21 3 4 5 6 7 8
Rnd[0..18] = 7
Chromosome4
Parent1
Rnd[0..18] = 12
Chromosome6
Parent2
16 Genetic Algorithms
Crossover - Recombination
1010000000
1001011111
Crossover single point -
random
1011011111
1010000000
Parent1
Parent2
Offspring1
Offspring2
With some high probability (crossover rate) apply crossover to the parents.
17 Genetic Algorithms
Mutation
1011011111
1010000000
Offspring1
Offspring2
1011001111
1000000000
Offspring1
Offspring2
With some small probability (the mutation rate) flip each bit in the offspring (typical values between 0.1
and 0.001)
mutate
Original offspring Mutated offspring
18 Genetic Algorithms
Back to the (GA) Algorithm
Generate a population of random chromosomes
Repeat (each generation) Calculate fitness of each chromosome Repeat
» Use roulette selection to select pairs of parents» Generate offspring with crossover and mutation
Until a new population has been produced Until best solution is good enough
19 Genetic Algorithms
Many Variants of GA Different kinds of selection (not roulette)
Tournament Elitism, etc.
Different recombination Multi-point crossover 3 way crossover etc.
Different kinds of encoding other than bitstring Integer values Ordered set of symbols
Different kinds of mutation
20 Genetic Algorithms
Many parameters to set Any GA implementation needs to decide on a
number of parameters: Population size (N), mutation rate (m), crossover rate (c)
Often these have to be “tuned” based on results obtained - no general theory to deduce good values
Typical values might be: N = 50, m = 0.05, c = 0.9
21 Genetic Algorithms
Why does crossover work?
A lot of theory about this and some controversy
Holland introduced “Schema” theory The idea is that crossover preserves “good
bits” from different parents, combining them to produce better solutions
A good encoding scheme would therefore try to preserve “good bits” during crossover and mutation
22 Genetic Algorithms
Classes of Search Techniques
F inonacc i N ew ton
D irect m ethods Indirec t m ethods
C alcu lus-based techn iques
E volu tionary s trategies
C entra l ized D is tr ibuted
Para l le l
S teady-s ta te G enera tiona l
S equentia l
G ene tic a lgori thm s
E volutionary a lgori thm s S im u lated annealing
G uided random search techniques
D ynam ic program m ing
E num erative techn iques
S earch techniques
23 Genetic Algorithms
Components of a GA
A problem to solve, and ... Encoding technique (gene, chromosome)
Initialization procedure (creation)
Evaluation function (environment)
Selection of parents (reproduction)
Genetic operators (mutation, recombination)
Parameter settings (practice and art)
24 Genetic Algorithms
Simple Genetic Algorithm
{
initialize population;
evaluate population;
while TerminationCriteriaNotSatisfied{
select parents for reproduction;
perform recombination and mutation;
evaluate population;}
}
25 Genetic Algorithms
The GA Cycle of Reproduction
reproduction
population evaluation
modification
discard
deleted members
parents
children
modifiedchildren
evaluated children
26 Genetic Algorithms
Population
Chromosomes could be: Bit strings (0101 ... 1100) Real numbers (43.2 -33.1 ... 0.0 89.2) Permutations of element (E11 E3 E7 ... E1 E15) Lists of rules (R1 R2 R3 ... R22 R23) Program elements (genetic programming) ... any data structure ...
population
27 Genetic Algorithms
Reproduction
reproduction
population
parents
children
Parents are selected at random with selection chances biased in relation to chromosome evaluations.
28 Genetic Algorithms
Chromosome Modification
modificationchildren
Modifications are stochastically triggered Operator types are:
Mutation Crossover (recombination)
modified children
29 Genetic Algorithms
Evaluation
The evaluator decodes a chromosome and assigns it a fitness measure
The evaluator is the only link between a classical GA and the problem it is solving
evaluation
evaluatedchildren
modifiedchildren
30 Genetic Algorithms
Deletion
Generational GA:entire populations replaced with each iteration
Steady-state GA:a few members replaced each generation
population
discard
discarded members
31 Genetic Algorithms
An Abstract Example
Distribution of Individuals in Generation 0
Distribution of Individuals in Generation N
32 Genetic Algorithms
A Simple Example
“The Gene is by far the most sophisticated program around.”
- Bill Gates, Business Week, June 27, 1994
33 Genetic Algorithms
A Simple Example
The Traveling Salesman Problem:
Find a tour of a given set of cities so that each city is visited only once the total distance traveled is minimized
34 Genetic Algorithms
Representation
Representation is an ordered list of city
numbers known as an order-based GA.
1) London 3) Dunedin 5) Beijing 7) Tokyo
2) Venice 4) Singapore 6) Phoenix 8) Victoria
CityList1 (3 5 7 2 1 6 4 8)
CityList2 (2 5 7 6 8 1 3 4)
35 Genetic Algorithms
Crossover
Crossover combines inversion and
recombination:
Parent1 (3 5 7 2 1 6 4 8)
Parent2 (2 8 7 6 8 1 3 4)
Children1 (3 5 7 6 8 1 3 4)
Children2 (2 8 7 2 1 6 3 4)
36 Genetic Algorithms
Mutation changing the list:
* *
Before: (5 8 7 2 1 6 3 4)
After: (5 8 6 2 1 7 3 4)
Mutation
37 Genetic Algorithms
TSP Example: 30 Cities
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
x
y
38 Genetic Algorithms
Solution i (Distance = 941)
TSP30 (Performance = 941)
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
x
y
39 Genetic Algorithms
Solution j(Distance = 800)
TSP30 (Performance = 800)
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
x
y
40 Genetic Algorithms
Solution k(Distance = 652)
TSP30 (Performance = 652)
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
x
y
41 Genetic Algorithms
Best Solution (Distance = 420)
TSP30 Solution (Performance = 420)
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
x
y
42 Genetic Algorithms
Overview of Performance
TSP30 - Overview of Performance
0
200
400
600
800
1000
1200
1400
1600
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
Generations (1000)
Dis
tan
ce
Best
Worst
Average
43 Genetic Algorithms
Considering the GA Technology
“Almost eight years ago ... people at Microsoft wrote
a program [that] uses some genetic things for
finding short code sequences. Windows 2.0 and 3.2, NT, and almost
all Microsoft applications products have shipped
with pieces of code created by that system.”
- Nathan Myhrvold, Microsoft Advanced Technology Group, Wired, September 1995
44 Genetic Algorithms
Issues for GA Practitioners
Choosing basic implementation issues: representation population size, mutation rate, ... selection, deletion policies crossover, mutation operators
Termination Criteria Performance, scalability Solution is only as good as the evaluation
function (often hardest part)
45 Genetic Algorithms
Benefits of Genetic Algorithms
Concept is easy to understand Modular, separate from application Supports multi-objective optimization Good for “noisy” environments Always has an answer; answer gets
better with time
46 Genetic Algorithms
Benefits of Genetic Algorithms (cont.)
Many ways to speed up and improve a GA-based application as knowledge about problem domain is gained
Easy to exploit previous or alternate solutions
Flexible building blocks for hybrid applications
Substantial history and range of use
47 Genetic Algorithms
When to Use a GA Alternate solutions are too slow or overly
complicated Need an exploratory tool to examine new
approaches Problem is similar to one that has already been
successfully solved by using a GA Want to hybridize with an existing solution Benefits of the GA technology meet key problem
requirements
48 Genetic Algorithms
Some GA Application Types
Domain Application Types
Control gas pipeline, pole balancing, missile evasion, pursuit
Design semiconductor layout, aircraft design, keyboardconfiguration, communication networks
Scheduling manufacturing, facility scheduling, resource allocation
Robotics trajectory planning
Machine Learning designing neural networks, improving classificationalgorithms, classifier systems
Signal Processing filter design
Game Playing poker, checkers, prisoner’s dilemma
CombinatorialOptimization
set covering, travelling salesman, routing, bin packing,graph colouring and partitioning