The Genetic Algorithm in Computer Science
The Genetic Algorithm in Computer Science
Abstract. The genetic algorithm is described, including its three main steps: selection,
crossover, and mutation. This description is used in the presentation of two methods for
analyzing genetic algorithms: schema analysis and mathematical modeling. The discus-
sion of schema analysis focuses on the Schema Theorem. Following it, an exact mathe-
matical model is described. First, the model is presented assuming an infinite population.
Then the model is made more accurate by assuming a finite population.
1. Introduction. All life on Earth is thought to evolve. Genetic algorithms are com-
puting algorithms constructed in analogy with the process of evolution [1]. Genetic
algorithms seem to be useful for searching very general spaces and poorly defined spaces.
It is hoped that, through more rigorous theoretical study, we will determine what sorts
of spaces genetic algorithms can search efficiently.
In biology, the gene is the basic unit of genetic storage [5]. Within cells, genes
are strung together to form chromosomes. The simplest possible sexual reproduction
is between single-cell organisms. The two cells fuse to produce a cell with two sets of
chromosomes, called a diploid cell. The diploid cell immediately undergoes meiosis. In
meiosis, each of the chromosomes in the diploid cell makes an exact copy of itself. Then
the chromosome groups (original and copy) undergo crossover with the corresponding
groups, mixing the genes somewhat. Finally the chromosomes separate twice, giving
four haploid cells. Mutation can occur at any stage, and any mutation in the chromo-
somes will be inheritable. Mutation is essential for evolution. There are three types
relevant to genetic algorithms: point mutations where a single gene is changed, chromo-
somal mutations where some number of genes are lost completely, and inversion where
a segment of the chromosome becomes flipped.
This paper follows Melanie Mitchell’s book [3]. We will introduce a simplified genetic
algorithm using the notions of sexual reproduction. This algorithm captures most of
the essential components of every genetic algorithm, so we will call it the Standard
Genetic Algorithm.
A simple way to view the Standard Genetic Algorithm is provided by schema. With
them we can understand the Schema Theorem. It explains how crossover allows a
genetic algorithm to zero in on an optimal solution. However, schema are inadequate
in determining some characteristics of the population. Specifically, in determining the
speed of population convergence, and the distribution of the population over time. To
deal with these issues, we will develop an exact mathematical model, first assuming an
infinite population, and then a finite population. This model was originally presented
by Michael Vose and G.E. Liepins in [2] and [7]. More details are found in two papers
by Allen Nix and Michael Vose, [4] and [8]. In practice, the genetic algorithms used are
much more complex then the Standard Genetic Algorithm. Consequently, the analyses
presented in this paper have some major weaknesses. Specifically, schema analysis
165
166 MIT Undergraduate Journal of Mathematics
makes some approximations that weaken it; as a result, many in the field find little
use in further analysis. On the other hand, the exact mathematical models are far too
complex. Still, the analyses are worthy of study because they have made possible proofs
of some rather interesting theorems, and because they provide a nice introduction to
algorithmic analysis.
In Section 2, we will describe the Standard Genetic Algorithm. In Section 3, we
will describe Schema and present the Schema Theorem. In Section 4, we will describe a
mathematical model of the Standard Genetic Algorithm, requiring an infinite population
approximation. Finally, in Section 5, we will correct the model by requiring a finite
population.
f (xi )
ps (xi ) = Pn
k=1 f (xk )
3. Schema. A schema is a template made up of a string of 1s, 0s, and *s, where * is
used as a wild card that can be either 1 or 0. For example H = 1 ∗ ∗ 0 ∗ 0 is a schema;
it has eight instances, one of which is 101010. The number of non-*, or de ned, bits
in a schema is called its order and denoted o(H). In the example, H has order 3. The
greatest distance between two defined bits is the de ning length d(H). In the example,
H has a defining length of 3. In the discussion that follows we use the term ‘schema’ to
refer both to the template and to the set of instances it defines within a population.
There is an interesting point to consider. Let S be the set of all strings of length l.
l
There are 3l possible schema on S, but 22 different subsets of S. Hence, schema cannot
be used to represent every possible population within S. On the other hand, schema
are thought to form a representative subset of the set of all subsets of S.
We now look at the expected number of instances of schema H as we iterate the
Standard Genetic Algorithm. Let m(H, t) be the number of instances of H at time t.
Let f (x) represent the fitness of chromosome x, and f (t) represent the average fitness
at time t, or
P
f (x)
f (t) = x∈S
n
where n = |S|. Let u
(H, t) represent the average fitness of instances of H at time t, or
P
f (x)
x∈H
u
(H, t) = .
m(H, t)
If we completely ignore the effects of crossover and mutation, then we get the expected
value P P
x∈H f (x) f (x) u
(H, t)m(H, t)
E(m(H, t + 1)) = n P = x∈H = . (3-1)
x∈S f (x) f (t) f (t)
Let’s consider only the effects of crossover and mutation that lower the number of
instances of H in the population. Then we will get a good lower bound on E(m(H, t+1)).
Let Sc (H) be the probability that a random crossover bit is between the defining
bits of H. Let pc be the probability of crossover occuring. Then
d(H)
Sc (H) = 1 − pc .
l−1
Let Sm (H) be the probability of an instance of H remaining the same after mutation.
Then Sm (H) is dependent on the order of H. If the probability of mutation is pm , then
Sm (H) = (1 − pm )o(H) .
168 MIT Undergraduate Journal of Mathematics
Therefore we can alter Equation (3-1) to get the following theorem, proved by John
Holland. Schema Theorem. With the above notation, we have
u
(H, t)m(H, t) d(H)
(1 − pm )o(H) .
E(m(H, t + 1)) ≥ 1 − pc (3-2)
f (t) l−1
Then M(s) is given by the following expression, due to Vose [8, p. 65]:
M(s) = (σ0~s(t))T M σ0~s(t), · · · , (σ2l −1~s(t))T M σ2l −1~s(t) .
With this expression, we can calculate explicitly the expected value of each gener-
ation from the preceeding generation. The full derivation is fairly complex. It can be
found in Vose and Liepins [7, pp. 3339].
as the probability that pi (y) occurs in any one way. But the event can occur in many
ways. The number of ways of choosing the Z0,j chromosomes that are equal to 0 is
n n−Z0,j
Z0,j . Hence there are Z1,j ways for choosing the Z1,j chromosomes equal to 1,
and so on, giving
n n − Z0,j n − Z2l −1,j − · · · − Z0,j n!
··· = . (5-2)
Z0,j Z1,j Z2l −1,j Z0,j !Z1,j ! · · · Z2l −1,j !
Combining (5-1) and (5-2), we get
l
2Y −1
pi (y)Zy,j
Qi,j = n! .
i=0
Zy,j !
170 MIT Undergraduate Journal of Mathematics
References
[1] Heitkoetter, J., and Beasley, D., The hitchhiker’s guide to evolutionary comput-
ing: A list of frequently asked questions (FAQ), USENET:comp.ai.genetic, 1996.
Available via anonymous FTP from rtfm.mit.edu:/pub/usenet/news.answers/ai-
faq/genetic/
[2] Liepins, G. E., and Vose, M. D., Deceptiveness and genetic algorithm dynamics,
in Foundations of Genetic Algorithms, G. Rawlins (ed.), Morgan Kauffmann,
1991.
[3] Mitchell, M., An Introduction to Genetic Algorithms, MIT press, 1996.
[4] Nix, A. E., and Vose, M., D., Modeling Genetic Algorithms With Markov
Chains, Annals of Mathematics and Artificial Intelligence 5 (1992), 7988.
[5] Purves, W., Orians, G., and Heller, C., Life, the Science of Biology, Sinauer, 1995.
[6] Rota, G. C., Introduction To Probability Theory third preliminary edition,
Birkhauser, 1995.
[7] Vose, M. D., and Liepins, G. E., Punctuated equilibria in genetic search, Complex
Systems 5 (1991), 3134.
[8] Vose, M. D., Modeling simple genetic algorithms, in Foundations of Genetic
Algorithms 2, L. D. Whitley (ed.), Morgan Kaufmann, 1993.