In genetic algorithms and evolutionary computation, crossover, also called recombination, is a genetic operator used to combine the genetic information of two parents to generate new offspring. It is one way to stochastically generate new solutions from an existing population, and is analogous to the crossover that happens during sexual reproduction in biology. Solutions can also be generated by cloning an existing solution, which is analogous to asexual reproduction. Newly generated solutions may be mutated before being added to the population.
Different algorithms in evolutionary computation may use different data structures to store genetic information, and each genetic representation can be recombined with different crossover operators. Typical data structures that can be recombined with crossover are bit arrays, vectors of real numbers, or trees.
The list of operators presented below is by no means complete and serves mainly as an exemplary illustration of this dyadic genetic operator type. More operators and more details can be found in the literature.[1] [2] [3] [4] [5]
Traditional genetic algorithms store genetic information in a chromosome represented by a bit array. Crossover methods for bit arrays are popular and an illustrative example of genetic recombination.
A point on both parents' chromosomes is picked randomly, and designated a 'crossover point'. Bits to the right of that point are swapped between the two parent chromosomes. This results in two offspring, each carrying some genetic information from both parents.
In two-point crossover, two crossover points are picked randomly from the parent chromosomes. The bits in between the two points are swapped between the parent organisms.
Two-point crossover is equivalent to performing two single-point crossovers with different crossover points. This strategy can be generalized to k-point crossover for any positive integer k, picking k crossover points.
In uniform crossover, typically, each bit is chosen from either parent with equal probability. Other mixing ratios are sometimes used, resulting in offspring which inherit more genetic information from one parent than the other.In a uniform crossover, we don’t divide the chromosome into segments, rather we treat each gene separately. In this, we essentially flip a coin for each chromosome to decide whether or not it will be included in the off-spring.
For the crossover operators presented above and for most other crossover operators for bit strings, it holds that they can also be applied accordingly to integer or real-valued genomes whose genes each consist of an integer or real-valued number. Instead of individual bits, integer or real-valued numbers are then simply copied into the child genome. The offspring lie on the remaining corners of the hyperbody spanned by the two parents
P1=(1.5,6,8)
P2=(7,2,1)
If the rules of the uniform crossover for bit strings are applied during the generation of the offspring, this is also called discrete recombination.[6]
In this recombination operator, the allele values of the child genome
ai
a | |
i,P1 |
a | |
i,P2 |
\alphai=
\alpha | |
i,P1 |
⋅ \betai+
\alpha | |
i,P2 |
⋅ \left(1-\betai\right) with \betai\in\left[-d,1+d\right]
i
[-d,1+d]
0.25
d
d=0
The adjacent figure shows for the two-dimensional case the range of possible new alleles of the two exemplary parents
P1=(3,6)
P2=(9,2)
C1
C2
For combinatorial tasks, permutations are usually used that are specifically designed for genomes that are themselves permutations of a set. The underlying set is usually a subset of
N
N0
In order to avoid the generation of invalid offspring, special crossover operators for permutations have been developed[11] which fulfill the basic requirements of such operators for permutations, namely that all elements of the initial permutation are also present in the new one and only the order is changed. It can be distinguished between combinatorial tasks, where all sequences are admissible, and those where there are constraints in the form of inadmissible partial sequences. A well-known representative of the first task type is the traveling salesman problem (TSP), where the goal is to visit a set of cities exactly once on the shortest tour. An example of the constrained task type is the scheduling of multiple workflows. Workflows involve sequence constraints on some of the individual work steps. For example, a thread cannot be cut until the corresponding hole has been drilled in a workpiece. Such problems are also called order-based permutations.
In the following, two crossover operators are presented as examples, the partially mapped crossover (PMX) motivated by the TSP and the order crossover (OX1) designed for order-based permutations. A second offspring can be produced in each case by exchanging the parent chromosomes.
The PMX operator was designed as a recombination operator for TSP like Problems.[12] The explanation of the procedure is illustrated by an example:
Procedure | Example | Example Chromosome | |||
Let be given two permutations of the same set. | P0=\left(A,B,C,D,E,F,G,H\right) P1=\left(C,G,E,A,F,H,B,D\right) | ||||
Randomly select two crossover points forming a gene segment in P0 | Here from gene position 4 to 6. | P0=\left(A,B,C,\underline{D,E,F},G,H\right) | |||
The selected section is copied to the child chromosome in the same position. | The open positions are indicated by question marks. | PC=\left(?,?,?,\underline{D,E,F},?,?\right) | |||
Look for genes that have not been copied in the corresponding segment of P1 m n P0 m n P1 | Gene A P1 \left(...,A,F,H,...\right) D P0 PC | PC=\left(?,?,?,\underline{\bold{D},E,F},?,?\right) | |||
The position of D P1 A PC | PC=\left(?,?,?,\underline{D,E,F},?,A\right) | ||||
If the place taken by n P1 k m k P1 | The next gene in \left(...,A,F,H,...\right) F H F P1 E H E P1 | PC=\left(?,?,H,\underline{D,E,F},?,A\right) | |||
After processing the genes from the selected segment in P1 P1 | The genes copied from P1 C,G B | PC=\left(C,G,H,\underline{D,E,F},B,A\right) | |||
The order crossover goes back to Davis in its original form and is presented here in a slightly generalized version with more than two crossover points. It transfers information about the relative order from the second parent to the offspring. First, the number and position of the crossover points are determined randomly. The resulting gene sequences are then processed as described below:
Procedure | Example | Example Chromosome | ||||||
Let be given two permutations of the same set. | P0=\left(A,B,C,D,E,F,G,H,I,J\right) P1=\left(B,D,A,H,J,C,E,G,F,I\right) | |||||||
Randomly select gene segments in P0 | Here two segments from gene position 1 to 2 and from 6 to 8. | P0=\left(\underline{A,B},C,D,E,\underline{F,G,H},I,J\right) | ||||||
As a child permutation, a permutation is generated that contains the selected gene segments of P0 | The open positions are indicated by question marks. | PC=\left(A,B,?,?,?,F,G,H,?,?\right) | ||||||
The remaining missing genes are now also transferred, but in the order in which they appear in P1 | The missing genes of P0 | Pmissing=\left\{C,D,E,I,J\right\}
=\left(D,J,C,E,I\right) | ||||||
This results in the completed child genome. | The transferred genes are underlined: | PC=\left(A,B,\underline{D,J,C},F,G,H,\underline{E,I}\right) | ||||||
Among other things, order crossover is well suited for scheduling multiple workflows, when used in conjunction with 1- and n-point crossover.
Over time, a large number of crossover operators for permutations have been proposed, so the following list is only a small selection. For more information, the reader is referred to the literature.
The usual approach to solving TSP-like problems by genetic or, more generally, evolutionary algorithms, presented earlier, is either to repair illegal descendants or to adjust the operators appropriately so that illegal offspring do not arise in the first place. Alternatively, Riazi suggests the use of a double chromosome representation, which avoids illegal offspring.[15]