By Prafulla S. Kota Raghavan Vangipuram

Slides:



Advertisements
Similar presentations
CS6800 Advanced Theory of Computation
Advertisements

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.
Content Based Image Clustering and Image Retrieval Using Multiple Instance Learning Using Multiple Instance Learning Xin Chen Advisor: Chengcui Zhang Department.
1 Lecture 8: Genetic Algorithms Contents : Miming nature The steps of the algorithm –Coosing parents –Reproduction –Mutation Deeper in GA –Stochastic Universal.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Evolutionary Computational Intelligence
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2002.
Chapter 14 Genetic Algorithms.
Genetic Algorithms Nehaya Tayseer 1.Introduction What is a Genetic algorithm? A search technique used in computer science to find approximate solutions.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2004.
Chapter 6: Transform and Conquer Genetic Algorithms The Design and Analysis of Algorithms.
Genetic Algorithms Overview Genetic Algorithms: a gentle introduction –What are GAs –How do they work/ Why? –Critical issues Use in Data Mining –GAs.
Brandon Andrews.  What are genetic algorithms?  3 steps  Applications to Bioinformatics.
Genetic Programming.
Genetic Algorithm.
Evolutionary Intelligence
© Negnevitsky, Pearson Education, Lecture 11 Evolutionary Computation: Genetic algorithms Why genetic algorithm work? Why genetic algorithm work?
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
Genetic algorithms Prof Kang Li
Schemata Theory Chapter 11. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Theory Why Bother with Theory? Might provide performance.
CS 484 – Artificial Intelligence1 Announcements Lab 3 due Tuesday, November 6 Homework 6 due Tuesday, November 6 Lab 4 due Thursday, November 8 Current.
Zorica Stanimirović Faculty of Mathematics, University of Belgrade
Genetic Algorithms Michael J. Watts
More on Heuristics Genetic Algorithms (GA) Terminology Chromosome –candidate solution - {x 1, x 2,...., x n } Gene –variable - x j Allele –numerical.
Computational Complexity Jang, HaYoung BioIntelligence Lab.
Genetic Algorithms Introduction Advanced. Simple Genetic Algorithms: Introduction What is it? In a Nutshell References The Pseudo Code Illustrations Applications.
1 “Genetic Algorithms are good at taking large, potentially huge search spaces and navigating them, looking for optimal combinations of things, solutions.
1 Chapter 14 Genetic Algorithms. 2 Chapter 14 Contents (1) l Representation l The Algorithm l Fitness l Crossover l Mutation l Termination Criteria l.
Kansas State University Department of Computing and Information Sciences CIS 732: Machine Learning and Pattern Recognition Friday, 16 February 2007 William.
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.
Genetic Algorithms. Evolutionary Methods Methods inspired by the process of biological evolution. Main ideas: Population of solutions Assign a score or.
2005MEE Software Engineering Lecture 11 – Optimisation Techniques.
Evolution Programs (insert catchy subtitle here).
Why do GAs work? Symbol alphabet : {0, 1, * } * is a wild card symbol that matches both 0 and 1 A schema is a string with fixed and variable symbols 01*1*
1 Genetic Algorithms K.Ganesh Introduction GAs and Simulated Annealing The Biology of Genetics The Logic of Genetic Programmes Demo Summary.
Genetic Algorithms Przemyslaw Pawluk CSE 6111 Advanced Algorithm Design and Analysis
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 Genetic algorithms provide an approach to learning that is based loosely on simulated evolution. Hypotheses are often described by bit.
Genetic Algorithms What is a GA Terms and definitions Basic algorithm.
Genetic Algorithms. 2 Overview Introduction To Genetic Algorithms (GAs) GA Operators and Parameters Genetic Algorithms To Solve The Traveling Salesman.
MAE 552 Heuristic Optimization Instructor: John Eddy Lecture #12 2/20/02 Evolutionary Algorithms.
1. Genetic Algorithms: An Overview  Objectives - Studying basic principle of GA - Understanding applications in prisoner’s dilemma & sorting network.
EE749 I ntroduction to Artificial I ntelligence Genetic Algorithms The Simple GA.
Genetic Algorithms. The Basic Genetic Algorithm 1.[Start] Generate random population of n chromosomes (suitable solutions for the problem) 2.[Fitness]
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5: Power of Heuristic; non- conventional search.
Waqas Haider Bangyal 1. Evolutionary computing algorithms are very common and used by many researchers in their research to solve the optimization problems.
GENETIC ALGORITHM Basic Algorithm begin set time t = 0;
D Nagesh Kumar, IIScOptimization Methods: M8L5 1 Advanced Topics in Optimization Evolutionary Algorithms for Optimization and Search.
1 Chapter 3 GAs: Why Do They Work?. 2 Schema Theorem SGA’s features: binary encoding proportional selection one-point crossover strong mutation Schema.
Why do GAs work? Symbol alphabet : {0, 1, * } * is a wild card symbol that matches both 0 and 1 A schema is a string with fixed and variable symbols 01*1*
Genetic Algorithms. Underlying Concept  Charles Darwin outlined the principle of natural selection.  Natural Selection is the process by which evolution.
Genetic Algorithm Dr. Md. Al-amin Bhuiyan Professor, Dept. of CSE Jahangirnagar University.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal Evolutionary Computation.
Genetic Algorithms. Solution Search in Problem Space.
Genetic Algorithms And other approaches for similar applications Optimization Techniques.
Genetic Algorithm. Outline Motivation Genetic algorithms An illustrative example Hypothesis space search.
Advanced AI – Session 7 Genetic Algorithm By: H.Nematzadeh.
 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.
