Вы находитесь на странице: 1из 15

Chapter 9: CROSSOVER

9.1 Introduction

Genetic algorithms are optimisation algorithms and mimic the natural process of evolution.
Important operators used in genetic algorithms are selection, crossover and mutation. In the
previous chapters, different forms of selections have been discussed. Selection operator is
used to select breeding individuals from a population that will participate in crossover.
Crossover and mutation operators are used to introduce diversity in the population. Type of
crossover and mutation operator used for a problem depends on the type of encoding used.
Different crossover operators are described in this chapter. In natural systems, crossing-over
is a complex process that occurs between pairs of chromosomes. Two chromosomes are
physically aligned, breakage occurs at one or more corresponding locations on each
chromosome, and homologous chromosome fragments are exchanged before the breaks are
repaired. This results in a recombination of genetic material that contributes to variability in
the population. In genetic algorithms, crossover operator exchanges substrings between
chromosomes represented as linear strings of symbols. The basic crossover operation is a
three-step procedure [Ryan 2000]. First, two individuals are chosen at random from the
population of 'parent' strings generated by the selection operator. Second, one or more string
locations are chosen as breakpoints or crossover points delineating the string segments to
exchange. Finally, parent string segments are exchanged and then combined to produce two
resultant offspring individuals. Crossover operates on selected genes from parent
chromosomes and creates new offspring. Simplest crossover may be exchanging genetic
material of two strings with respect to single crossover point. Crossover can be quite
complicated and depends mainly on the encoding of chromosomes. Specific crossover made
for a specific problem can improve performance of the genetic algorithm. Crossover
combines parental solutions to form offspring with a hope to produce better solutions.
Crossover operators are critical in ensuring good mixing of building blocks [Back et al.
2000].

151
Figure 9.1 One Point Crossover Figure 9.2 Two- Point Crossover
Image Source: [Weblink14] Image Source: [Weblink15]

In their purest forms, genetic algorithms work like blind search procedures [Goldberg 1989].
Certain problem specific information can be added to genetic algorithm to form hybrid
genetic algorithm so as to improve genetic search performance. Genetic algorithms can be
hybridised in number of ways. This chapter introduces the concept of hybridisation by
augmenting problem specific knowledge in crossover operation of genetic algorithm.
Integration of knowledge within the framework of genetic algorithm would produce a hybrid
that would reap best results.

9.2 Types of Crossover


Numerous crossover operators have been identified and studied in the past. The main basis
for classification of crossover operators is the type of encoding used in the chromosome. The
type of crossover to be implemented largely depends on the problem representation in the
form of the chromosome.

A. Single Point Crossover


Single point crossover is the pioneer crossover technique used in the past [Holland 1975, De
Jong 1975]. In this crossover, a single crossover point on both parent chromosomes is
selected by choosing a random number between (1, lc-1) where lc is length of chromosome.
Both the parent chromosomes are split at the crossover point chosen and all data beyond that
point in either chromosome is swapped between the two parent chromosomes [Sivanandam et
al. 2007, Eiben et al. 2003]. Figure 1 shows the single point crossover process.

152
Parent 1 1101 011
Parent 2 1010 010

Child 1 1101 010

Child 2 1010 011

Figure 9.3: Single point Crossover for Binary Encoding

B. N-point crossover
This operator was first implemented by De Jong in 1975. It is generalized form of single-
point crossover differing in number of crossover points [De Jong 1975]. For two point
crossover, the value of N is 2. The value of N may vary from 1 to N-1. The basic principle of
crossover process is same as that of one point crossover i.e. to exchange genetic material of
the two parents beyond the crossover points. Taking N=2, Two-point crossover process is
illustrated in the figure 9.2.

Parent 1 1101 011


Parent 2 1010 010

Child 1 1100 011


Child 2 10110 10

Figure 9.4: Two Point Crossover for Binary Encoding

One-point and N-point crossover have a tendency to exhibit positional bias and inherent bias
which have proved to be experimentally evident [Spears et al. 1991, Eiben et al. 2003]. There
is an inherent bias in N-point crossover that keeps together genes that are located close to
each other in the encoding. In N-point crossover when N is odd (say N=1), there is strong
positional bias against keeping together combination of genes that are located at opposite
ends of the encoded chromosome.

