Genetic Algorithms Michael J Watts http mike watts

  • Slides: 36
Download presentation
Genetic Algorithms Michael J. Watts http: //mike. watts. net. nz

Genetic Algorithms Michael J. Watts http: //mike. watts. net. nz

Lecture Outline a. Genetic algorithms b. Jargon c. Advantages of GAs d. Disadvantages of

Lecture Outline a. Genetic algorithms b. Jargon c. Advantages of GAs d. Disadvantages of GAs e. Simple genetic algorithm f. Encoding schemata g. Fitness evaluation

Lecture Outline a. Selection b. Creating new solutions c. Crossover d. Mutation e. Replacement

Lecture Outline a. Selection b. Creating new solutions c. Crossover d. Mutation e. Replacement strategies f. Word matching example

Genetic Algorithms “Genetic algorithms are search algorithms based on the mechanics of natural selection

Genetic Algorithms “Genetic algorithms are search algorithms based on the mechanics of natural selection and natural genetics” Goldberg, 1989

Genetic Algorithms a. A kind of evolutionary algorithm b. Also known as GA(s)

Genetic Algorithms a. A kind of evolutionary algorithm b. Also known as GA(s)

Jargon a. Locus - a position on a chromosome b. Gene - a portion

Jargon a. Locus - a position on a chromosome b. Gene - a portion of a chromosome representing a parameter of the solution set c. Alleles - different values of a particular gene. Members of the domain of the gene’s value d. Chromosome - string of genes

Jargon a. Genotype - coding of the solution b. Phenotype - expression of the

Jargon a. Genotype - coding of the solution b. Phenotype - expression of the genotype c. Population - group of individuals capable of interbreeding

Advantages of GA a. Efficient means of investigating large combinatorial problems a. can solve

Advantages of GA a. Efficient means of investigating large combinatorial problems a. can solve combinatorial problems many orders of magnitude faster than exhaustive ‘brute force’ searches

Disadvantages of GA a. GAs are not ‘silver bullets’ for solving problems b. Must

Disadvantages of GA a. GAs are not ‘silver bullets’ for solving problems b. Must be able to assess the quality of each attempt at a solution a. can’t crack PGP with a GA

Disadvantages of GA a. Computationally expensive a. some problems require many days or weeks

Disadvantages of GA a. Computationally expensive a. some problems require many days or weeks to run b. often still faster than brute force, however b. Blind, undirected search a. difficult to direct a GA towards optimal solution area if known

Disadvantages of GA a. Can be sensitive to initial parameters a. parameters such as

Disadvantages of GA a. Can be sensitive to initial parameters a. parameters such as mutation can significantly influence the search b. Stochastic process a. not guaranteed to find an optimal solution, just highly likely to

Simple Genetic Algorithm 1. Select an encoding schema 2. Randomly initialise chromosome pool 3.

Simple Genetic Algorithm 1. Select an encoding schema 2. Randomly initialise chromosome pool 3. Evaluate each individual in the population 4. Select fit individuals to breed new population 5. Create new population from parents 6. Replace old population with new population 7. Repeat steps 3 - 6 for each generation

Encoding Schemata a. Two competing principles b. Meaningful building blocks a. “user should select

Encoding Schemata a. Two competing principles b. Meaningful building blocks a. “user should select a coding so that short, low order schemata are relevant to the underlying problem” c. Minimal alphabets a. “user should select the smallest alphabet that permits a natural expression of the problem”

Fitness Evaluation a. Method dependent upon problem b. Involves quantifying performance of the phenotypes

Fitness Evaluation a. Method dependent upon problem b. Involves quantifying performance of the phenotypes

Fitness Evaluation a. Normalisation or scaling of fitness values required to prevent good solution

Fitness Evaluation a. Normalisation or scaling of fitness values required to prevent good solution overwhelming later generations a. known b. similar as “premature convergence” to the ‘local minima’ problem with neural networks

Selection a. Involves selecting the parents of the next generation b. Many methods in

