21-May-15 Genetic Algorithms. 2 Evolution Here’s a very oversimplified description of how evolution works in biology Organisms (animals or plants) produce.

Slides:



Advertisements
Similar presentations
Biologically Inspired Computing: Operators for Evolutionary Algorithms
Advertisements

Tetris and Genetic Algorithms Math Club 5/30/2011.
Genetic Algorithms Contents 1. Basic Concepts 2. Algorithm
Tuesday, May 14 Genetic Algorithms Handouts: Lecture Notes Question: when should there be an additional review session?
Genetic Algorithms Representation of Candidate Solutions GAs on primarily two types of representations: –Binary-Coded –Real-Coded Binary-Coded GAs must.
1 Review Define the terms genes pool and relative frequency Predict Suppose a dominant allele causes a plant disease that usually kills the plant before.
1 Lecture 8: Genetic Algorithms Contents : Miming nature The steps of the algorithm –Coosing parents –Reproduction –Mutation Deeper in GA –Stochastic Universal.
Digression: Symbolic Regression Suppose you are a criminologist, and you have some data about recidivism. Suppose you are a criminologist, and you have.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
This material in not in your text (except as exercises) Sequence Comparisons –Problems in molecular biology involve finding the minimum number of edit.
Doug Downey, adapted from Bryan Pardo, Machine Learning EECS 349 Fall 2007 Machine Learning Genetic Algorithms.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2002.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2004.
Population Genetics Unit 4 AP Biology.
Optimization via Search CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 4 Adapted from slides of Yoonsuck Choe.
Evolution and Natural Selection
Genetic Algorithms Overview Genetic Algorithms: a gentle introduction –What are GAs –How do they work/ Why? –Critical issues Use in Data Mining –GAs.
Pawel Drozdowski – November Introduction GA basics Solving simple problem GA more advanced topics Solving complex problem Question and Answers.
Genetic Programming.
Genetic Algorithm.
Evolutionary Intelligence
Gene flow is the movement of alleles between populations.
Evolution Test Review Session!!
Genetic Algorithms CS121 Spring 2009 Richard Frankel Stanford University 1.
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
CS 484 – Artificial Intelligence1 Announcements Lab 3 due Tuesday, November 6 Homework 6 due Tuesday, November 6 Lab 4 due Thursday, November 8 Current.
Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas 363CS – Artificial Intelligence.
Sources of Inherited Variation Mutations & Sexual Reproduction.
1 Genetic Algorithms “Genetic Algorithms are good at taking large, potentially huge search spaces and navigating them, looking for optimal combinations.
An Introduction to Genetic Algorithms Lecture 2 November, 2010 Ivan Garibay
MRS. MACWILLIAMS ACADEMIC BIOLOGY
1 Machine Learning: Lecture 12 Genetic Algorithms (Based on Chapter 9 of Mitchell, T., Machine Learning, 1997)
GENETIC ALGORITHMS.  Genetic algorithms are a form of local search that use methods based on evolution to make small changes to a popula- tion of chromosomes.
A Tale of Two Fishes Delving into genetic inheritance Continue here.
2005MEE Software Engineering Lecture 11 – Optimisation Techniques.
17.2 Evolution as Genetic Change in Populations
Allele Frequencies: Staying Constant Chapter 14. What is Allele Frequency? How frequent any allele is in a given population: –Within one race –Within.
Introduction to Genetic Algorithms. Genetic Algorithms We’ve covered enough material that we can write programs that use genetic algorithms! –More advanced.
Edge Assembly Crossover
Genetic Algorithms. 2 Overview Introduction To Genetic Algorithms (GAs) GA Operators and Parameters Genetic Algorithms To Solve The Traveling Salesman.
2101INT – Principles of Intelligent Systems Lecture 11.
EE749 I ntroduction to Artificial I ntelligence Genetic Algorithms The Simple GA.
Optimization Problems
1.Stream A and Stream B are located on two isolated islands with similar characteristics. How do these two stream beds differ? 2.Suppose a fish that varies.
D Nagesh Kumar, IIScOptimization Methods: M8L5 1 Advanced Topics in Optimization Evolutionary Algorithms for Optimization and Search.
Genetic Algorithms MITM613 (Intelligent Systems).
An Introduction to Genetic Algorithms Lecture 2 November, 2010 Ivan Garibay
Genetic Algorithm Dr. Md. Al-amin Bhuiyan Professor, Dept. of CSE Jahangirnagar University.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal Evolutionary Computation.
Overview Last two weeks we looked at evolutionary algorithms.
The inference and accuracy We learned how to estimate the probability that the percentage of some subjects in the sample would be in a given interval by.
1 Comparative Study of two Genetic Algorithms Based Task Allocation Models in Distributed Computing System Oğuzhan TAŞ 2005.
CSCOPE Unit: 09 Lesson: 01.  Be prepared to share your response to the following: ◦ Biological evolution happens at the __________ level, not the individual.
EVOLUTION …via Natural Selection. Organisms produce more offspring than can survive.
Genetic Algorithms An Evolutionary Approach to Problem Solving.
GENETIC ALGORITHM By Siti Rohajawati. Definition Genetic algorithms are sets of computational procedures that conceptually follow steps inspired by the.
Genetic Algorithm. Outline Motivation Genetic algorithms An illustrative example Hypothesis space search.
 Presented By: Abdul Aziz Ghazi  Roll No:  Presented to: Sir Harris.
 Negnevitsky, Pearson Education, Lecture 12 Hybrid intelligent systems: Evolutionary neural networks and fuzzy evolutionary systems n Introduction.