C. Uniform crossover
In contrast to previous crossover operators, Uniform crossover operator does not divide the
parent chromosome into segments for recombination. Rather, it treats each gene of the
153
chromosome independently to choose for the offspring. In Uniform crossover, number of
crossover points is not fixed initially. It recombines genes of parent chromosomes on the
basis of crossover mask. It selects x number of crossover points in the chromosome where the
value of x is a random value less than the length of the chromosome. Crossover mask is
generated according to this random value. In this crossover, each gene in the offspring is
created by copying the corresponding gene from one of the parents. The selection of the
corresponding parent is undertaken via a randomly generated crossover mask [Sivanandam
2007, Ackley 1987, Syswerda 1989]. At each index, the offspring gene is taken from the first
parent if there is a 1 in the mask at this index, and if there is a 0 in the mask at this index, the
gene is taken from the second parent. Due to this construction principle uniform crossover
does not support the evolvement of higher order building blocks.

Uniform crossover does not exhibit positional bias but do exhibit distributional bias due to
which uniform crossover has a strong tendency towards transmitting 50% of the genes from
each parent and against transmitting an offspring a large number of coadapted genes from one
parent. Figure 9.3 illustrates the process of Uniform crossover.

Parent 1 10110011
Parent 2 00011010
Mask 11010110
Child 1 10011010
Child 2 00110011

Figure 9.5. Uniform Crossover for Binary Encoding

D. Partially Matched Crossover (PMX)


Partially Matched or Mapped Crossover (PMX) is the most widely used crossover operator
for chromosomes having permutation encoding. It was proposed by Goldberg and Lingle
[Goldberg et al. 1985] for Travelling Salesman Problem. In Partially Matched Crossover, two
chromosomes are aligned, and two crossover points are selected randomly. The two crossover
points give a matching selection, called swab, which is used to affect a cross through

154
position-by-position exchange operations. [Goldberg 1989, Eiben et al. 2003, Sivanandam et
al. 2007]. The step by step process of PMX is as follows:

 Copy the swab from first parent (P1) into the first offspring.
 Starting from first crossover point, look for elements in swab of second parent (P2)
that have not been copied.
 For each not copied element (say i), look in first offspring to find what elements have
been copied from P1 (say j).
 Place i into the position occupied by j in P2.
 If place occupied by j in P2 is already filled in offspring by k, then put I in position
occupied by k in P2.
 Fill all the positions of the first offspring similarly for all elements in P2.
 Repeat this set of steps for second offspring reversing the order of parents.

Consider two strings:


Parent A 4 8 7 | 3 6 5 | 1 10 9 2
Parent B 3 1 4 | 2 7 9 | 10 8 6 5

Two crossover points were selected at random, and PMX proceeds by position wise
exchanges. In-between the crossover points the genes get exchanged i.e., the 3 and the 2, the
6 and the 7, the 5 and the 9 exchange places. This is by mapping parent B to parent A. Now
mapping parent A to parent B, the 7 and the 6, the 9 and the 5, the 2 and the 3 exchange
places. Thus after PMX, the offspring produced as follows:

Child A 4 8 6 2 7 9 1 10 5 3
Child B 2 1 4 3 6 5 10 8 7 9

where each offspring contains ordering information partially determined by each of its
parents. PMX can be applied to problems with permutation representation.

E. Order Crossover (OX)


It is also used for chromosomes with permutation encoding and was proposed by Davis
[Davis 1991]. The order crossover begins in a manner similar to PMX by choosing two
crossover points. But instead of using point-by-point exchanges as PMX does, order

155
crossover applies sliding motion to fill the left out holes by transferring the mapped positions.
It copies the sublist of permutation elements between the crossover points from the cut string
directly to the offspring, placing them in the same absolute position [Eiben et al. 2003,
Sivanandam et al. 2007]. Step by step procedure of order crossover is as follows:

 Randomly choose two crossover points and copy the segments between them from