Selection a. Involves selecting the parents of the next generation b. Many methods in existence c. All based upon the fitness of the individual

Selection a. Roulette selection a. each individual is given a slice of a virtual

Selection a. Roulette selection a. each individual is given a slice of a virtual roulette wheel b. size of each slice is proportional to fitness c. spin the wheel once to select each individual

Roulette Selection

Roulette Selection

Roulette Selection

Roulette Selection

Create New Solutions a. Creates new individuals from selected parents b. Two operators come

Create New Solutions a. Creates new individuals from selected parents b. Two operators come into play a. crossover, b. Mutation and

Crossover a. Two chromosomes join at one or more points and exchange genes b.

Crossover a. Two chromosomes join at one or more points and exchange genes b. Types of crossover include

Crossover a. One point a. chromosomes join at only one locus

Crossover a. One point a. chromosomes join at only one locus

Crossover a. Two point a. chromosomes join at two loci

Crossover a. Two point a. chromosomes join at two loci

Crossover a. Uniform a. crossover toss” at each locus determined by a “coin

Crossover a. Uniform a. crossover toss” at each locus determined by a “coin

Mutation a. One or more allele is randomly chosen and it’s value changed b.

Mutation a. One or more allele is randomly chosen and it’s value changed b. Method of change depends upon coding schema used c. Best rate of mutation subject of much current research

Mutation a. Some dispute it’s necessity b. Effect of mutation dependent upon size of

Mutation a. Some dispute it’s necessity b. Effect of mutation dependent upon size of alphabet a. the higher the cardinality of the alphabet, the lower the benefit of mutation

Replacement Strategies a. Replace some or all of the parent population with children b.

Replacement Strategies a. Replace some or all of the parent population with children b. Many different replacement strategies available c. Most concerned with preserving ‘good’ genes and purging ‘bad’ genes

Word Matching Example a. Problem is to ‘guess’ a word b. Difficult to solve

Word Matching Example a. Problem is to ‘guess’ a word b. Difficult to solve with a brute force approach a. assuming case sensitivity, to investigate every possible combination of letters in a seven letter word would require 1, 028, 071, 702, 528 attempts

Word Matching Example a. Assume trying to guess the word ‘genetic’ a. assign fitness

Word Matching Example a. Assume trying to guess the word ‘genetic’ a. assign fitness based on number of correct letters in the correct place b. Step one: select an encoding schema a. use characters

Word Matching Example a. Step two: initialise the population 1. kdjirid 2. ginddcc 3.

Word Matching Example a. Step two: initialise the population 1. kdjirid 2. ginddcc 3. nmugjyb 4. zezezez 5. uhjklyt 6. wojikli 7. kladonn 8. flortik

Word Matching Example a. Step three: evaluate the population Average fitness = 1

Word Matching Example a. Step three: evaluate the population Average fitness = 1

Word Matching Example a. Step four: select breeding population a. selection based on fitness,

Word Matching Example a. Step four: select breeding population a. selection based on fitness, so breeding population is

Word Matching Example a. Step five: create new population a. crossover comes into play

Word Matching Example a. Step five: create new population a. crossover comes into play b. no mutation used here to keep things simple c. eg. cross individual 2 with individual 4 a. individual 2 genotype is: ginddcc d. individual 4 genotype is: zezezez e. crossing over produces : genedec

Word Matching Example a. New population is: average fitness = 2. 375

Word Matching Example a. New population is: average fitness = 2. 375

Summary a. Genetic algorithms are a class of evolutionary algorithm b. Able to efficiently

Summary a. Genetic algorithms are a class of evolutionary algorithm b. Able to efficiently investigate large search spaces c. Have two major requirements a. representation b. Evaluation

Summary a. Population evolves by creating more offspring from fitter members a. fitness based

Summary a. Population evolves by creating more offspring from fitter members a. fitness based selection b. Offspring created using crossover and mutation operators c. Must be mindful of the disadvantages