Chapter 3 Proposed Methods
3.5 Approach 2: Genetic Algorithm (GA)
Genetic Algorithm (GA) is an adaptive heuristic search algorithm premised on the evolutionary ideas of natural selection and genetic. The basic concept of GAs is designed to simulate processes in natural system necessary for evolution, specifically those that follow the principles first laid down by Charles Darwin of survival of the fittest. As such they represent an intelligent exploitation of a random search within a defined search space to solve a problem.
3.5.1 Overview of GA
We choose GA for solving LARA problem mainly due to some reasons: First, this problem is very complicated and no polynomial time algorithm can solve it. Second, if enough computation time is invested, GA approximates a global optimum much more likely than heuristics which are trapped in a local optimum. Third, this problem has a straightforward encoding as a GA, and the complexity of computing the fitness of a chromosome is also bounded in polynomial time.
We choose steady-state genetic algorithm that uses overlapping populations. In this variation, we initialize a population with certain number of chromosomes (m chromosomes for example). Then, two chromosomes in the population are selected to produce another m offsprings. In order to maintain m chromosomes in the population, we replace worse members in original population with new offsprings. Figure 3-8 illustrates the flow chart of our GA.
Initialize population randomly
Select chromosome randomly for mating
Apply crossover and mutation as the parent mate
Delete members of the population to make room for the new chromosome
Evaluate the new chromosome and insert them into the population
N Are stopping criteria satisfied?
Y
Finish
Figure 3-8 Flow chart of our GA
Throughout the rest of this section, we will use the terms “solution,” “individual,”
and “chromosome” interchangeably to refer to either costl( ) where is a certain combination in searching space or its representation in the GA.
Pk
P ,...,1 P ,...,1 Pk
3.5.2 Chromosomal Representation
The basic idea of encoding as a chromosome is to determine the most important values to be stored in MRs. If we choose these values properly, it will reduce many addressing costs. Therefore, the length of a chromosome is the total number of different difference (excluding 0 and 1) in MEDG and each gene in a chromosome corresponds to a difference respectively and it is either ‘0’ or ‘1’. For example, Figure 3-9(c) shows there are five genes in a chromosome because total number of different difference in Figure
3-9(b) is five (They are 3, 6, 2, 5, and 4). Thus, gene 1 may correspond to 3, gene 2 may correspond to 6, gene 3 may correspond to 2, gene 4 may correspond to 5 and gene 5 may correspond to 4.
Figure 3-9 (a) a source program (b) MEDG (c) chromosome representation
3.5.3 Population Initialization
If k ARs and l MRs are available, we initialize a population with m chromosome.
Each chromosome contains l ‘1’s and other genes in chromosome are ‘0’. This constraint may speed up computation time of convergence (we will discuss this later). Figure 3-10 is an example that if two ARs and two MRs are available, two ‘1’s exist in each chromosome.
Chromosome
gene 1 gene 5
(c)
Chromosome 1 1 0 1 0 0 Chromosome 1 1 0 1 0 0
. . .
Chromosome m 0 1 0 1 0 Chromosome m 0 1 0 1 0
Initial population
Figure 3-10 An example of initial population
3.5.4 Crossover and Mutation Operation
roduce offspring from two selected parents in the population and apply bit m
ossover operation
igure 3-11(a)), we randomly specify a point on
n operation
osomes has probability to flip bit from ‘0’ to ‘1’
We apply one-point crossover operation to p
utation operation to each individual of the offspring.
One-point cr
After two parents are selected (F
these two chromosomes (Figure 3-11(b)). Then we interchange their tail from the point and produce two new offsprings (Figure 3-11(c)).
Bit mutatio
Each gene of produced chrom
or from ‘1’ to ‘0’. Figure 3-12 shows an example that gene 3 and gene 5 are mutated within a chromosome.
Figure 3-11 One-point crossover operation
Figure 3-12 Bit mutation operation
ain the number of ‘1’ within a chromosome initially. However, after applying crossover and m
Notice that we constr
utation operation, the number of ‘1’ may not equal to l. We will discuss this situation later.
Parent 1: 0 1 1 0 0
(a)
Parent 2: 0 1 0 1 0
Parent 1: 0 1 1 0 0
Parent 2: 0 1 0 1 0
one point
(b)
0 1 1 1 0
Child 1:
(c)
Child 2: 0 1 0 0 0
Before mutating 0 1 1 1 0
After mutating 0 1 0 1 1
3.5.5 Evaluation Function
The genetic algorithm uses an objective function to determine how 'fit' each chromosome is for survival. We evaluate the fitness of a chromosome according to the following steps:
1. Some edges in the MEDG are removed if the genes corresponding to difference of the edges indicate ‘0’.
2. Apply Basu’s heuristic to obtain k paths P ,...,1 Pk
3. Evaluation function of the chromosome = costl(P ,...,1 Pk)
In our design, smaller the fitness of the chromosome is, higher score it has. That is, it is more possible to stay in the population. Take Figure 3-9 for example. Two ARs and two MRs are available and we want to calculate the fitness of the chromosome in Figure 3-13(a). According to the chromosome, we remove edges in Figure 3-9(b), which differences are 3 and 2 because genes corresponding to 3 and 2 in the chromosome are ‘0’
(see Figure 3-13(b)). Then we apply Basu’s approach: Figure 3-13(c) shows two ARs are needed in phase 1 and MERGE algorithm is not necessary to applied because we have exactly two ARs available. So, the paths are P1 = {a1, a3, a′1} and P2 = {a2, a4, a′2}.
Finally, the fitness of the chromosome is cost2(P1, P2) or zero.
This is a good way to encode and decode a chromosome because edges should be kept in the graph tend to “evolve” genes to 1 and those should removed tend to evolve to 0. These differences on the edges are addressing costs but only l MRs can handle them.
Therefore, we constrain the number of ‘1’ within a chromosome at the beginning of the population. However, in the process of crossover and mutation operation, we permit the number of ‘1’ within a chromosome being unequal to l. This may also peed up computation time of convergence. For example, there are three ‘1’s within the chromosome in Figure 3-13(a) and gene 5 does not influence the fitness of the
chromosome — whether it is ‘0’ or ‘1’. However, leaving the gene 5 to ‘1’ may have a good effect on next generation. In fact, from our experiment, we get better solution if we constrain the number of ‘1’ within a chromosome at the beginning of the initial population and allow it to be unequal in the process of crossover and mutation operation.
(a) 3 6 2 5 4
Figure 3-13 An example of calculating a chromosome of evaluation function Chromosome 0 1 0 1 1
3.5.6 Parameters
We select the following parameters:
Population size: 30 individuals
Mutation probability per gene: 1/n, where n is number of array references Replacement rate: 2/3 of the population size
Termination condition: 2000 generations or conservative 500 generations without a fitness improvement
3.5.7 Time complexity
The time complexity of evaluating a chromosome is where is FIND-MIN algorithm to find a case of and is to compute
cost
) log (n4 n2 n2
O + n4
Pk
P ,...,1 n2log n2
l( ). Because is smaller than , the time complexity of evaluating a chromosome is dominated by . If there are m chromosomes in a population and L generations are produced, the total time complexity is .
Pk
P ,...,1 n2log n2 n4
) (n4 O
) (L m n4 O ⋅ ⋅