1 / 17

Chapter 6: Transform and Conquer

The Design and Analysis of Algorithms. Chapter 6: Transform and Conquer. Genetic Algorithms. Genetic Algorithms. What is a GA Terms and Definitions Basic Genetic Algorithm Example Selection Methods Crossover Methods Mutation. What is a GA.

limei
Download Presentation

Chapter 6: Transform and Conquer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Design and Analysis of Algorithms Chapter 6:Transform and Conquer Genetic Algorithms

  2. Genetic Algorithms • What is a GA • Terms and Definitions • Basic Genetic Algorithm • Example • Selection Methods • Crossover Methods • Mutation

  3. What is a GA • Searches for good solutions among possible solutions. • Uses evolutionary mechanisms including natural selection, reproduction, mutation • The best possible solution may be missed • Useful in problems that are too big or too difficult to solve with conventional techniques.

  4. Terms and Definitions (1) • A solutionis coded by astring, also calledchromosome. The words string and chromosome are used interchangeably • A strings fitnessis a measure of how good a solution it codes. Fitness is calculated by a fitness function.

  5. Terms and Definitions (2) • Selection:The procedure to choose parents • Roulette wheel selection is a way of picking out a string from among a group of strings (a population). • A wedge on a roulette wheel proportional to the string's fitness. • A 'fit' string is more likely to be chosen than an 'unfit' string.

  6. Terms and Definitions (3) • Crossoveris the procedure by which two chromosomes mate to create a new offspring chromosome • parent 1 is copied of up to a randomly chosen point, and parent 2 is copied from that point onwards. Parent 1 1 0 0 | 1 1 0 Parent 2 0 1 1 | 1 0 0 Offspring1 1 0 01 0 0 Offspring2 0 1 11 1 0

  7. Terms and Definitions (4) • Mutation : with a certain probability flip a bit in the offspring • Various ways to implement mutation, optional.

  8. Basic Genetic Algorithm • Start:Generate random population of n chromosomes (suitable solutions for the problem) • Fitness: Evaluate the fitness f(x) of each chromosome x in the population • New population:Create a new population by repeating following steps until the new population is complete • Test:If the end condition is satisfied, stop, and return the best solution in current population

  9. New Population • Selection: Select two parent chromosomes from a population according to their fitness (the better fitness, the bigger chance to be selected) • Crossover: With a crossover probability cross over the parents to form a new offspring (children). If no crossover was performed, offspring is an exact copy of parents. • Mutation: With a mutation probability mutate new offspring at each locus (position in chromosome).

  10. Termination Criteria • After a pre-specified number of generations • When an individual solution reaches a pre-specified level of fitness • When the variation of individuals from one generation to the next reaches a pre-specified level of stability, e.g. all become equal

  11. Example: The Knapsack Problem • A knapsack with capacity C, • A set of items each with volume and value. • Find a subset of the items that can fit in the knapsack and has maximum value. • This is an optimization NP problem. Given n items, the number of all subsets to be examined is 2n.

  12. Example (cont.) Sample candidate solutions O1 O2 O3 O4 Volume Value 1 0 1 0 1 8 7 2 1 0 0 1 9 8 3 1 0 1 0 5 6 4 0 1 1 1 9 10 <<<<< 5 0 1 1 0 4 5

  13. Issues • How to represent an individual • How to choose • the fitness function • the selection method • the crossover method • the frequency of mutations

  14. More on Selection • Roulette Wheel Selection: proportional to the fitness • Rank Selection: rank is assigned based on fitness, then choose proportional to the rank • Steady-State Selection: sort and always choose the best • Elitism: copy the best individuals in the next generation • Tournament selection

  15. Tournament Selection Saves time used for sorting • Fix a constant k < 1, e.g. k =0.75 • Randomly choose two individuals and a random number r < 1 • if r < k, select the individual with the higher fitness to be a parent, otherwise select the other individual to be a parent • Repeat steps 2 and 3 until the new generation is created

  16. More on Crossover • Random point of split • Fixed point of split • Single point: split in two • Two points: split in three • Uniform: bits are chosen randomly • Arithmetic crossover: the offspring is a result of some arithmetic operation • Two parents • Three parents

  17. Applications • Optimization problems • Search in a pool of candidate solutions Tutorial: http://www.obitko.com/tutorials/genetic-algorithms/

More Related