720 likes | 1.03k Views
Evolutionary Computation (EC). eie426-ec-200809.ppt. Contents. Basic Concepts of EC Genetic Algorithms An Example Chromosome Representation Stopping Criteria Initial Population Selection Mechanisms Crossover and Mutation Fitness Functions Another Example
E N D
Evolutionary Computation (EC) eie426-ec-200809.ppt EIE426-AICV
Contents • Basic Concepts of EC • Genetic Algorithms • An Example • Chromosome Representation • Stopping Criteria • Initial Population • Selection Mechanisms • Crossover and Mutation • Fitness Functions • Another Example • Application: Routing Optimization • Advantages and Disadvantages of EC EIE426-AICV
Evolution and Search • Evolution - search through the enormous genetic parameter space for the best genetic make-up. • Borrow ideas from nature to help us solve problems that have equally large search spaces or similarly changing environment. EIE426-AICV
Natural Evolution Individual Fitness Environment Natural Evolution and Evolutionary Computation Evolutionary Computing Candidate Solution Quality Problem EIE426-AICV
Different ECs Several classes of EC algorithms have been developed: - Genetic algorithms (GA’s): model genetic evolution - Genetic programming: based on GA’s, but individuals are programs (represented as trees) - Evolutionary programming: from the simulation of adaptive behavior in evolution (phenotype evolution) - Evolution strategies: model the strategic parameters that control variation in evolution, i.e., the evolution of evolution - Culture evolution: models the evolution of culture of a population and how the culture influences the evolution of individuals. - Co-evolution: individuals evolve through cooperation, or in competition with one other. EIE426-AICV
Basic Concepts • Chromosome: individual • Population: many individuals • Gene: each characteristics of chromosome (one parameter) • Allele: the value of a gene • Crossover: generate offspring by combining parts of the parents. • Mutation: introduce new genetic material into an existing individual. • Fitness: the survival strength of an individual • Culling (removing) and elitism (copying) EIE426-AICV
Parents Population Offspring Evolutionary Computation Selection Recombination (Crossover) Mutation Replacement The evolutionary cycle EIE426-AICV
Genetic Algorithms • The GA was the first EC paradigm developed and applied (Holland 1975). • The features of the original GA’s: • A bit string representation • Proportional selection • Cross-over as the primary method to produce new individuals. • Several changes have been made: • Different representation schemes • Different selection methods • Different GA operators (cross-over, mutation and elitism) EIE426-AICV
Random Search • The GA is a search procedure. • Random search is possibly the simplest search procedure. Its training time may be very long before an acceptable solution is obtained. • Procedure: • Start from an initial search point or a set of initial points. • Random perturbations to the points • Repeat until an acceptable solution is reached or a maximum number of iterations is exceeded. EIE426-AICV
General Genetic Algorithm • Let g = 0. • Initialize the initial generation Cg . • While no stopping criterion is satisfied (a) Evaluate the fitness of each individual in Cg . (b) g g+1. (c) Select parents from Cg-1. (d) Recombine selected parents through cross-over to form offspring Og (with a probability pc). (e) Mutate offspring in Og (with a probability pm). (f) Select the new generation Cg from (the previous generation Cg-1, e.g., the best individuals are copied) and the offspring Og. g: generation Note: The things in () might or might not be carried out. EIE426-AICV
An Example EIE426-AICV
Use a genetic algorithm to solve the problem: • Coding (chromosome representation of a solution) • Generation of initial population (solutions) • Fitness calculation • Genetic operation EIE426-AICV
Coding (chromosome representation): Use a binary string to represent x. If the solution is to be precise to 10-6, then the interval (2-(-1)) = 3 should be divided into 3× 106. At least 22 bits should be used because EIE426-AICV
Decoding EIE426-AICV
Generation of initial population A set of N 22-bit binary strings can be randomly generated as the initial population. EIE426-AICV
Fitness calculation Since f(x) > 0 in the interval, we can directly use f(x) as a fitness function: f(s) = f(x) e.g., s1 = <1000101110110101000111>, f(s1)=2.586345 s2 = <0000001110000000010000>, f(s2)=1.078878 s3 = <1110000000111111000101>, f(s3)= 3.250650 EIE426-AICV
Genetic operation (1) Selection: based on the fitness of individuals e.g., roulette wheel selection (fitness proportionate selection) (2) Crossover (with a probability pc) e.g., s2 = <00000 |01110000000010000>, f(s2)=1.078878 s3 = <11100 |00000111111000101>, f(s3)= 3.250650 After the crossover operation: s’2 = <00000 |00000111111000101>, f(s’2)=1.940865 s’3 = <11100 |01110000000010000 >, f(s’3)= 3.459245 EIE426-AICV
(3) Mutation (with a probability pm) e.g., s3 = <1110000000111111000101> f(s3)= 3.250650 After the mutation operation: s’3 = <1110100000111111000101 > f(s’3)= 0.917743 or s3 = <1110000000111111000101> s”3 = <1110000001111111000101 > f(s”3)= 3.343555 EIE426-AICV
Simulation results: N = 50, pc = 0.25, pm = 0.01, at 89 generations, the best individual was obtained: smax = <1101001111110011001111> xmax = 1.850 549 f(xmax) = 3.850 274 EIE426-AICV
The best individual at each iteration (up to 150 generations) EIE426-AICV
Summary on Basic Concepts • Evolution is an optimization process, where the aim is to improve the ability of individuals to survive. • An evolutionary algorithm (EA) is a stochastic search for an optimal solution to a given problem. • Evolution - search through the enormous genetic parameter space for the best genetic make-up. • Borrow ideas from nature to help us solve problems that have an equally large search spaces or similarly changing environment. EIE426-AICV
Genotype: describes the genetic composition of an individual • Phenotype: the expressed behavioral traits of an individual in a specific environment. • Selection: use the fitness evaluations to decide which are the best parents to reproduce. • Crossover: generate offspring by combining parts of the parents • Mutation: introduce new genetic material into an existing individual. • Coding: phenotype genotype • Decoding: genotype phenotype EIE426-AICV
Simple Genetic Algorithm (SGA) EIE426-AICV
Chromosome Representation Genotype space = {0,1}I I-bit binary strings Phenotype space Coding (encoding or (representation) 10010001 10010010 010001001 011101001 Decoding (inverse representation) EIE426-AICV
Binary-valued variables: no extra coding required • Nominal-valued variables D-bit with 2D discrete nominal values e.g., four colors: red (00), blue (01), green (10), yellow (11) • Continuous-valued variables EIE426-AICV
Other Representations • Gray coding of integers (still binary chromosomes) Gray coding is a mapping that means that small changes in the genotype cause small changes in the phenotype (unlike binary coding, e.g., 0111(7) and 1000 (8)). It is generally accepted that it is better to encode numerical variables directly as • Integers • Floating point variables EIE426-AICV
Stopping Criteria • The maximum number of generation is exceeded • An acceptable best fit individual has evolved • The average and/or maximum fitness value do not change significantly over the past g generations. EIE426-AICV
Initial Population • The standard way of generating the initial population is to choose gene values randomly from the allowed set of values. • The goal of random selection is to ensure that the initial population is a uniform representation of the entire search space. • A large population covers a larger area of the search space, and may require less generations to converge. • In the case of a small population, the EA can be forced to explore a large search space by increasing the rate of mutation. EIE426-AICV
Selection Mechanisms Selection operators • Random selection • Proportional selection: roulette wheel selection • Tournament selection • Rank-based selection EIE426-AICV
Random Selection • Individuals are selected randomly with no reference to fitness at all. All the individuals, good or bad, have an equal chance of being selected. EIE426-AICV
Proportional Selection: Roulette Wheel Selection EIE426-AICV
Roulette Wheel Selection It can be visualized as the spinning of the wheel and testing which slide ends up at the top. Fitness values are usually normalized to [0,1]. EIE426-AICV
Assume that the following random number sequence is generated: 0.070 221 0.545 929 0.784 567 0.446 930 0.507 893 0.291 198 0.176 340 0.272 901 0.371 435 0.854 641 • Compared the random number sequence with the accumulated probabilities, we select the individuals: 1, 8, 9, 6, 7, 5, 8, 4, 6, 10. Individuals 2 and 3 were removed and replaced with individuals 8 and 6. The individuals with high fitness tends to survive but those with low fitness may be removed. EIE426-AICV
The pseudocode: EIE426-AICV
Tournament Selection • A group of k individuals is randomly selected. • The individual with the best fitness is selected from the group. • The advantage: the worse individuals of the population will not be selected and the best individuals will not dominate in the reproduction process. • For crossover, two tournaments are held to select each of two parents. It is possible that (1) A parent can be selected to reproduce more than once; and (2) One individual can combine with itself to reproduce offspring. EIE426-AICV
Rank-Based Selection • The rank ordering of the fitness values is used to determine the probability of selection and not the fitness values itself. • Non-deterministic linear sampling Individuals are sorted in decreasing fitness value. (1) Let n = random(random(N)) where N is the total number of individuals and random(N) return a number between 1 and N. (2) Return n as the selected individual EIE426-AICV
Elitism • Elitism involves the selection of a set of individuals from the current generation to survive to the next generation. • The number of individuals to survive to the next generation, without being mutated, is referred to as the generation gap. • Generation gap = k k best individuals or k individuals selected using any selection operator EIE426-AICV
Crossover Crossover EIE426-AICV
Uniform Crossover A mask (vector) of length I (I-bit binary string) is created at random for each pair of individuals selected for reproduction. A bit with value of 1 indicates that the corresponding allele (bit) has to be swapped. EIE426-AICV
Parent1 Parent 2 Mask Offspring 1 Offspring 2 EIE426-AICV
One-point Crossover EIE426-AICV
Parent1 Parent 2 Mask Offspring 1 Offspring 2 EIE426-AICV
Two-point Crossover EIE426-AICV
Parent1 Parent 2 Mask Offspring 1 Offspring 2 EIE426-AICV
Arithmetic Crossover Arithmetic crossover can be used in the case of continuous-valued genes. EIE426-AICV
Mutation • Alter each gene independently with a probability pm (the mutation rate) • Real-valued representations, mutation occurs by adding a random value (usually sampled from a Gaussian distribution ) to allele. The variance is usually a function of the fitness of the individual. Individuals with a good fitness value will be mutated less, while a bad fitness value will lead to large mutations. EIE426-AICV
0 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 Mutation (fox) EIE426-AICV
Increasing diversity by using genetic operators mutation crossover Decreasing diversity by selection of parents things to kill The Evolution Mechanism EIE426-AICV