Evolutionary Computation. Lecture 1 January, 2007 Ivan Garibay

Size: px
Start display at page:

Download "Evolutionary Computation. Lecture 1 January, 2007 Ivan Garibay"

Transcription

1 Evolutionary Computation Lecture 1 January, 2007 Ivan Garibay igaribay@cs.ucf.edu

2 Lecture 1 What is Evolutionary Computation? Evolution, Genetics, DNA Historical Perspective Genetic Algorithm Components Individuals, Populations Fitness Selection Genetic Operators Example 2

3 Introduction Motivation: learn 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 3

4 Evolution Charles Darwin (1859): On the origin of species by means of natural selection Reproduction does not produce a perfect copy, always minor variations (mutations) Some variations are advantageous some are not Individuals with advantageous variations are more likely to survive and reproduce (natural selection, or the survival of the fittest) The variations and inheritable Species are continuously adapting to their environment 4

5 Genetics Science of heredity Gregor Mendel (1865): units of inheritance: Genes ( traits ) Organisms form by cells Each cell has information necessary to construct a new organism = genome Genome = set of chromosomes Chromosome = set of genes Genes are DNA segments associated with a characteristic (i.e. eye color) Allele is a particular gene value (blue, black, etc) 5

6 Rethinking Evolutionary Computation DNA: Information DNA molecule is an information structure: Store information digitally (chain of nucleotides) Nucleotide = deoxyribose sugar + phosphate + Nitrogenous base Nitrogenous bases: Adenine, Thymine, Cytosine, Guanine DNA is an amazingly efficient, highly specialized structure for information storage, replication, expression and evolution 6

7 Historical perspective Evolutionary Computation Evolutionary Strategies Rechenberg, 1965 Population of two Only mutation Real value parameter optimization Evolutionary Programming Fogel, Owens, and Walsh, 1966 Only mutation Evolving Finite State Machines Genetic Algorithms Holland, 1975 Population based Crossover and mutation Study adaptation Schema Theorem 7

8 GA terminology: from biology Chromosome (string) Population individual gene Fitness based Selection Crossover Mutation Genetic Operators Generation i Generation i+1 8

9 Simple Genetic Algorithm procedure GA begin initialize population; while termination condition not satisfied do begin evaluate current population members; select parents from current population; apply genetic operators to selected parents; set offspring equal to current population; end end 9

10 Genetic Algorithm Components Population of individuals Fitness Function Selection Function Genetic Operators 10

11 Individuals allele gene Each individual represent a candidate solution String of 1 s and 0 (binary representation) Could take any other form (tree, integers, etc) Needs to be decoded to have meaning: Genotype to Phenotype 11

12 Rethinking Evolutionary Computation Problem Representation Genotype to Phenotype Genome (DNA) Computational Evolutionary Structure Bit String Logo instructions Organisms Instance of Problem Solution Ordering of cities for TSP Antena Problem specific Different representations are different problems for a GA Map a string (structure) into a instance of a solution Representation is very important Define the space to be explored Define the space structure: variations are meaningful 12

13 Binary Representation Example: encoding 4 parameters Param1 value = 1000 = 8 Param2 value = 1011 = 11 Etc., 13

14 Fitness function Problem specific component Function takes as input an individual (chromosome) Function return a numerical value that determines how good the individual is Natural Selection: fitness function = environment Genetic Algorithm: fitness function is user defined Typically higher is better 14

15 Selection Survival of the fittest Select the best individuals Based on fitness function Drives exploitation: exploit good genes found so far Multiple Types Proportional Rank Tournament (most used) 15

16 Fitness proportional Selection Holland, Expected number of times an individual is selected to reproduce is proportional to its fitness relative to the total population fitness. P s (i) = f(i) / f sum where f(i) is the fitness of individual i and f is the sum of fitness of all individuals in a pop. Actual number of offspring may be far from expected number 16

17 Rank Selection Similar to Proportional Proportional to their rank instead P s (i) = r(i) / r sum Rank selection is weaker than proportional in diverse populations Rank is stronger than proportional in converged populations 17

18 Tournament Selection 1. Select two individuals 2. Generate a random number, r, 0 r 1 3. If r < k, select the better of the 2 individuals else, select the worse of the 2 individuals where k is a parameter. Computationally efficient. Previous methods require 2 passes: Compute sum Calculate expected number of offspring. Rank selection also requires a sort. 18

19 Genetic Operators Crossover Biologically inspired Combine genes from two individuals to form an off-spring (sexual reproduction) Mutation Biologically inspired DNA is copied with errors = mutations Most of the time mutation = problem Some times = advantage 19

20 One-point Crossover Simplest form of crossover Advantage: Fairly large change in individuals with very little disruption of information Parent 1: Parent 2: Offspring 1 Offspring 2 Crossover point 20

21 Other Crossover Ops Two point: select two points and exchange middles Uniform: with probability px exchange or not each bit 21

22 Mutation Single parent operator Mutation rate (M) is per bit Mutation rate per individual = M * L (individual length) As a start: M = 1/L per bit Issues Low mutation rate: minimal exploration High mutation rate: too disruptive 22

23 Initialization Initial Populations are randomly generated Binary case are all randomly generated binary strings 23

24 GA Convergence 24

25 Termination Criteria Found solution Number of generations Stagnation no more fitness improvement 25

26 A GA by hand Onemax problem: Maximize the number of ones Population (0) (0) (1) (2) (3) (4) (5) Fitness [6] [2] [4] [3] [3] [2] 20/6 =

27 A GA by hand Onemax problem: Maximize the number of ones Population (0) (1) (2) (3) (4) (5) Fitness [6] [2] [4] [3] [3] [2] Selected parents (2) [4] (0) [6] (0) [6] (4) [3] (0) [6] (1) [2] 27

28 A GA by hand Onemax problem: Maximize the number of ones Selected parents X After crossover M (2) [4] (0) [6] (0) [6] (4) [3] (0) [6] (1) [2]

29 A GA by hand Onemax problem: Maximize the number of ones After crossover M After mutation Fitness [6] [4] [4] [4] [5] [5] 28/6 =

30 A GA by hand Onemax problem: Maximize the number of ones Population (0) Fitness Population (1) Fitness (0) (1) (2) (3) (4) (5) [6] [2] [4] [3] [3] [2] [6] [4] [4] [4] [5] [5] 20/6 = /6 =

31 Questions? 31