- Slides: 33
General Introduction to GAs Ø Genetic algorithms (GAs) are a technique to solve problems which need optimization. Ø GAs are a subclass of Evolutionary Computing and are random search algorithms. Ø GAs are based on Darwin’s theory of evolution. i. e fundamental principle of natural selection(Which states “Survival of Fittest”). Ø History of GAs: • Evolutionary computing evolved in the 1960 s. • GAs were created by John Holland in the mid-1970 s.
Biological Background (1) – The Cell Ø Ø Every cell is a complex of many small “factories” working together. Ø The center of this all is the cell nucleus. Ø The nucleus contains the genetic information.
Biological Background (2) – Chromosomes Ø Genetic information is stored in the chromosomes. Ø Each chromosome is build of DNA(Deoxyribonucleic acid, a selfreplicating material present in nearly all living organisms as the main constituent of chromosomes). Ø Chromosomes in humans form pairs. Ø There are 23 pairs. Ø The chromosome is divided in parts: genes. Ø Genes code for properties. Ø The posibilities of the genes for one property is called: allele. Ø Every gene has an unique position on the chromosome: locus.
Biological Background (3) – Genetics Ø The entire combination of genes is called genotype. Ø A genotype develops into a phenotype. Ø Dominant genes will always express from the genotype to the fenotype. Ø Recessive genes can survive in the population for many generations without being expressed.
Biological Background (4) – Reproduction Ø Reproduction information: • Mitosis, • Meiosis. of genetical Ø Mitosis is copying the same genetic information to new offspring: there is no exchange of information. Ø Mitosis is the normal way of growing of multicell structures, like organs.
Biological Background (5) – Reproduction Ø Meiosis is the reproduction. basis of Ø After meiotic division 2 gametes appear in the process. Ø In reproduction two gametes conjugate to a zygote wich will become the new individual. Ø Hence genetic information is shared between the parents in order to create new offspring.
Biological Background (6) – Natural Selection Ø The origin of species: “Preservation of favorable rejection of unfavorable variations. ” variations and Ø There are more individuals born than can survive, so there is a continuous struggle for life. Ø Individuals with an advantage have a greater chance for survive: survival of the fittest. For example, Giraffes with long necks. Ø Genetic variations due to crossover and mutation.
Genetic Algorithm (1) – Search Space Ø Most often one is looking for the best solution in a specific subset of solutions. Ø This subset is called the search space (or state space). Ø Every point in the search space is a possible solution. Ø Therefore every point has a fitness value, depending on the problem definition. Ø GAs are used to search the search space for the best solution, e. g. a minimum. Ø Difficulties are the local minima and the starting point of the search.
Genetic Algorithm (2) – Basic Algorithm Ø Starting with a subset of n randomly chosen solutions from the search space (i. e. chromosomes). This is the population. Ø This population is used to produce a next generation of individuals by reproduction. Ø Individuals with a higher fitness have more chance to reproduce (i. e. natural selection).
Comparison of Natural and GA Terminology Natural Genetic Algorithm Chromosome Gene Allele Locus Genotype Phenotype String Feature or character Feature value String position Structure Parameter set, a decoded structure
Genetic Algorithm (3) – Basic Algorithm Outline of the basic algorithm 0 START : Create random population of n chromosomes 1 FITNESS : Evaluate fitness f(x) of each chromosome in population 2 NEW POPULATION 1 REPRODUCTION/SELECTION : Based on f(x) 2 CROSS OVER : Cross-over chromosomes 3 MUTATION : Mutate chromosomes 3 REPLACE : Replace old with new population: the new generation 4 TEST : Test problem criterium 5 LOOP : Continue step 1 – 4 untill criterium is satisfied the
• All individuals in population evaluated by fitness function. • Individuals allowed to reproduce (selection), crossover, mutate. Flowchart of GA
Genetic Algorithm – Reproduction Cycle 1. Select parents for the mating pool (size of mating pool = population size). 2. Shuffle the mating pool. 3. For each consecutive pair apply crossover. 4. For each offspring apply mutation (bit-flip independently for each bit). 5. Replace the whole population with the resulting offspring.
Genetic Algorithm – Encoding Ø Encoding is the process of representing individual genes. Ø The process can be performed using bits, numbers, trees, arrays. Ø Encoding depends on solving the problem. Types of Encoding: 1. Binary Encoding Ø The most common way of encoding is a binary string. Ø Each chromosome encodes a binary (bit) string. Ø Each bit in the string can represent some characterstics of the solution. Ø Every bit string is the solution but not necessarily the best solution.
Binary Encoding Chromosome 1 110100011010 Chromosome 2 01111100 2. Octal Encoding This encoding uses the string made up of octal numbers (0 -7). Chromosome 1 03467216 Chromosome 2 15723314 3. Hexadecimal Encoding This encoding uses the string made up of hexadecimal numbers(0 -9, A-F) Chromosome 1 9 CE 7 Chromosome 2 3 DBA
4. Permutation Encoding(Real Numer Encoding) Every chromosome is a string of numbers represented in a sequence. Chromosome A 153264798 Chromosome B 856723149 5. Value Encoding Every chromosome is a atring of values and the values can be anything connected to the problem. Chromosome A 1. 2324 5. 3243. 4556 2. 3293 Chromosome B ABDGIFEFLKJAHSLKJDHAS Chromosome C (back), (right), (forward)
Genetic Algorithm – Selection Ø Selection is the process of choosing two parents from the population for crossing. Ø After deciding on an encoding the next step is to decide how to perform selection that will create new offspring for the next generation. Ø The purpose of selection is to emphasize fitter individual in the population in hopes that their offspring have higher fitness. Ø Higher the fitness function the better chance that an individual will be selected. Ø Picks out individual based on their fitness Broadly two types of selection scheme: based on their rank relative to other within the population Ø Proportionate based selection. individuals Ø Ordinal based selection.
Genetic Algorithm – Selection Ø Selection has to be balanced with variation from crossover and mutation. ØToo strong selection means fit individuals will take over the population. ØToo weak selection will result in too slow evolution. ØThe various selection method are discussed: ØRoulette Wheel Selection. ØRandom selection-Randomly selects parent from population. ØRank Selection ØTournament Selection. ØBoltzman selection
Roulette Wheel Selection. Ø The principle of roulett wheel is a linear search through a roulett wheel with the slots in the wheel weighted in proportion to the individual fitness value. Ø A target value is set , the population is stepped through untill the target value is achieved. Ø The wheel spuns N times where n is the number of individual in the population. Ø On each spin the individual under the wheels marker is selected to be in the pool of parents for the next generation.
Rank Selection. ØRank selection ranks the population and every chromosome recieves fitness from the ranking. ØThe worst has fitness 1 and the best has fitness N. Tournament Selection. The best individual from the tournament is the one with the highest fitness , who is the winner of competition among Nu individuals. The are then inserted into the mating pool. The tournament is repeated untill the mating pool for generating new offspring is filled. The mating pool comprising tournament winner has higher average population fitness
Genetic Algorithm – Crossover (Single Point) Ø Crossover is the process of taking two parent solution and producing from them a child. Ø After the selection population is enriched with better individuals. Ø Crossover operator applied over mating pool with the hope that it creates better offspring. Ø It proceeds in three steps: Ø The reproduction operator selects at random a pair of two individual string. Ø A cross site is selected. Ø Finally position value are swapped between the two string following the cross site.
Genetic Algorithm – Crossover (Single Point) Ø In a single point crossover cross site is selected at random and bit next to cross sites are exchanged. Ø Choose a random point on the two parents. Ø Split parents at this crossover point. Ø Create children by exchanging tails. Parent 1 10110 010 Parent 2 10101 111 child 1 10110 111 Child 2 10101 010
Genetic Algorithm – Crossover (Two Point) Ø In two point crossover two cross over points are chosen and the content between these points are exchanged between two mated parents. Parent 1 10 110 010 Parent 2 10 101 111 child 1 10 101 111 Child 2 10 110 010
Genetic Algorithm – Uniform Crossover Ø A random generated binary crossover mask of the same length as the chromosome. Ø On producing child 1 Where there is 1 in mask the gene is copied from the first parent, and where there is 0 in mask the gene is copied from the second parent, and for producing child 2 when there is 1 in mask the gene is copied from parent 2 and when 0 gene is copied from parent 1. Parent 1 10110010 Parent 2 10101111 Mask 11010110 Child 1 1011 Child 2 10100110
Genetic Algorithm – Three Parent Crossover Ø In this crossover technique three parents are randomly chosen. Ø Each bit of the first parent is compared with the bit of the second parent. if both are same the bit is taken for the offspring otherwise bit from third parent is taken for the offspring. Parent 1 10110010 Parent 2 10101111 Parent 3 11010110 Child 1 10110110
Genetic Algorithm – Mutation Ø Mutation plays the role of recovering the lost genetic material as well as randomly distributing genetic information. Ø It is an insurance policy against the irreversible loss of genetic material. Ø Mutation introduces new genetic structure in the population by randomly modifying some of its(genetic) building block. 1. Flipping flipping of bit involves changing 0 to 1 and 1 to 0 based on mutation chromosome. For a 1 in mutation chromosome the corresponding bit in a parent chromosome is flipped (0 to 1 and 1 to 0) Parent 1 1 0 1 0 1 Mutation chromosome 1 0 0 0 1 Child 1 0 0 1 1 0 0
Genetic Algorithm –Interchanging Ø Two random position of bit are chosen and the bits corresponding to those position are interchanged. Parent 1 1 0 1 0 1 Child 1 1 1 0 0 1 Reversing : A random position is chosen and the bits next to that position are reversed and child chromosome is produced. Parent 1 1 0 0 1 1 Child 1 1 1 1 0 0
Simple Genetic Algorithm Ø Has been subject of many (early) studies • still often used as benchmark for novel Gas. Ø Shows many shortcomings, e. g. • • • Representation is too restrictive. Mutation & crossovers only applicable for bit-string & integer representations. Selection mechanism sensitive for converging populations with close fitness values.
Comparison of GA with Traditional Optimization Techniques Ø GA works with the coding of solution set and not with the solution itself. Ø GA uses population of solutions rather than a single solution for searching. Ø GA uses fitness function for evaluation rather the derivatives. Ø GA uses probabilistic transition and not deterministic rules.
References Ø Holland, J. (1992), Adaptation in natural and artificial systems , 2 nd Ed. Cambridge: MIT Press. Ø Davis, L. (Ed. ) (1991), Handbook of genetic algorithms. New York: Van Nostrand Reinhold. Ø Goldberg, D. (1989), Genetic algorithms in search, optimization and machine learning. Addison-Wesley. Ø Fogel, D. (1995), Evolutionary computation: Towards a new philosophy of machine intelligence. Piscataway: IEEE Press. Ø Bäck, T. , Hammel, U. , and Schwefel, H. (1997), ‘Evolutionary computation: Comments on the history and the current state’, IEEE Trans. On Evol. Comp. 1, (1)
Online Resources Ø http: //www. spectroscopynow. com Ø http: //www. cs. bris. ac. uk/~colin/evollect 1/evollect 0/index. htm Ø Illi. GAL (http: //www-illigal. ge. uiuc. edu/index. php 3) Ø GAlib (http: //lancet. mit. edu/ga/)