Introduction to Genetic Algorithms
Chapter 14 Genetic Algorithms.
Chapter 14. Genetic Algorithms
Genetic Algorithms.
Searching for solutions: Genetic Algorithms
Chapter 14. Genetic Algorithms
Population Based Metaheuristics
Presentation transcript:

By Prafulla S. Kota Raghavan Vangipuram GENETIC ALGORITHMS By Prafulla S. Kota Raghavan Vangipuram

Introduction Genetic Algorithms are a form of local search that use methods based on evolution to make small changes to a population of chromosomes in an attempt to identify an optimal solution. We discuss: Representations used for genetic algorithm. Idea of schemata. Genetic operators, crossover and mutations. Procedures used to run Genetic algorithms.

Representations Genetic programming can be used to evolve S-expressions, which can be used as LISP programs to solve problems. A string of bits is known as a chromosome. Each bit is known as a gene. Chromosomes can be combined together to form creatures. We will see how genetic algorithms can be used to solve mathematical problems.

The Algorithm Generate a random population of chromosomes. If the termination criteria are satisfied, stop. Else, continue with step 3. Determine the fitness of each chromosome. Apply crossover and mutation to selected chromosomes from the current generation, to generate a new population of chromosomes – the next generation. Return to step 2.

The size of the population should be determined in advance. The size of each chromosome must remain the same for crossover to be applied. Fittest chromosomes are selected in each generation to produce offspring which replace the previous generation. Each pair of parents produces two offspring.

Fitness When we use traditional genetic algorithm, a metric is needed whereby the fitness of a chromosome can be objectively determined. When we consider real creatures, fitness measure is based on the extent to which the physical form (phenotype) represented by the genetic information (genotype) met certain criteria.

Crossover The crossover operator is applied to two chromosomes of the same length as follows: Select a random crossover point. Break each chromosome into two parts, splitting at the crossover point. Recombine the broken chromosomes by combining the front of one with the back of the other, and vice versa, to produce two new chromosomes.

For example, consider the following two chromosomes: 110100110001001 010101000111101 A crossover point might be chosen between the sixth and seventh genes. 110100 | 110001001 010101 | 000111101

Now the chromosome parts are recombined as follows: 110100 | 000111101 => 110100000111101 010101 | 110001001 => 010101110001001 Single point crossover is the most commonly used form, but it is also possible to apply crossover with two or more crossover positions.

In two point crossover, two points are chosen that divide the chromosomes into two sections, with the outer sections considered to be joined together to turn the chromosome into a ring. The two sections are swapped with each other. 100110001 10 1100 001 011100110 01 0110 110

Uniform Crossover: Parent 1: 100011001 Parent 2: 001101110 Here, a probability, p, is used to determine whether a given bit from parent 1 will be used, or from parent 2. In other words, a child can receive any random bits from each of its parents. Parent 1: 100011001 Parent 2: 001101110 100110001 1 1 10 1 01 011100110 1 11 10

Mutation Similar to Hill-Climbing, which involves generating a possible solution to the problem and moving toward a better solution than the current one until a solution is found from which no better solution can be found. Mutation is a unary operator (it is applied to just one argument – a single gene) that is usually applied with a low probability.

Mutation simply involves reversing the value of a bit in a chromosome. For example, with a mutation rate of 0.01, it might be expected that one gene in a chromosome of 100 genes might be reversed. 010101110001001 010101110101001

Termination Criteria There are typically two ways in which a run of a genetic algorithm is terminated. Usually, a limit is put on the number of generations, after which the run is considered to have finished. The run can stop when a particular solution has been reached, or when the highest fitness level in the population has reached a particular value. In some cases, genetic algorithms are used to generate interesting pictures. In these cases, human judgment must be used to determine when to terminate.

Optimization of a Mathematic Function Use of Genetic Algorithm to maximize value of a mathematic function. Maximize the function: f(x)=sin(x) over the range of ‘x’ from 1 to 15. ‘x’ is in radians. Each chromosome represents a possible value of ‘x’ using four bits.

