Download presentation
Presentation is loading. Please wait.
Published byAshlie Williams Modified over 9 years ago
1
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: Soft Computing Week 13
2
2 Genetic Algorithms The Genetic Algorithm l Directed search algorithms based on the mechanics of biological evolution l 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
3 Genetic Algorithms The Genetic Algorithm (cont.) l Provide efficient, effective techniques for optimization and machine learning applications l Widely-used today in business, scientific and engineering circles
4
4 Genetic Algorithms Evolution in the real world l Each cell of a living thing contains chromosomes - strings of DNA l Each chromosome contains a set of genes - blocks of DNA l Each gene determines some aspect of the organism (like eye colour) l A collection of genes is sometimes called a genotype
5
5 Genetic Algorithms Evolution in the real world l A collection of aspects (like eye colour) is sometimes called a phenotype l Reproduction involves recombination of genes from parents and then small amounts of mutation (errors) in copying l The fitness of an organism is how much it can reproduce before it dies l Evolution based on “survival of the fittest”
6
6 Genetic Algorithms Start with a Dream… l Suppose you have a problem l You don’t know how to solve it l What can you do? l Can you use a computer to somehow find a solution for you? l This would be nice! Can it be done?
7
7 Genetic Algorithms A dumb solution A “blind generate and test” algorithm: Repeat Generate a random possible solution Test the solution and see how good it is Until solution is good enough
8
8 Genetic Algorithms Can we use this dumb idea? l Sometimes - yes: if there are only a few possible solutions and you have enough time then such a method could be used l For most problems - no: Too many possible solutions No time to try them all So this method can not be used
9
9 Genetic Algorithms 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
10
10 Genetic Algorithms How do you encode a solution? l Obviously this depends on the problem! l GA’s often encode solutions as fixed length “bitstrings” (e.g. 101110, 111111, 000101) l Each bit represents some aspect of the proposed solution to the problem l 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
11 Genetic Algorithms Adding Sex - Crossover l Although it may work for simple search spaces our algorithm is still very simple l It relies on random mutation to find a good solution l It has been found that by introducing “sex” into the algorithm better results are obtained l This is done by selecting two parents during reproduction and combining their genes to produce offspring
12
12 Genetic Algorithms Adding Sex - Crossover l Two high scoring “parent” bit strings (chromosomes) are selected and with some probability (crossover rate) combined l Producing two new offspring (bit strings) l Each offspring may then be changed randomly (mutation)
13
13 Genetic Algorithms Selecting Parents l Many schemes are possible so long as better scoring chromosomes more likely selected l Score is often termed the fitness l “Roulette Wheel” selection can be used
14
14 Genetic Algorithms Example population No.ChromosomeFitness 110100110101 211111000012 310110011003 410100000001 500000100003 610010111115 701010101011 810111001112
15
15 Genetic Algorithms Roulette Wheel Selection 12313512 0 18 21345678 Rnd[0..18] = 7 Chromosome4 Parent1 Rnd[0..18] = 12 Chromosome6 Parent2
16
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
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
18 Genetic Algorithms Back to the (GA) Algorithm l Generate a population of random chromosomes l 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 l Until best solution is good enough
19
19 Genetic Algorithms Many Variants of GA l Different kinds of selection (not roulette) Tournament Elitism, etc. l Different recombination Multi-point crossover 3 way crossover etc. l Different kinds of encoding other than bitstring Integer values Ordered set of symbols l Different kinds of mutation
20
20 Genetic Algorithms Many parameters to set l Any GA implementation needs to decide on a number of parameters: Population size (N), mutation rate (m), crossover rate (c) l Often these have to be “tuned” based on results obtained - no general theory to deduce good values l Typical values might be: N = 50, m = 0.05, c = 0.9
21
21 Genetic Algorithms Why does crossover work? l A lot of theory about this and some controversy l Holland introduced “Schema” theory l The idea is that crossover preserves “good bits” from different parents, combining them to produce better solutions l A good encoding scheme would therefore try to preserve “good bits” during crossover and mutation
22
22 Genetic Algorithms Classes of Search Techniques
23
23 Genetic Algorithms Components of a GA A problem to solve, and... l Encoding technique (gene, chromosome) l Initialization procedure (creation) l Evaluation function (environment) l Selection of parents (reproduction) l Genetic operators (mutation, recombination) l Parameter settings (practice and art)
24
24 Genetic Algorithms Simple Genetic Algorithm { initialize population; evaluate population; while TerminationCriteriaNotSatisfied { select parents for reproduction; perform recombination and mutation; evaluate population; }
25
25 Genetic Algorithms The GA Cycle of Reproduction reproduction population evaluation modification discard deleted members parents children modified children evaluated children
26
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
27 Genetic Algorithms Reproduction reproduction population parents children Parents are selected at random with selection chances biased in relation to chromosome evaluations.
28
28 Genetic Algorithms Chromosome Modification modification children l Modifications are stochastically triggered l Operator types are: Mutation Crossover (recombination) modified children
29
29 Genetic Algorithms Evaluation l The evaluator decodes a chromosome and assigns it a fitness measure l The evaluator is the only link between a classical GA and the problem it is solving evaluation evaluated children modified children
30
30 Genetic Algorithms Deletion l Generational GA: entire populations replaced with each iteration l Steady-state GA: a few members replaced each generation population discard discarded members
31
31 Genetic Algorithms An Abstract Example Distribution of Individuals in Generation 0 Distribution of Individuals in Generation N
32
32 Genetic Algorithms A Simple Example “ The Gene is by far the most sophisticated program around.” - Bill Gates, Business Week, June 27, 1994
33
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
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
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
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
37 Genetic Algorithms TSP Example: 30 Cities
38
38 Genetic Algorithms Solution i (Distance = 941)
39
39 Genetic Algorithms Solution j (Distance = 800)
40
40 Genetic Algorithms Solution k (Distance = 652)
41
41 Genetic Algorithms Best Solution (Distance = 420)
42
42 Genetic Algorithms Overview of Performance
43
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
44 Genetic Algorithms Issues for GA Practitioners l Choosing basic implementation issues: representation population size, mutation rate,... selection, deletion policies crossover, mutation operators l Termination Criteria l Performance, scalability l Solution is only as good as the evaluation function (often hardest part)
45
45 Genetic Algorithms Benefits of Genetic Algorithms l Concept is easy to understand l Modular, separate from application l Supports multi-objective optimization l Good for “noisy” environments l Always has an answer; answer gets better with time
46
46 Genetic Algorithms Benefits of Genetic Algorithms (cont.) l Many ways to speed up and improve a GA-based application as knowledge about problem domain is gained l Easy to exploit previous or alternate solutions l Flexible building blocks for hybrid applications l Substantial history and range of use
47
47 Genetic Algorithms When to Use a GA l Alternate solutions are too slow or overly complicated l Need an exploratory tool to examine new approaches l Problem is similar to one that has already been successfully solved by using a GA l Want to hybridize with an existing solution l Benefits of the GA technology meet key problem requirements
48
48 Genetic Algorithms Some GA Application Types
49
49 Genetic Algorithms Conclusions Question:‘If GAs are so smart, why ain’t they rich?’ Answer:‘Genetic algorithms are rich - rich in application across a large and growing number of disciplines.’ - David E. Goldberg, Genetic Algorithms in Search, Optimization and Machine Learning
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.