first parent (P1) to first offspring.

 Starting from second crossover point in second parent (P2) copy the remaining
uncopied elements into the first offspring in the order they appear in P2.

 Create the second offspring similarly by reversing the roles of parents i.e. second
offspring has swab of P2 and elements are copied from P1.

For example:
Parent A 4 8 7 | 3 6 5 | 1 10 9 2
Parent B 3 1 4 | 2 7 9 | 10 8 6 5

On mapping parent B with parent A, the places 3,6 and 5 are left with holes.
Child B H 1 4 2 7 9 10 8 H H

These holes are now filled with a sliding motion that starts with the second crossover point.
Child B 2 7 9 H H H 10 8 1 4

The holes are then filled with the matching section taken from the parent A. Thus performing
this operation, the offspring produced using order crossover is as given below [Goldberg
1989].

Child A 3 6 5 2 7 9 1 10 4 8
Child B 2 7 9 3 6 5 10 8 1 4

156
It can be seen that the elements in the crossover section preserve relative order, absolute
position, and adjacency from parent 1. The elements that are copied from the filler string
preserve only the relative order information from the second parent. It has been observed that
PMX tends to respect absolute positions while OX tends to respect relative positions.

F. Cycle Crossover

Cycle crossover is used for chromosomes with permutation encoding. Cycle crossover
performs recombination under the constraint that each gene comes from the parent or the
other [Oliver et al. 1987]. The basic principle behind cycle crossover is that each allele comes
from one parent together with its position. It divides the elements into cycles. A cycle is a
subset of elements that has the property that each element always occurs paired with another
element of the same cycle when the two parents are aligned. Cycle Crossover occurs by
picking some cycles from one parent and the remaining cycles from the alternate parent. All
the elements in the offspring occupy the same positions in one of the two parents. First a
cycle of alleles from parent 1 is created. Then the alleles of the cycle are put in child 1. Other
cycle is taken from parent 2 and the process is repeated [Goldberg 1989, Sivanandam et al.
2007].

The procedure for creating cycles is as follows:


 Start with the first unused position and allele in first parent (P1).

 Look at the allele in same position in second parent (P2).

 Go to the position with same allele in P1.

 Add this allele to the cycle.

 Repeat these steps until first allele of P1 is reached.

The complete set of operations in cycle crossover is illustrated in the Figure 9.6.

157
Figure 9.6: Cycle Crossover
Image Source: [Eiben et al. 2003]

G. Edge Crossover

Edge crossover is based on the idea that an offspring should be created using only edges
present in one or more parent [Whitley 2000, Eiben et al. 2003]. Edge table is created which
for each element lists the other elements linked to it in the two parents.’+’ sign in edge table
indicates the presence of edge in both parents. Working of edge crossover is as follows:

 Construct the edge table.

 Choose a random element and put in the offspring.

 Set this selected element as current element.

 Remove all references of current element from table.

 Examine list of edges for current element. If there is a common edge, pick that
element as next chosen element. Otherwise, pick the entry in the list which itself has
the shortest list. In case of Tie, randomly choose the element.

 When an empty list is reached, the other end of offspring is examined otherwise new
element is chosen randomly. This will create foreign edges which were not created
earlier.

158
For example: Edge table for the two chromosomes is shown in Table 9.1 and construction of
offspring using Edge crossover is shown in Table 9.2.

Parent 1: [1 2 3 4 5 6 7 8 9]
Parent 2: [9 3 7 8 2 6 5 1 4]

Element Edges Element Edges Element Edges


1 2,5,4,9 4 1,3,5,9 7 3,6,8+
2 1,3,6,8 5 1,4,6+ 8 2,7+,9
3 2,4,7,9 6 2,5+,7 9 1,3,4,8

Table 9.1: Edge table for Parent 1 and Parent 2 chromosome

Choices Element Selected Reason Partial Result


All 1 Random [1]
2,5,4,9 5 Shortest list [1 5]
1,6 6 Common Edge [1 5 6]
2,7 2 Random [1 5 6 2]
3,8 8 Shortest List [1 5 6 2 8]
7,9 7 Common edge [1 5 6 2 8 7]
3 3 Only item in list [1 5 6 2 8 7 3]
4,9 9 Random [1 5 6 2 8 7 3 9]
4 4 Last element [1 5 6 2 8 7 3 9 4]