Genetic Algorithms 11-Oct-17.
Genetic Algorithms.
Introduction to Genetic Algorithms
Genetic Algorithms.
Local optimization technique
Artificial Intelligence Methods (AIM)
Genetic Algorithms 25-Feb-19.
Searching for solutions: Genetic Algorithms
Genetic Algorithms 26-Apr-19.
Presentation transcript:

21-May-15 Genetic Algorithms

2 Evolution Here’s a very oversimplified description of how evolution works in biology 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 sexual reproduction (offspring have 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

3 Genotypes and phenotypes Genes are the basic “instructions” for building an organism A chromosome is a sequence of genes Biologists distinguish between an organism’s genotype (the genes and chromosomes) and its phenotype (what the organism actually is like) Example: You might have genes to be tall, but never grow to be tall for other reasons (such as poor diet) Similarly, “genes” may describe a possible solution to a problem, without actually being the solution

4 The basic genetic algorithm Start with a large “population” of randomly generated “attempted solutions” to a problem Repeatedly do the following: Evaluate each of the attempted solutions Keep a subset of these solutions (the “best” ones) Use these solutions to generate a new population Quit when you have a satisfactory solution (or you run out of time)

5 A really simple example 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: 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 A more realistic example, part I Suppose you have a large number of (x, y) data points For example, (1.0, 4.1), (3.1, 9.5), (-5.2, 8.6),... You would like to fit a polynomial (of up to degree 5) through these data points That is, you want a formula y = ax 5 + bx 4 + cx 3 + dx 2 +ex + f that gives you a reasonably good fit to the actual data Here’s the usual way to compute goodness of fit: Compute the sum of (actual y – predicted y) 2 for all the data points The lowest sum represents the best fit There are some standard curve fitting techniques, but let’s assume you don’t know about them You can use a genetic algorithm to find a “pretty good” solution

7 A more realistic example, part II Your formula is y = ax 5 + bx 4 + cx 3 + dx 2 +ex + f Your “genes” are a, b, c, d, e, and f Your “chromosome” is the array [a, b, c, d, e, f] Your evaluation function for one array is: For every actual data point (x, y), (I’m using red to mean “actual data”) Compute ý = ax 5 + bx 4 + cx 3 + dx 2 +ex + f Find the sum of (y – ý) 2 over all x The sum is your measure of “badness” (larger numbers are worse) Example: For [0, 0, 0, 2, 3, 5] and the data points (1, 12) and (2, 22) : ý = 0x 5 + 0x 4 + 0x 3 + 2x 2 +3x + 5 is = 10 when x is 1 ý = 0x 5 + 0x 4 + 0x 3 + 2x 2 +3x + 5 is = 19 when x is 2 (12 – 10) 2 + (22 – 19) 2 = = 13 If these are the only two data points, the “badness” of [0, 0, 0, 2, 3, 5] is 13

8 A more realistic example, part III Your algorithm might be as follows: Create 100 six-element arrays of random numbers Repeat 500 times (or any other number): For each of the 100 arrays, compute its badness (using all data points) Keep the ten best arrays (discard the other 90) From each array you keep, generate nine new arrays as follows: Pick a random element of the six Pick a random floating-point number between 0.0 and 2.0 Multiply the random element of the array by the random floating-point number After all 500 trials, pick the best array as your final answer

9 Asexual vs. sexual reproduction In the examples so far, Each “organism” (or “solution”) had only one parent Reproduction was asexual (without sex) The only way to introduce variation was through mutation (random changes) In sexual reproduction, Each “organism” (or “solution”) has two parents Assuming that each organism has just one chromosome, new offspring are produced by forming a new chromosome from parts of the chromosomes of each parent

10 The really simple example again Suppose your “organisms” are 32-bit computer words, and 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

11 The example continued Half from one, half from the other: Or we might choose “genes” (bits) randomly: Or we might consider a “gene” to be a larger unit:

12 Comparison of simple examples In the simple example (trying to get all 1s): The sexual (two-parent, no mutation) approach, if it succeeds, is likely to succeed much faster Because up to half of the bits change each time, not just one bit However, with no mutation, it may not succeed at all By pure bad luck, maybe none of the first (randomly generated) words have (say) bit 17 set to 1 Then there is no way a 1 could ever occur in this position Another problem is lack of genetic diversity Maybe some of the first generation did have bit 17 set to 1, but none of them were selected for the second generation The best technique in general turns out to be sexual reproduction with a small probability of mutation

13 Curve fitting with sexual reproduction Your formula is y = ax 5 + bx 4 + cx 3 + dx 2 +ex + f Your “genes” are a, b, c, d, e, and f Your “chromosome” is the array [a, b, c, d, e, f] What’s the best way to combine two chromosomes into one? You could choose the first half of one and the second half of the other: [a, b, c, d, e, f] You could choose genes randomly: [a, b, c, d, e, f] You could compute “gene averages:” [(a+a)/2, (b+b)/2, (c+c)/2, (d+d)/2, (e+e)/2,(f+f)/2] I suspect this last may be the best, though I don’t know of a good biological analogy for it

14 Directed evolution Notice that, in the previous examples, we formed the child organisms randomly We did not try to choose the “best” genes from each parent This is how natural (biological) evolution works Biological evolution is not directed—there is no “goal” Genetic algorithms use biology as inspiration, not as a set of rules to be slavishly followed For trying to get a word of all 1 s, there is an obvious measure of a “good” gene But that’s mostly because it’s a silly example It’s much harder to detect a “good gene” in the curve-fitting problem, harder still in almost any “real use” of a genetic algorithm

15 Probabilistic matching In previous examples, we chose the N “best” organisms as parents for the next generation A more common approach is to choose parents randomly, based on their measure of goodness Thus, an organism that is twice as “good” as another is likely to have twice as many offspring This has a couple of advantages: The best organisms will contribute the most to the next generation Since every organism has some chance of being a parent, there is somewhat less loss of genetic diversity

16 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 millions of years to evolve into something useful How can we improve this?

17 Shrinking the search space There are just too many possible bit patterns! % of these don’t even represent valid programs An incredible improvement would result if we could somehow restrict the search space to only valid (even if nonsensical) programs We can do this! Programs, as you should know by now, can be represented as trees Internal nodes are operators: +, *, if, while,... Leaves are values: , "AAPL",...

18 Programs as trees Given a program represented as a tree, we can mutate it by changing one of its operators (or one of its values), or by adding or removing nodes Given two trees, we can form a new tree by taking parts of its two parents The next big problem: How do we evaluate program trees that are (initially) nothing at all like what we want? I realize this is all very vague—I just wanted to give you the general idea

19 Concluding remarks Genetic algorithms are— Fun! They are enjoyable to program and to work with This is probably why they are a subject of active research 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

20 The End