Genetic - Algorithm Book Chapter
Genetic - Algorithm Book Chapter
10
Fundamentals of
Genetic Algorithms
S Rajasekaran
Decision-making features occur in all fields of human activities such as scientific and
technological and affect every sphere of our life. Engineering design, which entails sizing,
dimensioning, and detailed element planning is also not exempt from its influence.
For example an aircraft wing can be made from aluminium or steel and once material and
shape are chosen, there are many methods of devising the required internal structure. In civil
engineering also, designing a roof to cover large area devoid of intermediate columns requires
optimal designing.
The aim is to make objective function a maximum or minimum, that is, it is required to find
an element X0 in A if it exists such that
F(X0) £ F(X) for minimization
F(X) £ F(X0) for maximization (10.1)
The following major questions arise in this process
· Does an optimal solution exist?
· Is it unique?
· What is the procedure?
· How sensitive the optimal solution is?
· How the solution behaves for small changes in parameters?
Since 1940, several optimization problems have not been tackled by classical procedures including:
1. Linear programming
2. Transportation
3. Assignment
4. Nonlinear programming
5. Dynamic programming
6. Inventory
7. Queuing
8. Replacement
9. Scheduling
277
278 Neural Networks, Fuzzy Systems, and Evolutionary Algorithms—Synthesis and Applications
The classification of optimization techniques is shown in Fig. 10.1. Basically, we have been
following traditional search technique for solving nonlinear equations. Figure 10.2 shows the
classes of both traditional and nontraditional search techniques. Normally, any engineering
problem will have a large number of solutions out of which some are feasible and some are
infeasible. The designer’s task is to get the best solution out of the feasible solutions. The
complete set of feasible solutions constitutes feasible design space and the progress towards the
optimal design involves some kind of search within the space (combinatorial optimization). The
search is of two kinds, namely deterministic and stochastic.
Optimization techniques
Deterministic Stochastic
Linear Non-linear
In the case of deterministic search, algorithm methods such as steepest gradient methods are
employed (using gradient concept), whereas in stochastic approach, random variables are
introduced. Whether the search is deterministic or stochastic, it is possible to improve the
reliability of the results where reliability means getting the result near optimum. A transition rule
must be used to improve the reliability. Algorithms vary according to the transition rule used to
improve the result.
Nontraditional search and optimization methods have become popular in engineering
optimization problems in recent past. These algorithms include:
1. Simulated annealing (Kirkpatrik, et al. 1983)
2. Ant colony optimization (Dorigo and Caro, 1999)
3. Random cost (Kost and Baumann, 1999)
4. Evolution strategy (Kost, 1995)
5. Genetic algorithms (Holland, 1975)
6. Cellular automata (Wolfram, 1994)
Fundamentals of Genetic Algorithms 279
Search technique
Fibanacci Newton
Evolutionary Genetic
strategies algorithm
Asparagos Distributed GA
(Goges Schleuter) (Tanese)
based on the mechanics of natural genetics and natural selection. Prof. Holland of University of
Michigan, Ann Arbor, envisaged the concept of these algorithms in the mid-sixties and published
his seminal work (Holland, 1975). Thereafter, a number of students and other researchers have
contributed to the development of this field.
To date, most of the GA studies are available through some books by Davis (1991),
Goldberg (1989), Holland (1975), Michalewicz (1992) and Deb (1995) and through a number of
conference proceedings. The first application towards structural engineering was carried by
Goldberg and Samtani (1986). They applied genetic algorithm to the optimization of a
ten-member plane truss. Jenkins (1991) applied genetic algorithm to a trussed beam structure.
Deb (1991) and Rajeev and Krishnamoorthy (1992) have also applied GA to structural
engineering problems. Apart from structural engineering there are many other fields in which GAs
have been applied successfully. It includes biology, computer science, image processing and
pattern recognition, physical science, social sciences and neural networks. In this chapter, we will
discuss the basic concepts, representatives of chromosomes, fitness functions, and genetic
inheritance operators with example. In Chapter 11, genetic modelling for real-life problems will be
discussed.
of DNA as shown in Fig. 10.3. Each gene encodes a particular pattern. Basically, it can be said
that each gene encodes a trait, e.g. colour of eyes. Possible settings of traits (bluish brown eyes)
are called alleles. Each gene has its own position in the chromosome search space. This position
is called locus. Complete set of genetic material is called genome and a particular set of genes in
genome is called genotype. The genotype is based on organism’s phenotype (development after
birth), its physical and mental characteristics such as eye colour, intelligence and so on.
A G
G
T C A
T A
A C
G T
C
Fig. 10.3 Genome consisting of chromosomes.
The problem is that, search space is complicated and one does not know where to look for
the solution or where to start from and this is where genetic algorithm is useful. GAs are inspired
by Darwinian theory of the survival of the fittest. Algorithm is started with a set of solutions
(represented by chromosomes) called populations. Solutions for one population are taken and
used to form a new population. This is motivated by a hope that new population will be better
than the old one. Solutions, which are selected to form new population (offspring), are selected
according to their fitness. The more suitable they are, the more chances they have to reproduce.
This is repeated until some conditions (number of populations) for improvement of best solution
are satisfied.
If we want to minimize f(X), for f(X) > 0, then we can write the objective function as
1
maximize (10.3)
1 f (X)
If f(X) < 0 instead of minimizing f(X), maximize {–f(X)}. Hence, both maximization and minimiza-
tion problems can be handled by GA.
If the same problem is solved by multiple regression analysis, given k independent
variables, for regressing the dependent variable 2(k + 1) - 1 including the intercept which are given
in Table 10.1.
Table 10.1 Subsets for regression analysis
Variable Subsets
2 7
3 15
- -
- -
9 1023
- -
19 10,48,578
10.5 ENCODING
There are many ways of representing individual genes. Holland (1975) worked mainly with string
bits but we can use arrays, trees, lists or any other object. Here, we consider only bit strings.
Fundamentals of Genetic Algorithms 283
Encoding
Each bit says if the thing is in knapsack or not. Binary coding is the most commonly used in GA
as shown in Table 10.2.
Chromosome A 101101100011
Chromosome B 010011001100
Binary encoding gives many possible chromosomes even with small number of alleles. On
the other hand, this encoding is often not natural for many problems and sometimes corrections
must be made after genetic operator corrections.
In order to use GA to solve the maximization or minimization problem, unknown variables
Xi are first coded in some string structures. It is important to mention that coding of the variable
is not absolutely necessary. There exist some studies where GAs are directly used on the variables
themselves, but here we shall ignore the exceptions and discuss the encoding for simple genetic
algorithm. Binary-coded strings having 1s and 0s are mostly used. The length of the string is
usually determined according to the desired solution accuracy. For example, 4-bit binary string
can be used to represent 16 numbers as shown in Table 10.3.
2 9 Remainder
2 41 Binary equivalent of 9 = 1001
2 20
10
Fig. 10.5 Binary coding.
1 0 0 1
1 ´ 20 = 1
0 ´ 21 = 0
0 ´ 22 = 0
1 ´ 23 = 8
9
Fig. 10.6 Equivalent integer for a binary code.
For example, if we want to code a two variable function assuming four bits are used for each
variable, we represent the two variables X1, X2 as (1011 0110). As given in Eq. (10.2), every
variable will have both upper and lower limits as
Ç 2k sk (10.5)
k 0
23 ´ 0 + 22 ´ 1 + 21 ´ 1 + 20 ´ 1 = 7
Knowing XiL and XiU corresponding to (0000) and (1111), the equivalent value for any
4-bit string can be obtained as
( XiU XiL )
Xi = XiL ´ (decoded value of string) (10.7)
(2 i 1)
n
Fundamentals of Genetic Algorithms 285
Assume for a variable Xi, XiL = 2, and X iU = 17, to find what value of 4-bit string of Xi = (1010)
would represent. First we get the decoded value for Si as
Si = 1010 = 23 ´ 1 + 22 ´ 0 + 21 ´ 1 + 20 ´ 0 = 10 (10.8a)
(17 2)
Xi = 2 10 = 12 (10.8b)
(24 1)
Hence, the accuracy that can be obtained with a four-bit code is 1/16th of search space. But
as the string length is increased by one, the obtained accuracy increases exponentially to 1/32th
of the search space. It is not necessary to code all variables in equal substring length. The length
of substring representing a variable depends on the desired accuracy in that variable. Generalizing
the concept, we may say that with ni bit-length coding for a variable, the obtainable accuracy in
that variable approximation is ( X iU XiL )/2 i . Once the coding of the variables is done, the
n
corresponding point (X1 ¼ Xn) T can be found out using Eq. (10.7). For continuous design
variable, if e is the precision representation required then string length ‘S’ should be equal to
È XU X L Ø
S = log 2 É Ù (10.9)
Ê F Ú
In some cases, Xi need not be equally distributed so as to apply the linear mapping rule.
Hence, Xi can be given in the form of a table as shown in Table 10.4.
Hence, when the values are not uniformly distributed, tabulated values can be used to find
the corresponding point X = (X1, X2,¼, Xn)T. Thereafter, the function value at that point X can also
be calculated by substituting X in the given objective function.
286 Neural Networks, Fuzzy Systems, and Evolutionary Algorithms—Synthesis and Applications
To convert any integer to an octal string, go on diving the integer by 8 as shown in Fig. 10.7. For
example, 542 is given in octal form as 1036.
8 542 Remainder
8 676
Octal equivalent of 542 = 1036
8 83
10
For the octal code, we can get the equivalent integer by decoding it as shown in Fig. 10.8.
The integer value for the octal code 1036 is 542.
1 0 3 6
6 ´ 80 = 6
3 ´ 81 = 24
0 ´ 82 = 0
1 ´ 83 = + 512
542
A four-bit octal string can represent the integers from 0 to 4095 and hence, (0000 0000) and
(7777 7777) would represent the points for X1 and X2 as ( X1L , X2L ); ( X1U, X2U ) respectively. The
decoded value of a binary substring Si is calculated as
Ç
k ni 1
8k s k (10.10)
k 0
and hence, the obtainable accuracy in that variable approximation is ( X iU X iL) /8ni .
16 6 7 8 9 7 Remainder
16 4 2 4 39
16 2 6 53 Hexadecimal code for 67897 is 10939.
16 1 69
10
B 0 7 9 E 6
6 ´ 160 = 6
14 ´ 161 = 24
9 ´ 162 = 2304
7 ´ 163 = 28672
0 ´ 164 = 0
11 ´ 165 = +11534336
11565542
A four-bit hexadecimal can represent the integers from 0 to 65535 and hence, (0000 0000) and
(FFFF FFFF) would represent the points for X1 and X2 as ( X1L , X2L ); ( X1U, X2U ) respectively. The
decoded value of a hexadecimal string Si is calculated as
Ç
k ni 1
16 ksk (10.11)
k 0
And hence, the obtainable accuracy in that variable approximation is ( X iU X iL) /16n . From the i
above discussion it is clear that encoding can be given to any base ‘b’, bits of ni length can
represent the integers from 0 to (bni - 1) and hence (0000 0000), and ((b - 1)(b - 1)(b - 1)(b - 1),
and (b - 1)(b - 1)(b - 1)(b - 1)) would represent the points X1 and X2 as ( X1L , X2L ); ( X1U, X2U )
respectively. The decoded value of ‘b’ bit-string Si is calculated as
k ni 1
Ç b ksk (10.12a)
k 0
( X iU XiL )/ b
ni
(10.12b)
Chromosome-A 1 5 3 2 4 7 9 8 6
Chromosome-B 8 5 6 7 2 3 1 4 9
Even for ordering problems after applying for sometimes, the genetic operators corrections must
be made to leave the chromosome consistent.
Encoding
Chromosome illustrates the order of cities in which the salesman would visit them.
In this, every chromosome is a string of some values and the values can be anything connected to
the problem. From numbers, real numbers characterize some complicated objects as shown in
Table 10.6.
Table 10.6 Value encoding
Value encoding is very good for some special problems. On the other hand, this encoding is
often necessary to develop new genetic operators specific to the problem.
Encoding
Each value in chromosome represents the corresponding weights.
This is mainly used for evolving program expressions for genetic programming. In a tree
encoding, every chromosome is a tree of some objects such as functions and commands, in a
programming language as shown in Fig. 10.11. Tree encoding is good for evolving programs in a
programming language. LISP is often used because programs in it are represented in this form and
can easily be parsed as a tree so that functions and genetic operators can be applied rather easily.
Fundamentals of Genetic Algorithms 289
Chromosome-A Chromosome-B
+ Do until
/ Stop Wall
x
Do until stop wall
y
5
+ x (/5y)
Problem: Some input and output values are given. The task is to find the function which will
give the best relation to satisfy all values.
Encoding
Chromosomes are functions represented in a tree.
As pointed out earlier GAs mimic the Darwinian theory of survival of the fittest and principle of
nature to make a search process. Therefore, GAs are usually suitable for solving maximization
problems. Minimization problems are usually transformed into maximization problems by some
suitable transformation. In general, fitness function F(X) is first derived from the objective
function and used in successive genetic operations.
Certain genetic operators require that fitness function be non-negative, although certain
operators do not have this requirement. Consider the following transformations
A number of such transformations are possible. The fitness function value of the string is known
as string’s fitness.
Example 10.1
Two uniform bars are connected by pins at A and B and supported at A. A horizontal force P acts
at C. Knowing the force, length of bars and its weight determine the equilibrium configuration of
the system if friction at all joints are neglected (see Fig. 10.12).
290 Neural Networks, Fuzzy Systems, and Evolutionary Algorithms—Synthesis and Applications
A
y
q1 P= 2
W1 = 2
l1
W2 = 2
x
l1 = 2
B
l2 = 2
W1
l2
q2
P
C
W2
Substituting the values for P, W1, W2, and for the lengths as 2 we get,
P(q1, q2) = –4sinq1 - 6cosq1 - 4sinq2 - 2cosq2 (10.15a)
0 £ q1, q2 £ 90 (10.15b)
Equilibrium configuration is the one which makes P a minimum.
Theoretical solution
d P = 0, for P to be maximum or minimum
3 3
dP = ER ER = 0 (10.16)
R1 1 R 2 2
d q1, dq2 are arbitrary. Therefore we get,
3
= 4cosq1 - 6sinq1 = 0 (10.17a)
R1
3
= 4cosq2 - 2sinq2 = 0 (10.17b)
R 2
From Eq. (10.17(a)) and (b) we get,
2
tanq1 = , q = 33.7° (0.558 radians)
3 1
tanq2 = 2, q2 = 63.43° (1.107 radians) (10.18)
For which P = -11.68
Fundamentals of Genetic Algorithms 291
Since there are two unknowns q1 and q2 in this problem, we will use 4-bit binary string for each
unknown.
XU X L 90
Accuracy = 6 (10.19)
2 1
4 15
Hence, the binary coding and the corresponding angles are given as
XiU X iL
Xi = XiL Si (10.20)
24 1
where Si is the decoded value of the ith chromosome. The binary coding and the corresponding
angles are given in Table 10.7.
The objective function of the problem is given in Eq. (10.15). The contours of the objective
function as well as the 3D plot are shown in Figs. 10.13(a) and (b) respectively.
q2
2.0
1.5
1.0
0.5
0
q1
0 0.5 1.0 1.5 2.0
Left out population from Minimum point (0.588, Population chosen for
initial population 1.107) mating pool
Fig. 10.13(a) Contours of equal objective functions.
292 Neural Networks, Fuzzy Systems, and Evolutionary Algorithms—Synthesis and Applications
–6
q2
–8
–10 1.5
0
1
0.5
0.5
1
1.5 0
q1
Since the objective function is negative, instead of minimizing the function ‘f ’ let us maximize
-f = f ¢. The maximum value of f = 8 when q1, q2 are zero. Hence, the fitness function F is given
as
F = f ¢ - 7 = -f - 7 (10.21)
First randomly generate eight populations with 8-bit strings as shown in Table 10.8.
Population Angles
No. Population q1 q2 F = -f - 7
1 0000 0000 0 0 1
2 0010 0001 12 6 2.1
3 0001 0101 6 30 3.11
4 0010 1000 12 48 4.01
5 0110 1010 36 60 4.66
6 1110 1000 84 48 1.91
7 1110 1101 84 78 1.93
8 0111 1100 42 72 4.55
As shown in Table 10.8 and Fig. 10.13(c), GA begins with a population of random strings
representing design or decision variables. Thereafter, each string is evaluated to find the fitness
value. The population is then operated by three main operators, namely reproduction, crossover,
and mutation, to create a new population of points. The new population is further evaluated and
Fundamentals of Genetic Algorithms 293
tested for termination. If the termination criteria are not met, the population is iteratively operated
by the three operators and evaluated until the termination criteria are met. One cycle of these
operations and the subsequent evaluation procedure is known as a generation in GA terminology.
Population F Population F
36°
1 4.60
60°
12°
84°
48°
2.10 1.91
6°
6°
84°
78°
3.11 1.93
30°
12°
42°
4.01 4.55
72°
48°
10.7 REPRODUCTION
Reproduction is usually the first operator applied on population. Chromosomes are selected from
the population to be parents to crossover and produce offspring. According to Darwin’s evolution
theory of survival of the fittest, the best ones should survive and create new offspring. That is why
reproduction operator is sometimes known as the selection operator. There exists a number of
reproduction operators in GA literature but the essential idea in all of them is that the above
average strings are picked from the current population and their multiple copies are inserted in the
mating pool in a probabilistic manner. The various methods of selecting chromosomes for parents
to crossover are:
1. Roulette-wheel selection
2. Boltzmann selection
3. Tournament selection
4. Rank selection
5. Steady-state selection
The commonly used reproduction operator is the proportionate reproductive operator where a
string is selected from the mating pool with a probability proportional to the fitness. Thus, ith
string in the population is selected with a probability proportional to Fi where Fi is the fitness
value for that string. Since the population size is usually kept fixed in a simple GA, the sum of
the probabilities of each string being selected for the mating pool must be one. The probability of
the ith selected string is
F
pi = n i (10.22)
ÂF j
j =1
where ‘n’ is the population size. For the example problem discussed in Example 10.1 the
probability values of each string are given in Table 10.9.
One way to implement this selection scheme is to imagine a Roulette-wheel with its
circumference for each string marked proportionate to string’s fitness (see Fig. 10.14). The fitness
of the population is calculated as Roulette-wheel is spun ‘n’ times (in this example eight times),
each time selecting an instance of the string chosen by the Roulette-wheel pointer. Since the
circumference of the wheel is marked according to a string’s fitness, the Roulette-wheel
mechanism is expected to make Fi / F copies of the ith string of the mating pool.
1
8 5%
20% 2
9%
7 3
8% 13%
6
8%
4
17%
5
20%
Fig. 10.14 Roulette-wheel marked for eight individuals according to fitness.
Ç
n
F = Fj / n (10.23)
j 1
Figure 10.14 shows a Roulette-wheel for eight individuals having different fitness values. Since
the fifth individual has a higher fitness than any other, it is expected that the Roulette-wheel
selection will choose the fifth individual more than any other individual.
This Roulette-wheel selection scheme can be simulated easily. Using the fitness value Fi of
all strings, the probability of selecting a string pi can be calculated. Thereafter, cumulative
probability Pi of each string being copied, can be calculated by adding the individual
probabilities from the top of the list. Thus, the bottom most string in the population should have
a cumulative probability of P8 = 1. The Roulette-wheel concept can be simulated by realizing that
the ith string in the population represents the cumulative probability from Pi - 1 to Pi. Thus, the
first string represents the cumulative values from 0 to P1.
Hence, cumulative probability of any string lies between 0–1. In order to choose n strings,
n random numbers between zero and one are created at random. Thus, the string that represents
the chosen random number in the cumulative probability range (calculated from fitness value) for
the string, is copied to the matting pool. This way, the string with a higher fitness value will
296 Neural Networks, Fuzzy Systems, and Evolutionary Algorithms—Synthesis and Applications
represent a larger range in the cumulative probability values and therefore, has a higher
probability of being copied into the mating pool. On the other hand, a string with a smaller
fitness value represents a smaller range in cumulative probability values and has a smaller
probability of being copied into the mating pool. Now, we illustrate the working of Roulette-
wheel simulation for an example.
Referring to Table 10.10, once probability of the individual strings are known we can find
the expected count of each string as
Expected count = (n = 8) ´ pi (10.24)
These values are calculated and shown in column A of Table 10.10. From the probability pi,
the cumulative probability can be computed. For example, P5 is given by
P5 = 0.0429 + 0.090 + 0.1336 + 0.1723 + 0.2 = 0.6388 (10.25)
These distributions are shown in column B of Table 10.10. In order to form the mating pool, we
create random numbers between zero and one (given in column C) and identify the particular
string which is specified by each of these random numbers. For example, if a random number of
0.428 is created, the fourth string gets a copy in the mating pool because the string occupies the
interval 0.266–0.438, as shown in column B. Column D refers to the selected string. Similarly,
other strings are selected according to random numbers shown in column C. After this selection
procedure is repeated n = 8 times, where ‘n’ is the population size, the number of selected copies
for each string is counted. This number is shown in column E. For example, the strings 4 and 5
get 2 copies, 6 and 7 get no copies, and the remaining strings get one copy each. Comparing to
column A, the expected counts are that strings 5 and 8 get 2 copies, 1 and 6 get no copies, and
the remaining get one copy. Column A and E reveal that the theoretical expected count and the
true count of each string more or less agree with each other.
filled box show the population left out in the pool. The action of the reproduction operator is
clear from this point. The inferior points have been probabilistically eliminated from further
consideration. It should also be noted that not all selected points are better than rejected points.
For example, first individual is selected whereas the sixth individual is not selected. Although the
above Roulette-wheel selection is easier to implement, it is noisy. A better stable version of the
selection operator is sometimes used. After the expected count for each individual string is
calculated, the strings are first assigned value exactly equal to the mantissa of the expected count.
Thereafter, the regular Roulette-wheel selection is implemented using decimal part of the expected
count of the probability distribution. This selection method is less noisy and is known as
stochastic remainder selection.
If the selective pressure is too low, the convergence rate will be slow and the GA will take
unnecessarily long time to find the optimal solution because more genes are explored in the
search. An ideal selection strategy should be such that it is able to adjust its selective pressure
and population diversity so as to fine-tune GA search performance.
Whitley (1989) pointed out that the fitness proportional selection (e.g. Roulette-wheel
selection) is likely to lead to two problems, namely
1. Stagnation of search because it lacks selection pressure, and
2. Premature convergence of the search because it causes the search to narrow down too
quickly.
Unlike the Roulette-wheel selection, the tournament selection strategy provides selective
pressure by holding a tournament competition among NU individuals (Frequency of NU = 2)
(Goldberg and Deb, 1991).
The best individual (the winner) from the tournament is the one with highest fitness f which
is the winner of NU. Tournament competitors and the winner are then inserted into the mating
pool. The tournament competition is repeated until the mating pool for generating new offspring
is filled. The mating pool comprising of tournament winner has higher average population fitness.
The fitness difference provides the selection pressure, which drives GA to improve the fitness of
succeeding genes. The following steps illustrate the tournament selection strategy (see
Table 10.11) and the fitness values are taken from Table 10.8.
Individuals 1 2 3 4 5 6 7 8
Fitness 1 2.10 3.11 4.01 4.66 1.91 1.93 4.55
From the above, it is clear that 2, 3, 5 and 6 are chosen only once 4, 8 are chosen twice, and
1 and 7 are not chosen at all. Table 10.12 gives the new mating pool.
Roulette-wheel selection omitted populations 6 and 7, two copies of 4 and 5, and single
copy for the others whereas tournament selection omitted 1 and 7, two copies for 4 and 8, and
single copy for the others.
During the early genetic evolution process, there are a large number of individuals or
chromosomes that almost satisfy all constraints except one or two. A change in one or two design
variable (strings) may produce a solution with a higher fitness value. This means throwing out
these solutions may result in a loss of some important information which might eventually lead to
optimal solution.
1 2
2% 5% 3
8%
4
10%
5
75%
Figure 10.15 is according to fitness and Fig. 10.16 is according to rank. The method can lead to
slow convergence because the best chromosome does not differ so much from the other.
1
7%
2
5 13%
33%
3
20%
4
27%
This is not a particular method of selecting the parents. The main idea of the selection is that
bigger part of chromosome should survive to next generation. Here, GA works in the following
way. In every generation are selected, a few (good individuals with high fitness for maximization
problem) chromosomes, for creating new off springs. Then, some (bad with low fitness)
chromosomes are removed and new offspring is placed in that place. The rest of population
survives a new generation.
10.7.6 Elitism
In this method, first the best chromosome or few best chromosomes are copied to new population.
The rest is done in a classical way. Elitism can very rapidly increase the performance of GA
because it prevents loosing the best-found solutions. From practical consideration point of view, if
F fitness functions are positive and for minimization problem, Goldberg (1989), suggest that the
fitness of any ith individual must be subtracted from a large constant, so that all fitness values are
non-negative and individuals get fitness values according to their actual merit.
Now, the new expression for fitness becomes
The reproduction operator selects fit individuals from the current population and places them in a
mating pool. Highly fit individuals get more copies in the mating pool, whereas the less fit ones
get fewer copies. As the number of individuals in the next generation is also same, the worst fit
individuals die off. The reproduction operator can be implemented in the following manner.
The factor fi / G for all individuals is calculated, where G is the average fitness. This factor is
the expected count of individuals in the mating pool, and shown in column 4 of Table 10.13. It is
then converted to an actual count by appropriately rounding off so that individuals get copies in the
mating pool proportional to their fitness, as shown in Column 5 of Table 10.13. A mating pool is
created where individuals 1 and 6 die off. This process of reproduction confirms the Darwinian
principle of survival of the fittest. Figure 10.17 explains how the mating pool is created.
The generation gap is defined as the proportion of individuals in the population, which are
replaced in each generation. So far, we have been doing reproduction with a generation gap of 1,
i.e. population is replaced in each generation. However, a more recent trend has favoured steady-
state replacement which is given by Whitley (1987, 1989). This operates at the other extreme and
in each generation only a few (typically two) individuals are replaced. This may be a better model
302 Neural Networks, Fuzzy Systems, and Evolutionary Algorithms—Synthesis and Applications
of what happens in nature. In shortlived species including some insects, parents lay eggs and then
die before their offsprings hatch. But in longer-lived species including mammal’s, offspring and
parents live concurrently. This allows parents to nurture and teach their offspring but also gives
rise to competition among them. Generation gap can be classified as
p
Gp = (10.28)
Np
where Np is the population size and p is the number of individuals that will be replaced. Several
schemes are possible. Some of which are:
1. Selection of parents according to fitness and selection of replacement at random,
2. Selection of parents at random and selection of replacement by inverse fitness,
3. Selection of both parents and replacements according to fitness/inverse fitness.
Generation gap can be gradually increased as the evolution takes place to widen exploration
space and may lead to better results.
SUMMARY
In this chapter, we have seen that genetic algorithm comprises a set of individuals, elements (the
populations) and a set of biologically inspired operators defining the population itself. According to
evolutionary theory, only the most suited element in a population is likely to survive and generate
offspring, thus transmitting the biological heredity to the new generation. In computing, GA maps
problem on to a set of (typically binary) strings, each string representing a potential solution.
Table 10.14 gives the comparison between biological terms and the corresponding terms in GA.
In the next chapter we will discuss inheritance operators, their performance, and the
application of GA to real-life problems.
· Various optimization techniques are illustrated.
· Non-traditional search and optimization methods are discussed.
· Encoding of variables in GA are given.
· Evaluation of fitness functions for an example of two bar pendulum bar is described.
· Various selection methods such as Roulette-wheel selection, Boltzmann selection,
Tournament selection, Rank selection, Steady-state selection are discussed.
Fundamentals of Genetic Algorithms 303
PROGRAMMING ASSIGNMENT
P10.1 In a three variable problem the following variable bounds are specified.
-6 < x < 12
0.002 £ y £ 0.004
10 4 £ z £ 105
What should be the minimum string length of any point (x, y, z) coded in binary string to
achieve the following accuracy in the solution
1. two significant digits.
2. three significant digits.
P10.2 Repeat the above problem when ternary strings (with three alleles 0, 1, 2) are used instead
of binary string.
P10.3 We want to use GA to solve the following nonlinear programming problem.
minimize (x1 - 2.5)2 + (x2 - 5)2
subject to
5.5x1 + 2x22 - 18 £ 0
0 £ x1, x2 £ 5
We decide to give three and two decimal places of accuracy to variables x1, x2 respectively.
1. How many bits are required for coding the variables?
2. Write down the fitness function which you would be using in reproduction.
P10.4 Consider the following population of binary strings for a maximization problem.
String Fitness
01101 5
11000 2
10110 1
00111 10
10101 3
00010 100
Find out the expected number of copies of the best string in the above population of the
mating pool under
1. Roulette wheel selection.
2. Tournament selection.
If only the reproduction operator is used, how many generations are required before the
best individual occupies the complete population under each selection operator.
P10.5 Write a program in any programming language of your choice for creating initial
population (for n variables) with n-bits string for each variable. The values of each variable
can be selected from a table of data. Assume an objective function, find fitness value, and
get the offspring using Roulette-wheel selection.
304 Neural Networks, Fuzzy Systems, and Evolutionary Algorithms—Synthesis and Applications
REFERENCES
Davis, L. (1991), Handbook of Genetic Algorithms, Van Nostrand Reinhold, New York.
Deb, K. (1991), Optimal Design of a Welded Beam Structure via Genetic Algorithms, AIAA
Journal, Vol. 29, No. 11, pp. 2013-2015.
Deb, K. (1995), Optimization for Engineering Design—Algorithms and Examples, Prentice-Hall of
India, New Delhi.
Dorigo, M. and G.D. Caro (1999), Ant Algorithm for Discrete Optimization, Artificial Life, Vol. 5,
pp. 137-172.
Goldberg, D.E. and M.P. Samatini (1986), Engineering Optimization via Genetic Algorithm, Proc.
of the Ninth Conference on Electronic Computation, pp. 471-482.
Goldberg, D.E. (1989), Genetic Algorithms in Search, Optimization and Machine Learning,
Reading, Mass., Addison-Wesley.
Goldberg, D.E. and K. Deb (1991), A Comparative Analysis of Selection Schemes Used in GA,
Foundations of Genetic Algorithms, I, pp. 53-69.
Holland, J.H. (1975), Adaptation of Natural and Artificial Systems, University of Michigan Press,
Ann Arbor.
Jenkins, W.M. (1991), Towards Structural Optimization via the Genetic Algorithms, Computers
and Structures, Vol. 40, No. 5, pp. 1321-1327.
Kirkpatrik, S., C.D. Gelatt, and M.P. Vecchi (1983), Optimization by Simulated Annealing,
Science 220, pp. 671-680.
Kost, B. and Baumann (1999), Structural Topology Optimization by Stochastic Algorithms, In S.
Hernandez, A.J. Kassab and C.A. Brebbia (Eds.), Computer Aided Optimum Design of
Structures, WIT Press, pp. 13-22.
Kost, B. (1995), Evolution Strategies in Structural Topology Optimization of Trusses, P.J. Pahl
and H. Werner (Eds.), Proc of 6th Int. Conf. on Computer in Civil and Building Engg, A.A.
Balkimy, Rotter Dama, pp. 675-681.
Michalewicz, Z. (1992), Genetic Algorithm + Data Structures = Evolution Program, Springer
Verlag, Berlin.
Rajeev, S. and G.S. Krishnamoorthy (1992), Discrete Optimization of Structures Using Genetic
Algorithms, Jol. of Structural Engineering, ASCE, Vol. 118, No. 5, pp. 1223–1250.
Whitley, D. (1987), Using Reproductive Evaluation to Improve Genetic Search and Heuristic
Discovery, J.J. Greffenstette (Ed.), Proc. of Second Intl. Conf. on Genetic Algorithms,
Lawrence Eralbaum Associates, pp. 108-115.
Whitley, D. (1989), The GENITUR Algorithm and Selection Pressure—Why Rank-based
Allocation of Reproduction Trials is Best, Proc. of Int. Conf. on Genetic Algorithms,
Schaffered, Morgan Kaufmann Publishers, Los Altos, Cal, pp. 10-19.
Wolfram, S. (1994), Cellular Automata and Complexity, Ist ed., Addison-Wesley, Westview Press,
Boulder, Colorado, U.S.A.