Genetic Algorithms: Optimization Techniques
Genetic Algorithms: Optimization Techniques
Genetic Algorithms
Introduction to Optimization
Optimization is the process of making something better. An engineer or scientist conjures up a new idea and optimization improves on that idea. Optimization consists in trying variations on an initial concept and using the information gained to improve on the idea.
The terminology best solution implies that there is more than one solution and the solutions are not of equal value.
The definition of best is relative to the problem at hand, its method of solution, and the tolerances allowed. Thus the optimal solution depends on the person formulating the problem.
Some problems have exact answers or roots, and best has a specific definition. Examples include best home run hitter in baseball and a solution to a linear first-order differential equation. Other problems have various minimum or maximum solutions known as optimal points or extrema, and best may be a relative definition. Examples include best piece of artwork or best musical composition.
What Is Optimization?
Our lives confront us with many opportunities for optimization. What time do we get up in the morning so that we maximize the amount of sleep yet still make it to work on time? What is the best route to work? Which project do we tackle first? When designing something, we shorten the length of this or reduce the weight of that, as we want to minimize the cost or maximize the appeal of a product.
What Is Optimization?
Optimization is the process of adjusting the inputs to or characteristics of a device, mathematical process, or experiment to find the minimum or maximum output or result. The input consists of variables; the process or function is known as the cost function, objective function, or fitness function; and the output is the cost or fitness.
Optimization Techniques
Mathematical Programming Network Analysis Branch & Bound Genetic Algorithm Simulated Annealing Tabu Search
THE GENETIC ALGORITHM The genetic algorithm (GA) is an optimization and search technique based on the principles of genetics and natural selection. A GA allows a population composed of many individuals to evolve under specified selection rules to a state that maximizes the fitness (i.e., minimizes the cost function). The method was developed by John Holland (1975) over the course of the 1960s and 1970s and finally popularized by one of his students, David Goldberg, who was able to solve a difficult problem involving the control of gas-pipeline transmission for his dissertation (Goldberg, 1989).
GENETIC ALGORITHMS: NATURAL SELECTION ON A COMPUTER Figure shows the analogy between biological evolution and a binary GA. Both start with an initial population of random members. Each row of binary numbers represents selected characteristics of one of the dogs in the population. Traits associated with loud barking are encoded in the binary sequence associated with these dogs. If we are trying to breed the dog with the loudest bark, then only a few of the loudest, (in this case, four loudest) barking dogs are kept for breeding. There must be some way of determining the loudest barkersthe dogs may audition while the volume of their bark is measured. Dogs with loud barks receive high fitness or low costs.
GENETIC ALGORITHMS: NATURAL SELECTION ON A COMPUTER From this breeding population of loud barkers, two are randomly selected to create two new puppies. The puppies have a high probability of being loud barkers because both their parents have genes that make them loud barkers. The new binary sequences of the puppies contain portions of the binary sequences of both parents. These new puppies replace two discarded dogs that didnt bark loud enough. Enough puppies are generated to bring the population back to its original size. Iterating on this process leads to a dog with a very loud bark. This natural optimization process can be applied to inanimate objects as well.
Genetic Algorithm
Inspired by natural evolution Population of individuals
Based on their fitness, parents are selected to reproduce offspring for a new generation
Fitter individuals have more chance to reproduce New generation has same size as old generation; old generation dies
Offspring has combination of properties of two parents If well designed, population will converge to optimal solution
Algorithm
BEGIN Generate initial population; Compute fitness of each individual; REPEAT /* New generation /* FOR population_size / 2 DO Select two parents from old generation; /* biased to the fitter ones */ Recombine parents for two offspring; Compute fitness of offspring; Insert offspring in new generation END FOR UNTIL population has converged END
Biological Background
An individual is characterized by a set of parameters: Genes The genes are joined into a string: Chromosome
For a particular individual, genotype is used to describe the set of its genes. phenotype describes the physical aspect of an individual.
Selection is based on the Fitness, which is measured in the real world of the phenotype. Reproduction recombines genotypes.
Basic principles
Coding or Representation
Convergence
When to stop
Basic principles
Reproduction mechanisms have knowledge of the problem to be solved no
Coding
Many ways of representing individual genes. Holland(1975) worked mainly with string bits but we can use arrays, trees, lists or any other object. genes are concatenated to form a string (chromosome). All kind of alphabets can be used for a chromosome (numbers, characters), but generally a binary alphabet is used Order of genes on chromosome can be important Generally many different codings for the parameters of a solution are possible Good coding is probably the most important factor for the performance of a GA
Coding
Binary-coded strings having 1s and 0s are mostly used. The length of the string is usually determined according to the desired solution accuracy. BINARY ENCODING A four-bit string can represent the integers from 0 to 15 (16 elements) Lower limit, Xi(L) = 0000 Upper limit, Xi(U) = 1111 Every variable will have upper and lower limits as Xi(L) Xi Xi(U)
Coding
Example: Chromosome A 101101100011 Chromosome B 010011001100 OCTAL ENCODING (0 to 7) Lower limit, Xi(L) = 0000 Upper limit, Xi(U) = 7777 HEXADECIMAL ENCODING(0123456789ABCDEF) Lower limit, Xi(L) = 0000 Upper limit, Xi(U) = FFFF
Coding
PERMUTATION ENCODING Every chromosome is the string of numbers. Example Chromosome-A 1 5 3 2 4 7 9 8 6 Chromosome-B 8 5 6 7 2 3 1 4 9
VALUE ENCODING Every chromosome is a string of some values Values can be anything connected to the problem Example Chromosome-A 1.234 5.3243 0.4556 2.0253 Chromosome-B (back), (right), (Forward), (Left)
Fitness Function
Purpose Parent selection Measure for convergence For Steady state: Selection of individuals to die Should reflect the value of the chromosome in some real way Next to coding the most critical part of a GA
Fitness too large Relatively superfit individuals dominate population Population converges to a local maximum Too much exploitation; too few exploration Fitness too small No selection pressure After many generations, average fitness has converged, but no global maximum is found; not sufficient difference between best and average fitness Too few exploitation; too much exploration
Slow finishing
Reproduction First operator applied on the population. Also known as Selection Operator
Parent/Survivor Selection
According to Darwins evolution theory of survival of the fittest The best ones should survive and create new offspring.
Survivor selection
Always keep the best one Elitist: deletion of the K worst
Parent selection
Various methods of selecting chromosomes for parents to cross over are: Roulette wheel Selection Boltzmann Selection Tournament Selection Rank Selection Steady-state Selection
Roulette wheel
Sum the fitness of all chromosomes, call it T Generate a random number N between 1 and T Return chromosome whose fitness added to the running total is equal to or larger than N Chance to be selected is exactly proportional to fitness Chromosome: 1 Fitness: 8 Running total: 8 N (1 N 49): Selected: 2 2 10 3 17 27 23 3 4 7 34 5 4 38 6 11 49
Roulette wheel
Po Population pul ati on No. 1 2 3 0000 0000 0010 0001 0001 0101 Probabilit Cumulati y (Pi) ve Probabilit y 0.0429 0.090 0.1336 0.0429 0.1329 0.266 Random no. between 0-1 0.259 0.038 0.486 String No. The count in the mating pool 1 1 1
3 1 5
4 5
6 7 8
0.1723 0.200
0.082 0.0829 0.1955
0.438 0.638
0.720 0.809 1.0
0.428 0.095
0.3 0.616 0.897
4 2
4 5 8
2 2
0 0 1
Reproduction
Crossover
Two parents produce two offspring There is a chance that the chromosomes of the two parents are copied unmodified as offspring There is a chance that the chromosomes of the two parents are randomly recombined (crossover) to form offspring Generally the chance of crossover is between 0.6 and 1.0 There is a chance that a gene of a child is changed randomly Generally the chance of mutation is low (e.g. 0.001)
Mutation
Reproduction Operators
Crossover
One-point crossover 1
Randomly one position in the chromosomes is chosen Child 1 is head of chromosome of parent 1 with tail of chromosome of parent 2 Child 2 is head of 2 with tail of 1
Randomly chosen position
Parents:
1010001110
0011010010
Offspring: 1010010010
0011001110
Cross point
Two-point crossover
Randomly two positions in the chromosomes are chosen Avoids that genes at the head and genes at the tail of a chromosome are always split when recombined
Randomly chosen positions
Parents:
1010001110
0011010010
Offspring: 0101010010
0011001110
Uniform crossover
A random mask is generated The mask determines which bits are copied from one parent and which from the other parent Bit density in mask determines how much material is taken from the other parent (takeover parameter) Mask: 0110011000 (Randomly generated) Parents: 1010001110 0011010010
Offspring: 0011001010
1010010110
Reproduction Operators
Uniform crossover
E.g. in TSP with simple binary or path coding, most offspring will be illegal because not all cities will be in the offspring and some cities will be there more than once
Reproduction Operators
Mutation