Table 9.2: Permutation construction using Edge crossover

H. Arithmetic Crossover
In case of real-value encoding, arithmetic crossover is used. Arithmetic crossover operator
defines a linear combination of two chromosomes [Michalewicz 1994, Eiben et al. 2003].
Two chromosomes are selected randomly for crossover and produce two offsprings which are
linear combination of their parents as per the following computation:
Cigen+1 = a.Cigen + (1-a).Cjgen

Cjgen+1 = a.Cjgen + (1-a).Cigen

159
gen gen+1
where C an individual from the parent generation , C an individual from child
generation , a is the weight which governs dominant individual in reproduction and it is
between 0 and 1.
e.g. with a = 0.5

Figure 9.7: Arithmetic Crossover


Image Source: [Eiben et al. 2003]

I. Multiparent Crossover

Mutiparent crossover does not exist in nature. In this case, number of parents is more than
two and this scheme tests the cases which do not exist in nature. Technically, multiparent
crossover will amplify the effect of recombination. Such multiparent crossover operators are
categorised on the basis of mechanism used for combining genetic information.

 Based on allele frequencies [Muhlenbein 1989] eg; p-sexual voting generalising


uniform crossover

 Based on segmentation and recombination of the parents eg: diagonal crossover


generalising n-point crossover [Eiben et al. 1994]

 Based on numerical operations on real valued alleles [Tsutsui 1998] Eg: center of
mass crossover generalising arithmetic crossover.

9.3 Hybridisation in Genetic Algorithms & Memetic algorithms

Genetic algorithm is population based global search technique. Genetic algorithms blindly
search through the state space having no knowledge reference by exploiting only the coding
and objective function in each generation of population. Their indifference towards problem
specific information serves as a blessing as well as a curse [Goldberg 1989].
160
Incorporating problem specific information in genetic algorithm at any level of genetic
operation would form a hybrid genetic algorithm. One such technique of hybridisation of
knowledge and global genetic algorithm is Memetic Algorithms. Memetic algorithms are
evolutionary algorithms that apply separate local search process to refine individuals. They
are inspired by Richard Dawkins’s concept of meme [Dawkins 1976] which represents a unit
of cultural evolution that can exhibit local refinement. Memetic algorithms are also known as
hybrid Evolutionary Algorithms [Moscato et al. 2003]. In simple words, Memetic algorithms
can be defined as genetic algorithms that include non-genetic local search to improve
genotypes. Memetic algorithms can blend the functioning of genetic algorithms with several
heuristic search techniques like simulated annealing, tabu search etc.

Memetic algorithms include a broad class of metaheuristics. Fundamental feature of memetic


algorithms is to exploit all available knowledge about the problem to be solved. Memetic
algorithms are hybrid evolutionary algorithms that combine global and local search by using
an evolutionary algorithm to perform exploration while the local search method performs
exploitation. Memetic algorithms are hybrid or combination of local and global search
strategy in an optimisation process.

Figure 9.8 Flowchart of Hybrid Evolutionary Algorithm – Memetic Algorithm


Image source: [Weblink16]
161
It is evident from the flowchart of memetic algorithm that hybridisation of knowledge into
the genetic algorithm can be done at level of operation - Initial population can be created
based on some heuristic or knowledge can be applied in selection or crossover or mutation
operator or separate local search method can be applied at each level. This hybridisation of
knowledge at various levels of genetic operations leads to enhancement of performance of
algorithm and more exploration of state space.

9.4 Tabu Search and Tabu List


Tabu search follows three main strategies [Pham et al. 2000] - Forbidding strategy that
controls what enters the tabu list, Freeing strategy that controls what exits the tabu list and
when, Short-term strategy that manages interplay between the forbidding strategy and freeing
strategy to select trial solutions. A chief way to exploit memory in tabu search is to classify a
subset of the moves in a neighborhood as forbidden or tabu [Glover et al. 1995]. A tabu list
records forbidden moves, which are referred to as tabu moves. It can be applied to both
discrete and continuous solution spaces. It is applied for larger and more difficult problems
like scheduling, quadratic assignment and vehicle routing. Tabu search obtains solutions that
rival and often surpass the best solutions previously found by other approaches [Glover et al.
1998].

