250 likes | 269 Views
Explore how genetic algorithms mimic nature's evolutionary processes to solve complex problems efficiently. Learn about DNA, mutations, fitness functions, and genetic operators. Dive into GA terminology and components.
E N D
An Introduction to Genetic Algorithms Lecture 2 November, 2010 Ivan Garibay igaribay@cs.ucf.edu
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 University of Central Florida, Department of EECS
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 are inheritable • Species are continuously adapting to their environment University of Central Florida, Department of EECS
Basic Evolutionary Process • Population • Birth and Dead • Fitness • Variational Inheritance University of Central Florida, Department of EECS
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) University of Central Florida, Department of EECS
DNA: Information • DNA molecule is an information structure: • Store information digitally (chain of nucleotides) • Nucleotide = deoxyribose sugar + phosphate + Nitrogenous base • 4 Nitrogenous bases: Adenine, Thymine, Cytosine, Guanine • DNA is an amazingly efficient, highly specialized structure for information storage, replication, expression and evolution University of Central Florida, Department of EECS
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 University of Central Florida, Department of EECS
GA terminology: from biology Chromosome (string) gene Population individual Fitness based Selection Crossover Mutation Genetic Operators Generation i Generation i+1 University of Central Florida, Department of EECS
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 University of Central Florida, Department of EECS
Genetic Algorithm Components • Population of individuals (population) • Selection Function (birth and dead) • Fitness Function (fitness) • Genetic Operators (variational inheritance) University of Central Florida, Department of EECS
Individuals • Each individual represent a candidate solution • String of ‘1’s and ‘0’ (binary representation GAs) • In general, any information structure can be subject to evolution (integers, reals, trees, etc.) • Needs to be decoded to have meaning: Genotype to Phenotype gene allele 0 1 0 0 0 1 1 1 0 0 1 1 0 1 0 1 1 1 1 0 0 0 1 1 University of Central Florida, Department of EECS
Rethinking Evolutionary Computation Problem Representation • 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 Genotype to Phenotype Genome (DNA) Organisms Computational Instance of Evolutionary Problem Structure Solution Bit String Ordering of cities for TSP Logo instructions Antena University of Central Florida, Department of EECS
Binary Representation • Example: encoding 4 parameters • Param1 value = 1000 = 8 • Param2 value = 1011 = 11 • Etc., University of Central Florida, Department of EECS
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 University of Central Florida, Department of EECS
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) University of Central Florida, Department of EECS
Fitness proportional Selection • Holland, 1975. • Expected number of times an individual is selected to reproduce is proportional to its fitness relative to the total population fitness. • 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 Ps(i) = f(i) / fsum University of Central Florida, Department of EECS
Rank Selection • Similar to Proportional • Proportional to their rank instead • Rank selection is weaker than proportional in diverse populations • Rank is stronger than proportional in converged populations Ps(i) = r(i) / rsum University of Central Florida, Department of EECS
Tournament Selection Select two individuals Generate a random number, r, 0 ≤ r ≤ 1 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. University of Central Florida, Department of EECS
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 University of Central Florida, Department of EECS
Offspring 1 Parent 1: 11000110 01111100 11011100 01100110 Offspring 2 Parent 2: Crossover point One-point Crossover • Simplest form of crossover • Advantage: Fairly large change in individuals with very little disruption of information University of Central Florida, Department of EECS
Other Crossover Ops • Two point: select two points and exchange middles • Uniform: with probability px exchange or not each bit University of Central Florida, Department of EECS
11011000 11011100 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 University of Central Florida, Department of EECS
Initialization • Initial Populations are randomly generated • Binary case are all randomly generated binary strings University of Central Florida, Department of EECS
GA Convergence University of Central Florida, Department of EECS
Termination Criteria • Found solution • Number of generations • Stagnation – no more fitness improvement University of Central Florida, Department of EECS