* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Genetic Algorithms: A Tutorial
Genetic studies on Bulgarians wikipedia , lookup
Point mutation wikipedia , lookup
Genetically modified food wikipedia , lookup
Frameshift mutation wikipedia , lookup
Dual inheritance theory wikipedia , lookup
Quantitative trait locus wikipedia , lookup
Polymorphism (biology) wikipedia , lookup
Pharmacogenomics wikipedia , lookup
Designer baby wikipedia , lookup
Medical genetics wikipedia , lookup
Genetic code wikipedia , lookup
Behavioural genetics wikipedia , lookup
Koinophilia wikipedia , lookup
Heritability of IQ wikipedia , lookup
History of genetic engineering wikipedia , lookup
Gene expression programming wikipedia , lookup
Genetic drift wikipedia , lookup
Public health genomics wikipedia , lookup
Human genetic variation wikipedia , lookup
Genetic engineering wikipedia , lookup
Genetic testing wikipedia , lookup
Genome (book) wikipedia , lookup
Population genetics wikipedia , lookup
Genetic Algorithms: Soft Computing Week 13 “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 1 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 2 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 3 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 4 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” 5 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? 6 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 7 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 8 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 9 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 10 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 11 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) 12 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 13 Genetic Algorithms Example population No. 1 2 3 4 5 6 7 8 Chromosome 1010011010 1111100001 1011001100 1010000000 0000010000 1001011111 0101010101 1011100111 14 Fitness 1 2 3 1 3 5 1 2 Genetic Algorithms Roulette Wheel Selection 1 1 0 2 3 2 4 3 1 5 6 3 7 5 Rnd[0..18] = 7 Rnd[0..18] = 12 Chromosome4 Chromosome6 Parent1 Parent2 15 1 8 2 18 Genetic Algorithms Crossover - Recombination 1011011111 1010000000 Parent1 Offspring1 1001011111 Parent2 Offspring2 1010000000 Crossover single point random With some high probability (crossover rate) apply crossover to the parents. 16 Genetic Algorithms Mutation mutate 1011001111 Offspring1 1011011111 Offspring1 Offspring2 1010000000 Offspring2 1000000000 Original offspring Mutated offspring With some small probability (the mutation rate) flip each bit in the offspring (typical values between 0.1 and 0.001) 17 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 18 Genetic Algorithms Many Variants of GA Different kinds of selection (not roulette) Different recombination Multi-point crossover 3 way crossover etc. Different kinds of encoding other than bitstring Tournament Elitism, etc. Integer values Ordered set of symbols Different kinds of mutation 19 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 20 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 21 Genetic Algorithms Classes of Search Techniques Search techniques Calculus-based techniques Direct methods Finonacci Indirect methods Newton Enumerative techniques Guided random search techniques Evolutionary algorithms Evolutionary strategies Dynamic programming Genetic algorithms Parallel Centralized Simulated annealing Distributed 22 Sequential Steady-state Generational 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) 23 Genetic Algorithms Simple Genetic Algorithm { initialize population; evaluate population; while TerminationCriteriaNotSatisfied { select parents for reproduction; perform recombination and mutation; evaluate population; } } 24 Genetic Algorithms The GA Cycle of Reproduction reproduction children modified children parents population modification evaluation evaluated children deleted members discard 25 Genetic Algorithms Population population Chromosomes could be: Bit strings Real numbers Permutations of element Lists of rules Program elements ... any data structure ... 26 (0101 ... 1100) (43.2 -33.1 ... 0.0 89.2) (E11 E3 E7 ... E1 E15) (R1 R2 R3 ... R22 R23) (genetic programming) Genetic Algorithms Reproduction reproduction children parents population Parents are selected at random with selection chances biased in relation to chromosome evaluations. 27 Genetic Algorithms Chromosome Modification children modification modified children Modifications are stochastically triggered Operator types are: Mutation Crossover (recombination) 28 Genetic Algorithms Evaluation modified children evaluated children 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 29 Genetic Algorithms Deletion population discarded members discard Generational GA: entire populations replaced with each iteration Steady-state GA: a few members replaced each generation 30 Genetic Algorithms An Abstract Example Distribution of Individuals in Generation 0 Distribution of Individuals in Generation N 31 Genetic Algorithms A Simple Example “The Gene is by far the most sophisticated program around.” - Bill Gates, Business Week, June 27, 1994 32 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 33 Genetic Algorithms Representation Representation is an ordered list of city numbers known as an order-based GA. 1) London 2) Venice 3) Dunedin 4) Singapore 5) Beijing 7) Tokyo 6) Phoenix 8) Victoria CityList1 (3 5 7 2 1 6 4 8) CityList2 (2 5 7 6 8 1 3 4) 34 Genetic Algorithms Crossover Crossover combines inversion and recombination: Parent1 Parent2 Children1 Children2 (3 5 7 2 1 6 4 8) (2 8 7 6 8 1 3 4) (3 5 7 6 8 1 3 4) (2 8 7 2 1 6 3 4) 35 Genetic Algorithms Mutation Mutation changing the list: Before: * * (5 8 7 2 1 6 3 4) After: (5 8 6 2 1 7 3 4) 36 Genetic Algorithms TSP Example: 30 Cities 100 90 80 70 y 60 50 40 30 20 10 0 0 10 20 30 40 50 60 70 80 90 100 x 37 Genetic Algorithms Solution i (Distance = 941) TSP30 (Performance = 941) 100 90 80 70 y 60 50 40 30 20 10 0 0 10 20 30 40 50 60 70 80 90 100 x 38 Genetic Algorithms Solution j(Distance = 800) TSP30 (Performance = 800) 100 90 80 70 y 60 50 40 30 20 10 0 0 10 20 30 40 50 60 70 80 90 100 x 39 Genetic Algorithms Solution k(Distance = 652) TSP30 (Performance = 652) 100 90 80 70 y 60 50 40 30 20 10 0 0 10 20 30 40 50 60 70 80 90 100 x 40 Genetic Algorithms Best Solution (Distance = 420) TSP30 Solution (Performance = 420) 100 90 80 70 y 60 50 40 30 20 10 0 0 10 20 30 40 50 60 70 80 90 100 x 41 Genetic Algorithms Overview of Performance TSP30 - Overview of Performance 1600 1400 Distance 1200 1000 800 600 400 200 0 1 3 5 7 9 11 13 15 17 19 Generations (1000) 42 21 23 25 27 29 31 Best Worst Average 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 43 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) 44 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 45 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 46 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 47 Genetic Algorithms Some GA Application Types Domain Application Types Control gas pipeline, pole balancing, missile evasion, pursuit Design Scheduling semiconductor layout, aircraft design, keyboard configuration, communication networks manufacturing, facility scheduling, resource allocation Robotics trajectory planning Machine Learning Signal Processing designing neural networks, improving classification algorithms, classifier systems filter design Game Playing poker, checkers, prisoner’s dilemma Combinatorial Optimization set covering, travelling salesman, routing, bin packing, graph colouring and partitioning 48 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 49 Genetic Algorithms