Genetic Algorithms
- Elements:
- Population
- Fitness function
- Mutation operator
- Crossover operator
- Selection
- Population
- Each individual encodes a solution to the problem to be solved
- Individuals are typically fixed-length strings ("genomes" or "chromosomes")
- Bit strings: encode problems in binary
- Lists of integers or floating-point values
- Programming language instructions ("genetic programming"; not always fixed-length)
- The genotype is the encoding of a particular solution as a genome.
- The phenotype is the behavior exhibited when the genome is used to construct the solution.
- Fitness function
- Measures the quality of the phenotype relative to the problem domain
- Mutation operator
- When an individual is introduced into a new generation, it may mutate
- Mutation rate is the probability of an individual mutating
- Serves as a hill-climbing "subroutine" of the genetic search
- Bit-string encoding: flip a random bit
- Crossover operator
- Creation of two new individuals from two "parents"
- One-point crossover:
- A string index is selected at random
- Each parental genome is "split" at this point
- Two children are created by "splicing" the genomes
- Two-point crossover:
- Two string indices are selected at random
- The segments in-between these indices are swapped to create
the children
- Uniform crossover:
- For each index, there is a 50% chance of swapping the bits
- Selection
- Fitness-proportionate selection
- Fitness values are used to define a probability distribution
- Individuals are selected with probability proportionate to fitness
- Tournament selection
- Individuals "compete" for selection
- All tournament "winners" get selected
- Important issue:
- Some number of "weak" individuals should get selected
- Helps to maintain diversity in the gene pool
Steady-state Genetic Algorithm
- Generate initial population
- Each individual is randomly generated
- Provides a "statistical sample" of the search space
- Select two individuals for crossover
- Generate two children
- Mutate two children
- Replace the two lowest-fitness individuals in the population with the
children
- Repeat until the best individual has satisfactory fitness
Generational Genetic Algorithm
- Generate initial population (size P)
- Select N members of the population to be preserved in the next generation
- Use crossover to create P - N new individuals to replace the non-selected
- Mutate each individual
- Repeat until the best individual has satisfactory fitness