Discrete graph for f(x)=Sin(x), x ranges from 0 to 15

We will use a population size of four chromosomes. The first step is to generate a random population, which is our first generation: c1=1001 c2=0011 c3=1010 c4=0101 To calculate the fitness of a chromosome, we need to first convert it to a decimal integer and then calculate f(x) for this integer.

We will assign a fitness numeric value from 0 to 100, where 0 is the least fit and 100 is the most fit. f(x) generates real numbers between -1 and 1. We will assign a fitness of 100 to f(x)=1 and fitness of 0 to f(x)= -1. Fitness of 50 will be assigned to f(x)=0. f’(x)= 50[f(x)+1] = 50[Sin(x)+1]

Fitness values of First generation The fitness ratio of a chromosome is that chromosome’s fitness as a percentage of the total fitness of the population. Fitness values of First generation Chromosome Genes Integer value F(x) Fitness F’(x) Fitness ratio C1 1001 9 0.41 70.61 46.3% C2 0011 3 0.14 57.06 37.4% C3 1010 10 -0.54 22.80 14.9% C4 0101 5 -0.96 2.05 1.34%

Now we need to run a single step of our genetic algorithm to produce the next generation. First step is to select which chromosomes will reproduce. Roulette-wheel selection involves using the fitness ratio to randomly select chromosomes to reproduce.

Roulette - wheel selection The range of real numbers from 0 to 100 is divided up between the chromosomes proportionally to each chromosome’s fitness. A random number is now generated between 0 to 100. This number will fall in the range of one of the chromosomes, and this chromosome has been selected for reproduction. The next random number is used to select the chromosome’s mate. Hence, fitter chromosomes will tend to produce more offspring than less fit chromosomes.

It is important that this method does not stop less fit chromosomes from reproducing at all. We will now need to generate four random numbers to find the four parents that will produce the next generation. We first choose 56.7, which falls in the range of c2. So, c2 is parent 1. Next, 38.2 is chosen, so its mate is c1 (parent 2).

We now combine c1 and c2 to produce new offspring. Select a random crossover point. 10 | 01 00 | 11 Crossover is applied to produce two offspring, c5 and c6: c5=1011 c6=0001

Similarly, we calculate c7 and c8 from parents c1 and c3: Observe that c4 did not get a chance to reproduce. So its genes will be lost. c1 was the fittest of all chromosomes. So, it could reproduce twice, thus passing on its highly fit genes to all members of the next generation.

Fitness values for second generation Chromosome Genes Integer value F(x) Fitness F’(x) Fitness ratio C5 1011 11 -1 0% C6 0001 1 0.84 92.07 48.1% C7 1000 8 0.99 99.47 51.9% C8

Why Genetic Algorithms Work It is possible to explain genetic algorithms by comparison with natural evolution: small changes that occur on a selective basis combined with reproduction will tend to improve the fitness of the population over time. John Holland invented schemata to provide an explanation for genetic algorithms that is more rigorous.

Schemata Strings of numbers are used to represent input patterns in classifier systems. In these patterns, * is used to represent “any value” or “don’t care”, so that the following string: 1011*001*0 matches the following strings: 1011000100 1011000110 1011100100 1011100110

A schema is a string of bits that represents a possible chromosome, using * to represent “any value.” A schema is said to match a chromosome if the bit string that represents the chromosome matches the schema in the way shown above. *11* This matches the following four chromosomes 0110 0111 1110 1111

A schema with n *’s will match a total of 2^n chromosomes. Each chromosome of r bits will match 2^r different schemata. The Defining length of a schema is defined as the distance between the first and last defined bits in the schema.

**10111* 1*0*1** 11111 1***1 *****10**1***** The defining length for all the above schemata is 4. dL(S)<=L(S)

Order of the schema is defined a the number of defined bits in the schema. **10*11* 1*0*1**1 1111 1***1***1***1 1*****10***1***** The order of all the above schemata is 4. We denote the order of schema as O(S). Order of the schema tells us how specific it is.

How Reproduction affects Schemata Consider the following population of 10 chromosomes, each of length 32. C1=01000100101010010001010100101010 C2=10100010100100001001010111010101 C3=01010101011110101010100101010101 C4=11010101010101001101111010100101 C5=11010010101010010010100100001010 C6=00101001010100101010010101111010 C7=00101010100101010010101001010011 C8=11111010010101010100101001010101 C9=01010101010111101010001010101011 C10=11010100100101010011110010100001

Let us consider the following schema: This schema is matched by three chromosomes in our population: c4,c5,c10. We say that schema s0 matches three chromosomes in generation ‘i’ and write this as follows: m(s0,i) = 3

