You are on page 1of 25
Chapter 2 an) 6; 4, FOUNDATIONS OF GENETIC fr Bot ALGORITHMS waa eae ae This chapter is devoted to the foundations of the genetic algorithms’ that will be used in the remainder of this book. Starting with several basic notions and definitions in genetic algorithms, fundamental pro- cedures of genetic algorithms are outlined. The main idea of genetic algorithms, involving coding, fitness, scaling. and genetic operators, is then examined. In the context of bit string representations, some of the important genetic operators are also discussed by putting special emphasis on implementation issues for genetic algorithms 2.1 Outline of genetic algorithms Genetic algorithms [75]. initiated by Holland, his colleagues. and his students at the University of Michigan in the 1970s as stochastic search techniques based on the mechanism of natural selection and natural genetics, have received a great deal of attention regarding their potential as optimization techniques for solving discrete optimization problems or other hard optimization problems. Although genetic algorithms were not well-known at the beginning, after the publication of Goldberg’s book (66], genetic algorithms attracted considerable attention in a number of fields as a methodology for optimization, adaptation, and learning (11, 13, 32, 39, 43, 60, 112, 127, 165, 189). J Genetic algorithms start with an initial population of individuals gen- erated at randotn. Each individual in the population represents a poten tial solution to the problem under consideration. The individuals evolve through successive iterations, called generations. During each genera- tion, each individual in the population is evaluated using some measure of fitness. Then the population of the next generation is created through genetic operators. The procedure continues until the termination con- 12 2. FOUNDATIONS OF GENETIC ALGORITHMS dition is satisfied. The general framework of genetic algorithms is de- scribed as follows [112], where P(t) denotes the population at generation t procedure: Genetic Algorithms begin t= 0; initialize P(t); evaluate P(t); while (not termination condition) do begin SPP ry select P(t) from P(t — 1); alter P(t): evaluate P(t}; end end. To explain the fundamental procedures of genetic algorithms, consider a population that consists of NV individuals representing potential solu- tions to a problem. In genetic algorithms, an individual in a population is represented by a string s of length n as follows: 8 = 5189°+°8 iy -tiB ne The string s is regarded as a chromosome that consists of n genes. The character s; is a gene at the jth locus, and the different values of a gene are called alleles. The chromosome s is called the genotype of an individual, a potential solution to a problem corresponding to a string 8 is called the phenotype. Usually, it is assumed to establish a one-to- ‘one correspondence between genotypes and phenotypes. The mapping from phenotypes to genotypes is called a coding, and the mapping from genotypes to phenotypes is called a decoding. The fitness is the link between genetic algorithms and the problem to be solved. In maximization problems, the fitness of a string a is usually kept the same as the objective function value f(z) of its phenotype 2. In minimization problems, the fitness of a string s should increase as the objective function value f(a) of its phenotype « decreases. Thus, in minimization problems, the string with a smaller objective function value has a higher fitness. Through three main genetic operators together with fitness, the population P(t) at generation ¢ evolves to form the next population P(t + 1). After some number of generations, the algorithnis 2. Outline of genetic algorithms 13 converge to the best string s*, which hopefully represents the optimal or approximate optimal solution «* to the optimization problem. In genetic algorithms, the three main genetic operators—reproduction, crossover, and mutation—are usually used to create the next generation. Reproduction: According to the fitness values, increase or decrease the number of offspring for each individual in the population P(2). Crossover: Select two distinct individuals from the population at ran- dom and exchange some portion of the strings between the strings with a probability equal to the crossover rate p,. Mutation: Alter one or more genes of a selected individual with a probability equal to the mutation rate Pn The probability to perform crossover operation is chosen in a way so that recombination of potential strings (highly fitted individuals) in- creases without disruption. Generally, the crossover rate lies betweeri 0.6 to 0.9. Since mutation occurs occasionally, it is clear that the prob- ability of performing mutation operation will be quite low. Typically. the mutation rate lies between 0.001 to 0.01. After the preceding discussions, the fundamental procedures of genetic algorithms can be summarized as follows: Fundamental procedures of genetic algorithms Step 0: (Initialization) Generate N individuals at random to form the initial population P(0). Set the generation index ¢ := 0 and determine the value of the maximal generation T. Step 1: (Evaluation) Calculate the fitness value of each individual in the population P(t). Step 2: (Reproduction) Apply the reproduction operator to the population P(t). Step 3: (Crossover) Apply the crossover operator to the population after reproduction. Step 4: (Mutation) Apply the mutation operator to the population after crossover to create the new population P(t + 1) of the next generation t +1. Step 5: (Termination test) 14 2. FOUNDATIONS OF GENETIC ALGORITHMS Ift = T, stop. Then an individual with the maximal fitness obtained thus far is regarded as an approximate optimal solution. Otherwise, set t:= t+ 1 and return to step 1. Such fundamental procedures of genetic algorithms are shown as a flowchart in Figure 2.1 Initial population Reproduction Y Crossover’ Mutation Termination test Stop Figure 2.1. Flowchart of fundamental procedures of genetic algorithms Figure 2.2 illustrates the fundamental structure of genetic algorithms. Here, potential solutions of phenotype are coded into individuals of geno- type to form an initial population. Each individual in the population is evaluated using its fitness. Through reproduction, crossover, and muta- tion, the population of the next generation is created. The procedure continues in this fashion, and when the termination condition is satisfied, the best individual obtained is regarded as an optimal or approximate optimal solution to the problem. In applying genetic algorithms to solve particular optimization prob- lems, further detailed considerations concerning (1) a genetic represen- tation for potential solutions, (2) a way to create an initial population, (3) an evaluation process in terms of their fitness, (4) genetic operators, (5) constraint-handling techniques, and (6) values for various parameters in genetic algorithms, such as population size, probabilities of applying genetic operators, termination conditions, and so on, are required. As Goldberg [66] summarized, genetic algorithms differ from conven- tional optimization and search procedures in the follow 2.2, Coding, fitness, and genetic operators 15 Problem Space (Phenotype) ® ly ox... Decoding / e Decoding GA Space (Genotype) ~ Evaluation Mutation is Crssoye ee ne; Figure 22. Fundamental structure of genetic algorithms (1) Genetic algorithms work with a coding of the solution set, not the solutions themselves (2) Genetic algorithms search from a population of solutions, not sin- gle solution. (3) Genetic algorithms use fitness information, not derivatives or other auxiliary knowledge. (4) Genetic algorithms use probabilistic transformation rules, not de- terministic ones. 2.2 Coding, fitness, and genetic operators 2.2.1 Coding To explain how genetic algorithms work for an optimization problem, consider a population that consists of N individuals representing poten- 16 2. FOUNDATIONS OF GENETIC ALGORITHMS tial solutions to the problem. In genetic algorithms, an n-dimensional vector « of decision variables corresponding to an individual is repre- sented by a string s of length n as follows: ore S182" “8a: (2.1) ‘The string s is regarded as a chromosome that consists of n genes. ‘The character s, is a gene at the jth locus, and the different values ofa gene are called alleles. The chromosome s is called the genotype of an individual; the x corresponding to s is called the phenotype. Usually, it is assumed that it establishes a one-to-one correspondence between genotypes and phenotypes. However, depending on the situation, m- to-one and one-to-m correspondences are also useful. In either case, the mapping from phenotypes to genotypes is called a coding, and the mapping from genotypes to phenotypes is called a decoding. The length of a chromosome is fixed at a certain value m in many cases, but a chromosome of variable length is more convenient in some cas Although real numbers, integers, alphabets. or some symbols may be used to represent strings, in all of the work of Holland [75]. individuals are represented in binary strings of 0s and 1s. Such binary {0,1} strings are often called bit strings or binary strings, and an individual s is represented as 82) -2sBija> s-dting NE ADL (2.2) Such bit strings have been shown to be capable of usefully coding a wide variety of information, and they have been shown to be effective representation mechanisms in unexpected areas. The properties of bit string representations for genetic algorithms have been extensively stud- jed, and a good deal is known about the genetic operators and parameter values that work well with them. 2.2.2 Fitness and scaling Nature obeys the principle of Darwinian “survival of the fittest,” the individuals with high fitness values will, on average, reproduce more of- ten than will those with low fitness values. In genetic algorithms, fitness is defined in such a way that highly fitted strings have high fitness values, and it is used to evaluate every individual in a population. Observe that the fitness is the only link between genetic algorithms and the problem to be solved, and it is the measure to select an individual to reproduce for the next generation. 2.2. Coding, fitness, and genetic operators 17 As discussed in Goldberg [66], in minimization problems such as the minimization of some cost function 2(x), by introducing Cinax satisfying Cmax — 2(x) > 0, it is desirable to define the fitness of a string s as (8) = Cmax—2(x). However, the value of Cmax is not known in advance; Cmax may be taken as the largest 2(a) value observed thus far, as the largest 2(a) value in the current population, or as the largest z(z) value of the ¢ generations. Consequently, in minimization problems the fitness of a string s is defined as sey~{ Gae-#h 3) S0 mag Similarly, in maximization problems such as the maximization of some profit or utility function u(x), if u(@) <0 for some @, by introducing Crin Satisfying u(a) + Cmin > 0, the fitness functions should be defined as f(s) = u(a) + Cin. However, the value of Cmin is not known in advance; Cjnin may be taken as the absolute value of the smallest u(2) value observed thus far, in the current population, or the t generations. Hence, in maximization problems the fitness of a string s is defined as ee { u(x) + Cin, if ule) + Cmin > 0 (oa) 0, otherwise In a reproduction operator based on the ratio of fitness of each indi- vidual to the total fitness such as roulette or expected value selection, which will be discussed in the next subsection, it is frequently pointed out that the probability of selection depends on the relative ratio of fit- ness of each individual. Thus, several scaling mechanisms, such as linear scaling, sigma truncation, and power law scaling, have been introduced. as well summarized in Goldberg [66] and Michalewicz (112). In the linear scaling, fitness f; of an individual i is transformed into ff according to fi=a-fitb, (2.5) where the coefficients a and b are determined so that the mean fitness Smean Of the population should be a fixed point and the maximal fitness fmax of the population should be equal to Cutt * fmean- The constant Coutts usually set as 1.2 < mate $ 2.0, means the expected value of the number of the best individual in the current generation surviving in the next generation. Figure 2.3 illustrates the linear scaling. Unfortunately, however, in the linear scaling rule (2.5), when a few strings are far below the mean and maximal fitness, there is a possibility 18 = FOUNDATIONS OF GENETIC ALGORITHMS EF Sots f fiefs fa Figure 2.3. Linear scaling that the low fitness values become negative after scaling, as shown in Figure 2.4 Figure 2.4. Linear scaling with nogative fitness values In order that ff will be nonnegative for all i, Goldberg (66] proposed the following algorithm for linear scaling. 2.2. Coding, fitness, and genetic haa pa MAHESH 19 Algorithm for linear scaling eee Step 1NiCalculate themesmatnen (a EE. . i the minimal fitness fmin of the population. Step 2: If firin > ST idee W Hep 3:'Otterlise gd to step 4 wait = LA (Conte = 1.0) - fcen ieee fect fis max ~ Fmean 7 Step 3: Set a and go to step 5. Step 4: Set a “., and go to step 5. Step 5: Calculate f! =a- fi +6 fori =1,2,...,N. To deal with the negative fitness values as well as to incorporate the problem-dependent information into the mapping, sigma scaling, also called sigma truncation, is introduced. Goldberg [66] called it sigma (0) truncation because of the use of population standard deviation informa- tion; a constant is subtracted from row fitness values as follows: Si = fe= (Smean — 670), (2.6) where the constant c is chosen as a reasonable multiple of the population standard deviation (between 1 and 3) and negative fitness values are set to 0. Power law scaling is defined as the following specified power of the low fitness: f= (hs, (2.7) where k is constant. In limited studies, a value of k = 1.005 is suggested. Unfortunately, however, in general the k value is problem dependent. 2.2.3 Genetic operators 2.2.3.1 Reproduction In genetic algorithms, the idea of natural selection—that highly fitted individuals will reproduce more often at the cost of lower fitted ones— is called reproduction or selection. Reproduction or selection concerns how to select the individuals in the population who will create offspring for the next generation and how many offspring each will create. There are many methods for implementing this, and one commonly used method is roulette selection, originally proposed by Holland [75]. The basic idea is to determine selection probability for each individual proportional to 2.2. Coding, fitness, and genetic haa pa MAHESH 19 Algorithm for linear scaling eee Step 1NiCalculate themesmatnen (a EE. . i the minimal fitness fmin of the population. Step 2: If firin > ST idee W Hep 3:'Otterlise gd to step 4 wait = LA (Conte = 1.0) - fcen ieee fect fis max ~ Fmean 7 Step 3: Set a and go to step 5. Step 4: Set a “., and go to step 5. Step 5: Calculate f! =a- fi +6 fori =1,2,...,N. To deal with the negative fitness values as well as to incorporate the problem-dependent information into the mapping, sigma scaling, also called sigma truncation, is introduced. Goldberg [66] called it sigma (0) truncation because of the use of population standard deviation informa- tion; a constant is subtracted from row fitness values as follows: Si = fe= (Smean — 670), (2.6) where the constant c is chosen as a reasonable multiple of the population standard deviation (between 1 and 3) and negative fitness values are set to 0. Power law scaling is defined as the following specified power of the low fitness: f= (hs, (2.7) where k is constant. In limited studies, a value of k = 1.005 is suggested. Unfortunately, however, in general the k value is problem dependent. 2.2.3 Genetic operators 2.2.3.1 Reproduction In genetic algorithms, the idea of natural selection—that highly fitted individuals will reproduce more often at the cost of lower fitted ones— is called reproduction or selection. Reproduction or selection concerns how to select the individuals in the population who will create offspring for the next generation and how many offspring each will create. There are many methods for implementing this, and one commonly used method is roulette selection, originally proposed by Holland [75]. The basic idea is to determine selection probability for each individual proportional to 20 2. FOUNDATIONS OF GENETIC ALGORITHMS the fitness value. Namely, in roulette selection, calculating the fitness Si (2 0), i= 1,...,.N of each individual i and the whole sum DN, f;, the selection probability, or survival probability of each individual i is determined as fi Pi (2.8) W oe a Figure 2.5 illustrates the roulette selection. Observe that each indi- vidual is assigned a slice of a circular roulette wheel, the size of the slice being proportional to the individual’s fitness, Then, conceptually, the wheel is spun N times, where N is the number of individuals in the population. On each spin, an individual marked by the roulette wheel pointer is selected as a parent for the next generation. ap 7 Figure 2.5. Roulette selection The algorithm of the roulette selection is summarized as follows. Algorithm of roulette selection Step 1: Calculate the fitness f;, i = 1,...,N, of N individuals and their whole sum feum = 0%, fi in a population at generation t. Step 2: Generate a real random number rand() in (0,1), and set s = rand() X feum- Step 3: Obtain the minimal & such that D*, f; > s, and select the kth individual at generation t + 1. Step 4: Repeat steps 2 and 3 until the number of selected individuals becomes N. In addition to roulette selection, various selection operators, such as expected-value selection, ranking selection, elitist preserving selection, and so forth, have been proposed. aS, 2.2 Coding, fitness, and genetic operators Guru, MAHES? 2 professor For reducing the stochastic errors of roulettesstéCGion De (46) first introduced expected-value selection. etduesselettion, the expected value of the number of offspringA@*€alculated for an in- dividual ¢ as f/f, where J is an average fitness value in the current population. In expected-value selection for a population consisting of N individu- als, the expected number of the ith individual is calculated by fi W De eat Then, the integer part of N; denotes the deterministic number of the ith individual preserved in the next population, The fractional part of Ny is regarded as a probability for one of the individual ¢ to survive, in other words, N — SN, |.Nij; individuals are determined on the basis of this probability, An example of reproduction by expected-value selection is shown in Table 2.1. Ni xN (2.9) Table 2.1. Reproduction by expected-value selection Fines iL RMONES Semmes ena BD expected value 06 OF 10 11 17 32 04 12 05 O2 number ofoffsprng[ 1 0 1 1 2 8 0 171 ~~0 Ranking selection means that only the rank order of the fitness of the individuals within the current population determines the probability of selection. In ranking selection, the population is sorted from the best to the worst, the expected value of each individual depends on its rank rather than on its absolute fitness, and the selection probability of each individual is assigned according to the ranking rather than its raw fitness. There is no need to scale fitness in ranking selection, because absolute differences in fitness are obscured. There are many methods to assign a selection probability to each individual on the basis of ranking, including linear and nonlinear ranking methods. In the linear ranking method proposed by Baker [18], each individual in the population is ranked in increasing order of fitness and the selection probability of each individual i in the population is determined by R= lr “Ga 7) (2.10) 22 2. FOUNDATIONS OF GENETIC ALGORITHMS where the constants 7* and 4 denote the maximum and minimum expected values, respectively, and determine the slope of the linear function. The condition D3, pi = 1 requires that 1 < nt < 2 and n7 =2=n* are fulfilled. Normally, a value of 7* = 1-1 is recommended. An example of reproduction by linear ranking selection with * and rounding is shown in Table 2.2. Table 2.2. Reproduction by linear ranking selection fitness 32, a6 64 2 rank 1 Be oicilanks Doe number of offspring | 2 aril 1 aie, Weg As one possible way to nonlinear ranking, Michalewicz [112] proposed the exponential ranking method. Adopting the exponential ranking method, the selection probability p; for the individual of rank 1 is deter- mined by pac. — cl, (2.11) where ¢ € (0,1) represents the probability when an individual of rank 1 is selected. Observe that a larger value of c implies stronger selective pressure. Elitist preserving selection, also called elitism, first introduced by De Jong [46], is an addition to many selection operators. In elitism, if the fitness of an individual in the past populations is larger than that of every individual in the current population, preserve this individual into the current generation. Introducing the elitism, the best individual gen- erated up to generation ¢ can be included in the population at generation 1+ 1, if this best individual is lost at generation t +1. Observe that elitism, when combined with the selection operators dis- cussed thus far, produces elitist roulette selection, elitist expected value selection, and elitist ranking selection. Concerning the comparison of important selection operators, the pa- pers of Back 10], and Goldberg and Deb [67] would be useful for inter- ested readers. 2.2.3.2 Crossover It is well-recognized that the main distinguishing feature of genetic algorithms is the use of crossover. Crossover, also called recombination, is an operator that creates new individuals from the current population. The main role of this operator is to combine pieces of information com- ing from different individuals in the population. Actually, it recombines 2.2. Coding, fitness, and genetic operators 23 genetic material of two parent individuals to create offspring for the next generation. ‘The basic crossover operation, introduced by Holland [75], is a three-step procedure. First, two individuals are selected at ran- dom from the population of parent strings generated by the selection. Second, one or more string locations are selected as crossover points de- lineating the string segment to exchange. Finally, parent string segments are exchanged and then combined to produce two resulting offspring in- dividuals. The proportion of parent strings undergoing crossover during a generation is controlled by the crossover rate p, € [0,1], which deter- mines how frequently the crossover operator is invoked. In addition to the crossover rate p, and the number of crossover points CP, generation gap G was introduced by De Jong [46] to permit over- lapping populations, where G = 1 and 0 < G < 1, respectively, imply nonoverlapping populations and overlapping populations. The general algorithm of crossover is summarized as follows: General algorithm of crossover Step 0: Let i:= 1. Step 1: Select an individual mating with the ith individual at randoin from the current population including V individuals. Step 2: Generate a real random number rand() in [0,1]. For a given crossover rate pe, if pe > rand(), then go to step 3. Otherwise, go to step 4. Step 3: Mate two individuals using an appropriate crossover technique, and go to step 5. Step 4: Preserve the two individuals that are not mated, and go to step 6. Step 5: Preserve the mated two individuals, and go to step 6 Step 6: If i < N, set step 7, + 1 and return to step 1. Otherwise, go to Step 7: Select NG individuals from 2N preserved individuals randomly, and replace NG individuals of the current population consisting of N individuals with the NG selected individuals. Depending on the ways of individual representations, many different crossover techniques have been proposed. When individuals are represented by binary {0,1} strings, also called bit strings, some of the commonly used crossover techniques are one- point crossover, multipoint crossover and uniform crossover. One-point 24 2. FOUNDATIONS OF GENETIC ALGORITHMS crossover, also called simple crossover, is the simplest crossover tech- nique. In one-point crossover, a single crossover point “|” is randomly selected on the two strings of two parents, then the substrings on the right side of the crossover point are exchanged for creating two offspring. An example of one-point crossover is illustrated as Parent Parent 110000001 __, Offspring 1: 110000100 101110100 Offspring 2: 101110001 In multipoint crossovers, an extension of one-point crossover, several crossover points “|” are randomly selected on the two strings of two parents, then the segments between the two parents are exchanged for creating two offspring. An example of two-point crossover is illustrated as Parent 1: 11|0000|001 my Offspring 1: 111110001 Parent 2: 10|1110|100 Offspring 2: 100000100 Two-point crossover is commonly used as multipoint crossover. Observe that the extreme case of multipoint crossover is known as uniform crossover [202]. In uniform crossover, a randomly selected n bits mask is used. The parity of each bit in the mask determines, for cach corresponding bit in a offspring, from which parent it will receive that bit. To be more explicit, for each bit position on the mask, its value “1” or “0,” respectively, indicates that the first parent or second parent contributes its value in that position to the first offspring, and vice versa for the second offspring. An example of uniform crossover is illustrated as 110000001 101110100 101101101 Offspring 1: 100010001 Offspring 2: 111000100 It should be noted here that in the general algorithm of crossover, appropriate values for the crossover rate p,, number of crossover points CP, and generation gap G must be set. Also, for replacing NG indi- viduals of the current population consisting of N individuals with the NG-selected individuals from 2N preserved individuals, 2N memory storage is required. As one possible way to circumvent such problems, Sakawa et al. [138, 148] proposed the following simplified algorithm of crossover, which approximately satisfies p. < 1,1 < CP

You might also like