9.5 Proposed Research Work – Tabu Crossover


In this research, a novel crossover operator is proposed that incorporates knowledge based on
existing population and uses the principle of Tabu search. It has been observed that crossover
operator largely depends on the type of encoding used. In case of permutation encoding, large
number of crossover operators have been portrayed. Still there is a scope of innovation and
improvement in terms of performance. Permutation encoding is applied mostly in ordered
applications like TSP which require large number of computations. So, one needs to devise
the crossover operator that is better in terms of performance and results in less number of
iterations and eliminates redundant solutions. In this paper, a new crossover operator is
proposed which incorporates certain knowledge component during crossover operation to
generate better offsprings using the principle of tabu search. The proposed crossover operator

162
considers two types of lists of pair of genes. The first list includes the best of gene pairs from
both the parents that are desirable and that can be retained in the offspring chromosomes. The
second list consists of pair of genes that are most undesirable in terms of fitness from both the
parents and should be avoided in the offspring chromosomes. The second list works like tabu
lists formed in case of tabu search. The proposed crossover operator includes the few pairs
representing best gene pairs from the first list and avoids the worst gene pairs from the
second list while forming the offspring. While doing so, if any gene position does not get
filled up, then it is filled according to the order of gene in the parent chromosome. The
proposed crossover operator has the benefit of including the best ones in search while
avoiding the worst ones. It can be shown as:
Parent A 4 9 2 6 5 3 8 10 1 7
Parent B 5 3 1 2 4 8 6 9 7 10

List 1 (best gene pairs) 8-10, 3-1


List 2 (worst gene pairs) 3-8, 6-9 (Tabu List)
Child A 5 3 1 2 4 6 8 10 9 7
Child B 4 3 1 9 2 6 5 7 8 10

It is evident from this example that the two best gene pairs are retained in both the child
chromosomes. The gene pairs in tabu list are avoided in the child chromosomes. This would
lead to better results in terms of fitness value.

9.6 Implementation & Observation

In this research work, genetic algorithm is developed using MATLAB code. The test problem
considered is Benchmark Eil51 Travelling Salesman Problem (TSP) instance. The code uses
the initial population depending on problem size, same crossover and mutation probability.
The performance of proposed crossover has been compared with PMX crossover in the test
code.

163
Figure 9.9. Comparison of Average Fitness using Tabu Crossover in TSP

Figure 9.10. Comparison of Minimum Fitness using Tabu Crossover in TSP

The research work compares two crossover operators namely Partially matched crossover
(PMX) and proposed tabu crossover on the benchmark TSP Eil51 problem using MATLAB
code. Observations are recorded for various runs of the code and it was found that among the
three selection approaches considered – roulette wheel selection, rank selection and proposed
annealed selection, the proposed annealed selection is more promising. It is very much clear
from the graphs obtained for benchmark TSP problem that proposed tabu crossover gives

164
better results than PMX crossover operator. There is a large difference between the
performance of genetic algorithm in the two cases of crossover operators.

9.7 Summary

Crossover and mutation are vital genetic operators in genetic algorithms that help to maintain
diversity in population. Different types of existing crossover operators have been listed in this
chapter and to introduce hybridisation at crossover level, a new tabu crossover operator is
proposed. The concept of hybridisation is inspired by the memetic algorithms. Memetic
Algorithms are evolutionary algorithms that use instance specific knowledge in operators.
They are orders of magnitude faster and more accurate than evolutionary algorithms.
Incorporating local search method within a genetic algorithm has helped to overcome most of
the obstacles that arise as a result of finite population sizes. The proposed tabu crossover
operator uses the knowledge concept along with the tabu list. It can be stated as knowledge
based operator. Proposed crossover can prove to be better for different applications also.

165

Вам также может понравиться