1 / 112

Genetic Algorithms

Genetic Algorithms. 虞台文. Content. Evolutional Algorithms Genetic Algorithms Main Components of Genetic Algorithms Encoding Fitness Function Recombination Mutation Population Selection Models. Genetic Algorithms. Evolutional Algorithms. Biological Evolution. Motivated from Nature.

Télécharger la présentation

Genetic Algorithms

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. Genetic Algorithms 虞台文

  2. Content • Evolutional Algorithms • Genetic Algorithms • Main Components of Genetic Algorithms • Encoding • Fitness Function • Recombination • Mutation • Population • Selection Models

  3. Genetic Algorithms Evolutional Algorithms

  4. Biological Evolution

  5. Motivated from Nature • Nature evolve strikingly complex organisms in response to complex environmental adaptation problems with apparent ease • Localize and extract principles from nature • Apply them to design algorithms

  6. Darwinian Evolution 1: Survival of the Fittest 1809-1882 • All environments have finite resources • can only support a limited number of individuals • Lifeforms have basic instinct/lifecycles geared towards reproduction • Therefore some kind of selection is inevitable • Those individuals that compete for the resources most effectively have increased chance of reproduction • Note: fitness in natural evolution is a derived, secondary measure, i.e., we (humans) assign a high fitness to individuals with many offspring

  7. Darwinian Evolution 2: Diversity Drives Change 1809-1882 • Phenotypictraits: • Behaviour/physical differences that affect response to environment • Partly determined by inheritance, partly by factors during development • Unique to each individual, partly as a result of random changes • If phenotypic traits: • Lead to higher chances of reproduction • Can be inherited then they will tend to increase in subsequent generations and, hence, lead to new combinations of traits …

  8. Darwinian Evolution:Summary 1809-1882 • Population consists of diverse set of individuals • Combinations of traits that are better adapted tend to increase representation in population Individuals are “units of selection” • Variations occur through random changes yielding constant source of diversity, coupled with selection means that: Population is the “unit of evolution” • Note the absence of “guiding force”  w/o God

  9. Parent Selection Initialization Recombination Mutation Termination Survivor Selection General Scheme ofEvolutional Algorithms (EAs) Parents Population Offspring

  10. Parent Selection Initialization Recombination Mutation Termination Survivor Selection • A set of individuals corresponding to candidate solutions to a problem. • Each individual has a fitness value. • How to represent the individuals? • How to define the fitness function? General Scheme ofEvolutional Algorithms (EAs) Parents Population Offspring

  11. Parent Selection Initialization Recombination Mutation Termination Survivor Selection Better individuals get higher probability to become the parents of the next generation. General Scheme ofEvolutional Algorithms (EAs) Parents Population Variation operators Offspring

  12. Parent Selection Initialization Recombination Mutation Termination Survivor Selection General Scheme ofEvolutional Algorithms (EAs) Parents Replace some old individuals with newly born ones. Population Offspring

  13. Pseudo-Code for Typical EA

  14. Typical Behavior of an EA Early phase: quasi-random population distribution Mid-phase: population arranged around/on hills Late phase: population concentrated on high hills

  15. Components of EAs • Representation  definition of individuals • Evaluation function  fitness function • Population • Parent selection mechanism • Variation operators • Recombination • Mutation • Survivor selection mechanism  replacement • Termination

  16. Different Types of EAs • Historically, different flavours of EAs have been associated with differentrepresentations • Binary strings : Genetic Algorithms • Real-valued vectors : Evolution Strategies • Finite state Machines: Evolutionary Programming • LISP trees: Genetic Programming

  17. Binary strings : Genetic Algorithms • Real-valued vectors : Evolution Strategies • Finite state Machines: Evolutionary Programming • LISP trees: Genetic Programming Different Types of EAs • Historically, different flavours of EAs have been associated with differentrepresentations Genetic Algorithms Evolution Strategies

  18. Binary strings : Genetic Algorithms • Real-valued vectors : Evolution Strategies • Finite state Machines: Evolutionary Programming • LISP trees: Genetic Programming Different Types of EAs • Historically, different flavours of EAs have been associated with differentrepresentations Evolutionary Programming Genetic Programming

  19. Genetic Algorithms Genetic Algorithms

  20. The Genetic Algorithm • Directed search algorithms based on the mechanics of biological evolution • Developed by John Holland, University of Michigan (1970’s) • To understand the adaptive processes of natural systems • To design artificial systems software that retainsthe robustness of natural systems

  21. Genetic Algorithms • Holland’s original GA is now known as the simple genetic algorithm (SGA) • Other GAs use different: • Representations • Mutations • Crossovers • Selection mechanisms

  22. SGA Technical Summary Tableau

  23. Encoding (representation) Decoding (inverse representation) Representation Genotype space Phenotype space 10010001 10010010 010001001 011101001

  24. SGA Evolution Cycle • Select parents for the mating pool • (size of mating pool = population size) • Shuffle the mating pool • For each consecutive pair apply crossover with probability pc , otherwise copy parents • For each offspring apply mutation (bit-flip with probability pm independently for each bit) • Replace the whole population with the resulting offspring

  25. SGA Operators: 1-Point Crossover • Choose a random point on the two parents • Split parents at this crossover point • Create children by exchanging tails • pc typically in range (0.6, 0.9)

  26. SGA Operators: Mutation • Alter each gene independently with a probability pm • pmis called the mutation rate • Typically between 1/pop_size and1/chromosome_length

  27. fitness(A) = 3 fitness(B) = 1 fitness(C) = 2 SGA Operators: Selection • Main idea: better individuals get higher chance • Chances proportional to fitness • Implementation  roulette wheel technique • Assign to each individual a part of the roulette wheel • Spin the wheel n times to select n individuals

  28. Exercise: The OneMax Problem • The OneMax Problem (or BitCounting) is a simple problem consisting in maximizing the number of ones of a bitstring. • Formally, this problem can be described as finding a string x = (x1, x2, …, xn) , with xi{0, 1} , that maximizes the following equation:

  29. Genetic Algorithms Main Components of GA’s

  30. Nature-to-Computer Mapping

  31. Main Components of GA’s • Encoding principles (gene, chromosome) • Initialization procedure (creation) • Selection of parents (reproduction) • Genetic operators (mutation, recombination) • Fitness function (environment) • Termination condition

  32. Encoding • The process of representing the solution in the form of a string that conveys the necessary information. • Just as in a chromosome, each gene controls a particular characteristic of the individual, similarly, each bit in the string represents a characteristic of the solution. • Hence, the encoding mechanismdepends on thenature of theproblem variables.

  33. Commonly Used Encoding Schemes • Binary Encoding • most common and simplest one • Permutation Encoding • used in “ordering problems”, e.g., TSP • Direct Value Encoding • used in problems with complicatedvalues • Tree Encoding • used mainly for evolving programs or expressions, e.g., genetic programming

  34. Chromosome A 10110010110011100101 Chromosome B 11111110000000011111 • Binary Encoding • Permutation Encoding • Direct Value Encoding • Tree Encoding Binary Encoding • Most common method of encoding. • Chromosomes are strings of 1s and 0s and each position in the chromosome represents a particular characteristic of the problem.

  35. Chromosome A 1  5  3  2  6  4  7  9  8 Chromosome B 8  5  6  7  2  3  1  4  9 • Binary Encoding • Permutation Encoding • Direct Value Encoding • Tree Encoding Permutation Encoding • Useful in ordering problems such as the Traveling Salesman Problem (TSP). • Every chromosome is a string of numbers, each of which represents a city to be visited.

  36. Chromosome A 1.235  5.323  0.454  2.321  2.454 Chromosome B (left), (back), (left), (right), (forward) • Binary Encoding • Permutation Encoding • Direct Value Encoding • Tree Encoding Direct Value Encoding • Used in problems where complicated values, such as real numbers, are used and where binary encoding would not suffice. • Good for some problems, but often necessary to develop some specific crossover and mutation techniques for these chromosomes.

  37. Binary Encoding • Permutation Encoding • Direct Value Encoding • Tree Encoding Tree Encoding • Tree encoding is used mainly for evolving programs or expressions for genetic programming. • In tree encoding every chromosome is a tree of some objects, such as functions or commands in programming language.

  38. More on Binary Encoding Gray coding of integers

  39. More on Binary Encoding Gray coding of integers • Gray codingis a mapping that “attempts” to improve causality, i.e., small changes in the genotype cause small changes in the phenotype, unlike binary coding. • “Smoother” genotype-phenotype mapping makes life easier for the GA. • Nowadays it is generally accepted that it is better to encode numerical variables directly asintegers and floating pointvariables

  40. More on Binary Encoding Interval Representation • z [x, y]represented by {a1,…,aL} {0,1}L • [x, y]  {0,1}Lmust be invertible • : {0,1}L [x, y]defines the representation

  41. Crossover • It is the process in which two chromosomes (strings) combine their genetic material (bits) to produce a new offspring which possesses both their characteristics. • Two strings are picked from the mating pool at random to cross over. • The method chosen depends on the Encoding Method.

  42. Crossover • It is the process in which two chromosomes (strings) combine their genetic material (bits) to produce a new offspring which possesses both their characteristics. • Two strings are picked from the mating pool at random to cross over. • The method chosen depends on the Encoding Method.

  43. Crossover Operators • Binary Encoding • 1-Point Crossover • 2-Point Crossover • N-Point Crossover • Uniform Crossover • Permutation Encoding

  44. Binary Encoding  1-Point Crossover

  45. Binary Encoding  2-Point Crossover

  46. Binary Encoding  N-Point Crossover • Choose N random crossover points • Split along those points • Glue parts, alternating between parents

  47. Binary Encoding  Uniform Crossover • Each gene (bit) is selected randomly from one of the corresponding genes of the parent chromosomes.

  48. Permutation Encoding  Order Crossover (OX) • Builds offspring by choosing a sub-sequence of a tour from one parent and preserving the relative order of cities from the other parent and feasibility 1 2 3 4 5 6 7 8 9 4 5 2 1 8 7 6 9 3

  49. 1 2 3 4 5 6 7 8 9 Permutation Encoding  Order Crossover (OX) • Builds offspring by choosing a sub-sequence of a tour from one parent and preserving the relative order of cities from the other parent and feasibility 1 2 3 4 5 6 7 8 9     4 5 2 1 8 7 6 9 3

  50. 1 2 3 4 5 6 7 8 9 Permutation Encoding  Order Crossover (OX) • Builds offspring by choosing a sub-sequence of a tour from one parent and preserving the relative order of cities from the other parent and feasibility 1 2 3 4 5 6 7 8 9 2 1 8 9 3     4 5 2 1 8 7 6 9 3

More Related