2. INTRODUCTION Genes are the basic “instructions” for building an organism Gene represents a specific trait of the organism. Ex: Eye color A gene may have different settings A chromosome is a sequence of genes
3. EVOLUTION Organisms (animals or plants) produce a number of offspring which are almost, but not entirely, like themselves Variation may be due to mutation (random changes) Variation may be due to combination of some characteristics from each parent Some of these offspring may survive to produce offspring of their own - some won’t The “better adapted” offspring are more likely to survive Over time, later generations become better and better adapted Genetic algorithms use this same process to “evolve” better programs
4. GENETIC ALGORITHMS Inspired by Darwin's theory about evolution Theyare a part of evolutionary computing, which is a rapidly growing area of artificial intelligence Idea of evolutionary computing was introduced in the 1960s by I.Rechenberg Genetic Algorithms (GAs) were invented by John Holland In 1992 John Kozahas used genetic algorithm to evolve programs to perform certain tasks. He called his method "genetic programming" (GP) LISP programs were used, because programs in this language can expressed in the form of a "parse tree", which is the object the GA works on
5. THE BASIC ALGORITHM Suppose your “organisms” are 32-bit computer words You want a string in which all the bits are ones Here’s how you can do it: Create 100 randomly generated computer words Repeatedly do the following: Count the 1 bits in each word Exit if any of the words have all 32 bits set to 1 Keep the ten words that have the most 1s (discard the rest) From each word, generate 9 new words as follows: Choose one of the other words Take the first half of this word and combine it with the second half of the other word Pick a random bit in the word and toggle (change) it Note that this procedure does not guarantee that the next “generation” will have more 1 bits, but it’s likely
6. ENCODING The chromosome should in some way contain information about solution which it represents The most used way of encoding is a binary string. The chromosome then could look like this: Each chromosome has one binary string Each bit in this string can represent some characteristic of the solution. Or the whole string can represent a number.
7. CROSSOVER Crossover selects genes from parent chromosomes and creates a new offspring A crossover point is chosen at random Everything before this point, copy from a first parent and then everything after it copy from the second parent. There are other ways how to make crossover Specific crossover made for a specific problem can improve performance of the genetic algorithm
8. MUTATION Mutation prevents the algorithm to be trapped in a local minima Changes are made in the offspring randomly The mutation depends on the encoding as well as the crossover.
9.
10.
11. INITIAL POPULATION FOR TSP (5,3,4,6,2) (2,4,6,3,5) (4,3,6,5,2) (2,3,4,6,5) (4,3,6,2,5) (3,4,5,2,6) (3,5,4,6,2) (4,5,3,6,2) (5,4,2,3,6) (4,6,3,2,5) (3,4,2,6,5) (3,6,5,1,4)
20. GENETIC PROGRAMMING A string of bits could represent a program If you want a program to do something, you might try to evolve one As a concrete example, suppose you want a program to help you choose stocks in the stock market There is a huge amount of data, going back many years What data has the most predictive value? What’s the best way to combine this data? A genetic program is possible in theory, but it might take years to evolve into something useful
21. APPLICATIONS OF GA Travelling Salesman Problem Artificial Life (A-Life) Robotics Automotive Design Evolvable Hardware Computer Gaming Optimizing Chemical Kinetic Analysis Encryption and Code Breaking
22. CONCLUSION Genetic algorithms are - Fun! They are enjoyable to program and to work with Mind-bogglingly slow - you don’t want to use them if you have any alternatives Good for a very few types of problems Genetic algorithms can sometimes come up with a solution when you can see no other way of tackling the problem