Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 14 Genetic Algorithms.

Similar presentations


Presentation on theme: "Chapter 14 Genetic Algorithms."— Presentation transcript:

1 Chapter 14 Genetic Algorithms

2 Chapter 14 Contents (1) Representation The Algorithm Fitness Crossover
Mutation Termination Criteria Optimizing a mathematical function

3 Chapter 14 Contents (2) Schemata
The Effect of Reproduction on Schemata The Effect of Crossover and Mutation The Schema Theorem The Building Block Hypothesis Deception Messy Genetic Algorithms Evolving Pictures Co-Evolution

4 Representation Genetic techniques can be applied with a range of representations. Usually, we have a population of chromosomes (individuals). Each chromosome consists of a number of genes. Other representations are equally valid.

5 The Algorithm The algorithm used is as follows:
Generate a random population of chromosomes (the first generation). If termination criteria are satisfied, stop. Otherwise, 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.

6 Fitness Fitness is an important concept in genetic algorithms.
The fitness of a chromosome determines how likely it is that it will reproduce. Fitness is usually measured in terms of how well the chromosome solves some goal problem. E.g., if the genetic algorithm is to be used to sort numbers, then the fitness of a chromosome will be determined by how close to a correct sorting it produces. Fitness can also be subjective (aesthetic)

7 Crossover (1) Crossover is applied 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.

8 Crossover (2) Usually, crossover is applied with one crossover point, but can be applied with more, such as in the following case which has two crossover points: Uniform crossover involves using a probability to select which genes to use from chromosome 1, and which from chromosome 2.

9 Mutation A unary operator – applies to one chromosome.
Randomly selects some bits (genes) to be “flipped” 1 => 0 and 0 =>1 Mutation is usually applied with a low probability, such as 1 in 1000.

10 Termination Criteria A genetic algorithm is run over a number of generations until the termination criteria are reached. Typical termination criteria are: Stop after a fixed number of generations. Stop when a chromosome reaches a specified fitness level. Stop when a chromosome succeeds in solving the problem, within a specified tolerance. Human judgement can also be used in some more subjective cases.

11 Optimizing a mathematical function
A genetic algorithm can be used to find the highest value for f(x) = sin (x). Each chromosome consists of 4 bits, to represent the values of x from 0 to 15. Fitness ranges from 0 (f(x) = -1) to 100 (f(x) = 1). By applying the genetic algorithm it takes just a few generations to find that the value x =8 gives the optimal solution for f(x).

12 Schemata (1) As with the rules used in classifier systems, a schema is a string consisting of 1’s, 0’s and *’s. E.g.: 1011*001*0 Matches the following four strings: a schema with n *’s will match a total of 2n chromosomes. Each chromosome of r bits will match 2r different schemata.

13 Schemata (2) The defining length dL(S) of a schema, S, is the distance between the first and last defined bits. For example, the defining length of each of the following schemata is 4: **10111* 1*0*1** The order O(S) is number of defined bits in S. The following schemata both have order 4: **10*11* 1*0*1**1 A schema with a high order is more specific than one with a lower order.

14 Schemata (3) The fitness of a schema is defined as the average fitness of the chromosomes that match the schema. The fitness of a schema, S, in generation i is written as follows: f(S, i) The number of occurrences of S in the population at time i is : m(S, i)

15 The Effect of Reproduction on Schemata
The probability that a chromosome c will reproduce is proportional to its fitness, so the expected number of offspring of c is: a(i) is the average fitness of the chromosomes in the population at time i If c matches schema S, we can rewrite as: c1 to cn are the chromosomes in the population at time i which match the schema S.

16 The Effect of Reproduction on Schemata
Since: We can now write: This tells us that a schema that is fit will have more chance of appearing in a subsequent generation than less fit chromosomes.

17 The Effect of Crossover
For a schema S to survive crossover, the crossover point must be outside the defining length of S. Hence, the probability that S will survive crossover is: This tells us that a short schema is more likely to survive crossover than a longer schema. In fact, crossover is not always applied, so the probability that crossover will be applied should also be taken into account.

18 The Effect of Mutation The probability that mutation will be applied to a bit in a chromosome is pm Hence, the probability that a schema S will survive mutation is: We can combine this with the effects of crossover and reproduction to give:

19 The Schema Theorem Holland’s Schema Theorem, represented by the above formula, can be written as: Short, low order schemata which are fitter than the average fitness of the population will appear with exponentially increasing regularity in subsequent generations. This helps to explain why genetic algorithms work. It does not provide a complete answer.

20 The Building Block Hypothesis
Genetic algorithms manipulate short, low-order, high fitness schemata in order to find optimal solutions to problems.” These short, low-order, high fitness schemata are known as building blocks. Hence genetic algorithms work well when small groups of genes represent useful features in the chromosomes. This tells us that it is important to choose a correct representation.

21 Deception Genetic algorithms can be deceived by fit building blocks that happen not to combine to give the optimal solutions. Deception can be avoided by inversion: this involves reversing the order of a randomly selected group of bits within a chromosome.

22 Messy Genetic Algorithms (1)
An alternative to standard genetic algorithms that avoid deception. Each bit in the chromosome is represented as a (position, value) pair. For example: ((1,0), (2,1), (4,0)) In this case, the third bit is undefined, which is allowed with MGAs. A bit can also overspecified: ((1,0), (2,1), (3,1), (3,0), (4,0))

23 Messy Genetic Algorithms (2)
Underspecified bits are filled with bits taken from a template chromosome. The template chromosome is usually the best performing chromosome from the previous generation. Overspecified bits are usually dealt with by working from left to right and using the first value specified for each bit.

24 Messy Genetic Algorithms (3)
MGAs use splice and cut instead of crossover. Splicing involves simply joining two chromosomes together: ((1,0), (3,0), (4,1), (6,1)) ((2,1), (3,1), (5,0), (7,0), (8,0)) ((1,0), (3,0), (4,1), (6,1), (2,1), (3,1), (5,0), (7,0), (8,0)) Cutting involves splitting a chromosome into two: ((1,0), (3,0), (4,1)) ((6,1), (2,1), (3,1), (5,0), (7,0), (8,0))

25 Evolving Pictures Dawkins used genetic algorithms with subjectives metrics for fitness to evolve pictures of insects, trees and other “creatures”. The human selection of fitness can be used to produce amazing pictures that a person would otherwise not be able to produce.

26 Co-Evolution In the real world, the presence of predators is responsible for many evolutionary developments. Similarly, in many artificial life systems, introducing “predators” produces better results. This process is known as co-evolution. For example, Ramps, which were evolved to sort numbers: “parasites” were introduced which produced sets of numbers that were harder to sort, and the ramps produced better results.


Download ppt "Chapter 14 Genetic Algorithms."

Similar presentations


Ads by Google