The fitness of a schema, S, in generation ‘i’ is written as follows: f(S,i) The fitness of a schema is defined as the average fitness of the chromosomes in the population that match the schema. Hence if we define the fitness of c4, c5, and c10 as follows: f(c4,i)=10 f(c5,i)=22 f(c10,i)=40

Hence, the fitness of the schema s0 is defined as the average of these three values: f(s0,i)=(10+22+40)/3 = 24 We will now consider factors which affect the likelihood of a particular schema surviving from one generation to the next.

Let us assume that there is a chromosome that matches a schema, S, in the population at time i. The number of occurrences of S in the population at time i is: m(S,i) Number of occurrences of S in the population in the subsequent generation is: m(S,i+1)

The fitness of S in generation i is We will calculate the probability that a given chromosome, c, which matches the schema S at time i, will reproduce and thus its genes will be present in the population at time i+1. The probability that a chromosome will reproduce is proportional to its fitness, so the expected number of offspring of chromosome c is: m(c,i+1)=f(c,i)/a(i) Where a(i) is the average fitness of the chromosomes in the population at time i.

Because chromosome c is an instance of schema S, we can thus deduce: m(S, i+1)=f(c1,i)+…..f(Cn,i)/a(i) where C1 to Cn are the chromosomes in the population at time i that match schema S. Let us compare this with the definition of the fitness of schema S, f(S,i), which is defined as follows: f(S,i)=f(c1,i)+…..f(Cn,i)/m(S,i)

By combining the above stated formulas, m(S,i+1)=f(S,i).m(S,i)/a(i) The more fit a schema is compared with the average fitness of the current population, the more likely it is that that schema will appear in a subsequent population of chromosomes. There will be fewer occurrences of a given schema whose fitness is lower than the average fitness of the population and more occurrences of a given schema whose fitness is higher than average.

How Mutation and Crossover Affect Schemata Both mutation and crossover can destroy the presence of a schema. A given schema can be said to have survived crossover, if the crossover operation produces a new chromosome that matches the schema from a parent that also matches the schema. For a schema to survive crossover, the crossover point must be outside the defining length.

Hence, the probability that a schema S of defining length dL(S) and of length L(S) will survive crossover is Ps(S)=1-[dL(S)]/L(S)-1 This formula assumes that crossover is applied to each pair of parents that reproduce. Hence, after certain modifications of the above formula: Ps(S)>=1-(Pc)[dL(S)]/L(S)-1

Effect of Mutation: Probability that mutation will be applied is Pm. Hence, a schema will survive mutation if mutation is not applied to any of the defined bits. The probability of survival can be defined as: Ps(S)=(1-Pm)^O(s) Hence, a schema is more likely to survive mutation if it has lower order

We can combine all the equations we have to give one equation that defines the likelihood of a schema surviving reproduction using crossover and mutation. That equation represents the schema theorem, developed by Holland, which can be stated as: “Short, low order schemata which are fitter than the average fitness of the population will appear with exponentially increasing regularity in subsequent generations.”

The Building Block Hypothesis The short, low order, high-fitness schemata are known as building blocks. Genetic algorithms work well when a small group of genes that are close together represent a feature that contributes to the fitness of a chromosome. Randomly selecting bit to represent particular features of a solution is not good enough. Bits should be selected in such a way that they group naturally together into building blocks, which genetic algorithm are designed to manipulate.

Deception: Genetic Algorithms can be mislead or deceived by some building blocks into heading toward sub-optimal solutions. One way to avoid effects of deception is to use inversion, which is a unary operator that reverses the order of a subset of the bits within a chromosome. Another way to avoid deception is to use Messy Genetic Algorithms.

Messy Genetic Algorithms (mGA’s) Developed as an alternative to standard genetic algorithms. Each bit is labeled with its position. A chromosome does not have to contain a value for each position, and, a given position in a chromosome can have more than one value. Each bit in a chromosome is represented by a pair of numbers: the first number represents the position within the chromosome, and the second number is the bit value.

mGA’s use the standard mutation operation mGA’s use the standard mutation operation. But, instead of crossover, they use splice and cut operations. Two chromosomes can be spliced together by simply joining one to the end of other. The cut operator splits one chromosome, into two smaller chromosomes.

Evolution of Strategies The process for running this genetic algorithm is as follows: Produce a random population of chromosomes. We will start with 100. Determine a score for each chromosome by playing its strategy against a number of opponents. Select chromosomes for the population to reproduce. Replace the previous generation with new population produced by reproduction. Return to step 2.

Problems: Most Combinatorial search problems can be successfully solved using genetic algorithms. Genetic Algorithms can be applied to: Travelling Salesman Problem The Knight’s tour. The CNF- satisfiability problem. Robot Navigation. Knapsack Problem Time Table problem.

THANK YOU