On bit strings of length $L$, one-point crossover separates two fixed positions a distance $\delta$ apart with probability $\delta/(L-1)$, two-point crossover with $\delta(L-1-\delta)/\binom{L-1}{2}$, and uniform crossover with $1/2$ at any distance. On 100-bit OneMax (population 50, 300 generations, 30 seeds, no elitism), bit-flip mutation at $0.5/L$ or $1/L$ reached the optimum in every run, no mutation stalled at a median best of 88, and $2/L$ or more settled into a mutation-selection balance below the optimum (median 91 at $2/L$, 68 at $10/L$). Simulated binary crossover places two children symmetrically about the parents' mean, most often near the parents, with a spread that shrinks as the population converges. On permutations, PMX keeps positions, OX relative order, and CX a parent's position for every value.
Cut two permutations of the cities 1 to 9 at the same point and swap their tails, as one-point crossover does with bit strings:
parents 1 2 3 | 4 5 6 7 8 9 9 3 7 | 8 2 6 5 1 4
child 1 2 3 | 8 2 6 5 1 4
The child visits cities 1 and 2 twice and never visits 7 or 9. It is not a tour at all. This article shows what the standard operators do to produce valid children for each representation, and how each one sets the distance between a child and its parents.
A variation operator is only meaningful for a particular representation. It must turn valid genotypes into valid genotypes, and it should turn good ones into ones that are likely to be good. This article describes the standard crossover (recombination) and mutation operators for the three representations a genetic algorithm most often uses: bit strings, real-valued vectors and permutations. It follows the organization of Eiben and Smith (2015, ch. 4). Every worked example is printed by the script tools/experiments/evolution/operators.py in the site repository. The figures, and the numbers computed from them, come from tools/figures/crossover-and-mutation-operators.py.
First we take the bit-string operators, count how often each breaks up a group of genes, and measure how the mutation rate shapes a run on OneMax. Then we turn to real-valued vectors, derive simulated binary crossover, and compare where each operator puts its children. Next we build valid children of permutations by three different rules. Finally we name the parameter every operator shares, the size of its step. Selection, the other half of the search, is the subject of selection pressure and premature convergence.
Binary strings
One-point, two-point and uniform crossover
Take two parents of length 8, with positions numbered 1 to 8 from the left:
A = 11010011 B = 01101100
One-point crossover chooses a cut point and swaps everything after it. Cutting after position 3 gives the children 11001100 and 01110011. Two-point crossover chooses two cut points and swaps the segment between them. Cutting after positions 2 and 6 swaps positions 3 to 6 and gives 11101111 and 01010000. $n$-point crossover generalizes this to $n$ cuts, swapping alternate segments.
Uniform crossover decides every position independently. A random mask says, for each position, which parent the first child takes its bit from; the second child takes the other. With the mask 10110010, where 1 means "from A", the children are 11011110 and 01100001. Each mask bit is usually 1 with probability 0.5. Syswerda (1989) presented uniform crossover and compared it, theoretically and empirically, with one-point and two-point crossover.
The figure draws the three examples cell by cell. In every case the two children between them hold exactly the bits of the two parents at each position, one from each. The operators differ only in the pattern that decides which child gets which.
All three operators only rearrange existing values. At a position where both parents carry the same bit, every child carries it too. So crossover can never restore a value that has disappeared from the population; that is mutation's job. The seeded run in the simple genetic algorithm lost the last 1 in its final position, and crossover could not bring it back.
The three operators exchange the same bits. The pattern decides which genes stay together.
Positional bias and disruption
The operators differ in which genes they keep together. Under one-point crossover, two positions are separated only if the cut falls between them. So adjacent positions almost always travel together, and the two ends of the string are always separated. Under uniform crossover, distance along the string makes no difference. Eshelman, Caruana and Schaffer (1989) named two biases:
- positional bias, this dependence on distance;
- distributional bias, a bias in how many positions are exchanged. One-point crossover exchanges any number from 1 to $L - 1$ with equal probability, while uniform crossover exchanges a binomially distributed number, concentrated around $L/2$.
Positional bias decides how often crossover breaks up a combination of values that makes an individual good. In the terms of Holland's schema theorem, a schema is a pattern of fixed values at certain positions. Crossover disrupts it when neither child inherits all of those values from the same parent.
Example (positions 1 and 10 of a string of length 10). One-point crossover always separates the two ends, since every cut falls between them. Two-point crossover never does, and uniform crossover separates them half the time. The script computes the probability exactly, by enumerating every cut point or mask, for $L = 10$. It assumes the other parent differs from the first at every fixed position (the worst case):
| Fixed positions | One-point | Two-point | Uniform |
|---|---|---|---|
| 1, 2 | 0.111 | 0.222 | 0.500 |
| 1, 5 | 0.444 | 0.556 | 0.500 |
| 4, 7 | 0.333 | 0.500 | 0.500 |
| 1, 10 | 1.000 | 0.000 | 0.500 |
| 1, 5, 10 | 1.000 | 0.556 | 0.750 |
Each column follows from counting. The counts are worth doing once, because they explain the shapes.
One-point. There are $L - 1$ places to cut, after position 1 through after position $L - 1$, each chosen with probability $1/(L - 1)$. Two fixed positions $i < j$ end up in different children exactly when the cut falls after one of the positions $i, i + 1, \dots, j - 1$. Those are $j - i$ of the $L - 1$ places. The defining length $\delta$ of a schema is the distance between its outermost fixed positions, $j - i$, so the probability of disruption is
$$P_{\text{one}} = \frac{\delta}{L - 1}.$$
Fixed positions in between do not matter: if the outermost two stay together, so does everything between them. One cut in nine falls between positions 1 and 2, giving 0.111, and every cut falls between 1 and 10, giving 1.
Two-point. Now two distinct cut places are drawn from the same $L - 1$, giving $\binom{L - 1}{2}$ equally likely pairs, and the segment between them is swapped. Positions $i$ and $j$ are separated when exactly one of the two cuts falls among the $\delta$ places between them. If neither does, both positions are on the same side of the segment. If both do, the segment lies strictly between them, and both again stay with the same parent. Choosing one cut among the $\delta$ inner places and the other among the $L - 1 - \delta$ outer ones gives
$$P_{\text{two}} = \frac{\delta \, (L - 1 - \delta)}{\binom{L - 1}{2}}.$$
For $L = 10$ the denominator is 36. Positions 1 and 2 ($\delta = 1$) are separated with probability $1 \cdot 8/36 = 0.222$, twice the one-point value. Positions 1 and 10 ($\delta = 9$) give $9 \cdot 0 / 36 = 0$. Two-point crossover behaves as if the string were a ring. Any segment between two cuts leaves both ends on the same side, and on a ring positions 1 and 10 are neighbors. The formula is symmetric under $\delta \to L - 1 - \delta$. The figure script checks it against enumeration for every $\delta$ from 1 to 9.
The formula is for two fixed positions. With more, the positions in between matter under two-point crossover, because the swapped segment can take a middle position and leave the outer ones. For positions 1, 5 and 10 the two ends always stay together, as just shown. The schema is disrupted exactly when position 5 lies in the segment, that is, when one cut falls in the 4 places before position 5 and the other in the 5 places after it. That is $4 \times 5 = 20$ of the 36 pairs, or 0.556.
Uniform. Each position independently goes to child 1 from parent A with probability 1/2. A schema with $k$ fixed positions survives, in one child or the other, when child 1 takes all $k$ of those positions from A or all from B, which has probability $2 \cdot 2^{-k} = 2^{-(k-1)}$. The disruption probability is $1 - 2^{-(k-1)}$, independent of where the positions are: 0.5 for $k = 2$ and 0.75 for $k = 3$.
None of the operators is better in general. Low disruption helps when good combinations are encoded close together, as the building block hypothesis assumes. High disruption helps the search explore, and treats all positions alike when the encoding gives no reason to prefer an order. Which matters more depends on the encoding and the problem.
Bit-flip mutation
Bit-flip mutation flips each bit independently with probability $p_m$. Flipping positions 2 and 7 of 11001100 gives 10001110. The common default $p_m = 1/L$ flips one bit on average. It is also the rate used in the standard analysis of the (1+1) EA, which keeps one parent and accepts its mutant if it is no worse. With $p_m = 1/L$, the (1+1) EA's expected time to optimize any linear function of $L$ bits is $O(L \log L)$, and $\Theta(L \log L)$ when every weight is nonzero (Droste, Jansen and Wegener, 2002).
Example (children that mutation leaves unchanged). At $p_m = 1/L$ with $L = 100$, more than a third of children leave mutation with no bit flipped. The probability of no flip is $(1 - 1/L)^L$, which approaches $1/e = 0.3679$ as $L$ grows. The probability of exactly one flip is $L \cdot \frac{1}{L} (1 - 1/L)^{L-1} = (1 - 1/L)^{L-1}$, which approaches the same limit from above:
| $L$ | P(no flip) | P(exactly one flip) |
|---|---|---|
| 8 | 0.3436 | 0.3927 |
| 20 | 0.3585 | 0.3774 |
| 100 | 0.3660 | 0.3697 |
About a third of all offspring are copies of their crossover result. That matters when evaluations are expensive and when diversity is already low.
One flip per child is a default. The next section measures what happens on either side of it.
How the mutation rate shapes a run
The effects of the rate are easy to see on OneMax, where the fitness of a string is its number of ones and the optimum is the all-ones string. The script tools/experiments/evolution/mutation_rate.py runs a generational GA on OneMax with $L = 100$:
- a population of 50, binary tournament selection, and two-point crossover with probability 0.9;
- bit-flip mutation at rate $p_m$;
- complete replacement of the population each generation with no elitism, so that even the best string can be lost.
Each of six rates was run for 300 generations with the same 30 seeds.
Example (doubling the rate). Doubling the rate from $1/L$ to $2/L$ makes two flips per child instead of one. On OneMax in this GA, that holds the search back. At $2/L$ no run ever reached 100, and the median final best was 91, against 99 at $1/L$:
| $p_m$ | Mutated bits per child | Best in final population, median [IQR] | Runs ever reaching 100 |
|---|---|---|---|
| 0 | 0 | 88 [84, 89] | 0 of 30 |
| $0.5/L$ | 0.5 | 100 [100, 100] | 30 of 30 |
| $1/L$ | 1 | 99 [99, 100] | 30 of 30 |
| $2/L$ | 2 | 91 [89.25, 92] | 0 of 30 |
| $5/L$ | 5 | 76.5 [76, 77] | 0 of 30 |
| $10/L$ | 10 | 68 [67, 70] | 0 of 30 |
The two ends of the table fail for opposite reasons.
Without mutation, the population runs out of material. Selection and crossover only reshuffle the bits the initial population contains. In a finite population a position can lose its last 1 by chance, through a tournament that happens not to pick the strings carrying it. Once lost, it can never return. In the final populations of the $p_m = 0$ runs, a median of 12 positions held no 1 anywhere. The best string, at 88, is exactly $100 - 12$: every remaining position had been fixed at 1. De Jong saw a stall of the same kind, a population converged at most positions, in his own runs, described in the De Jong functions article.
With too much mutation, the population cannot hold what it finds. A child with $f$ ones has $L - f$ zeros, each turned into a one with probability $p_m$, and $f$ ones, each turned into a zero with the same probability. Its expected change from mutation alone is therefore
$$p_m (L - f) - p_m f = p_m (L - 2f),$$
which is negative whenever more than half of the bits are already right. At $p_m = 5/L = 0.05$ and $f = 76.5$, the median final value, a child loses $0.05 \times (100 - 153) = 2.65$ ones on average. The population levels off where the gain from selection each generation balances that loss. This is a mutation-selection balance, the same balance that stalled the simple genetic algorithm on OneMax. The balance point falls as $p_m$ rises: the expected loss at the final median is 1.64 for $2/L$ and 3.60 for $10/L$.
Even at $1/L$ the effect is visible. Every one of the 30 runs found the optimum. But a child of the all-ones string survives mutation unchanged only with probability $(1 - 1/L)^L = 0.366$. With no elitism, the final population still held the optimum in only 10 of the 30 runs, hence the median of 99. Halving the rate to $0.5/L$ reached the optimum sooner (median generation 70 against 92.5) and kept it in all 30.
These numbers belong to this GA. OneMax rewards every single correct bit, so small steps are always enough. Keeping the best individual (elitism), which this GA deliberately does not do, would at least stop it from losing the best string it has found. On problems with local optima that only a multi-bit jump can leave, a higher rate can pay for itself. That is part of why no rate is best for all problems.
Under the standard binary code, which bit flips also decides how far the decoded value moves, and adjacent values such as 7 (0111) and 8 (1000) differ in every bit. These Hamming cliffs, and the Gray code that removes them, are covered in binary encoding and Gray codes.
Real-valued vectors
When the variables are real numbers, a vector of floating-point values avoids the precision limit and the Hamming cliffs of a binary encoding. The operators below act on one variable at a time. For a vector they are applied to each variable, or to a randomly chosen subset. The worked examples use the parents $p_1 = 2$ and $p_2 = 5$.
Arithmetic and linear crossover
Arithmetic recombination takes a weighted average. In the whole-arithmetic form described by Eiben and Smith (2015, ch. 4), the children are $c_1 = \alpha p_1 + (1 - \alpha) p_2$ and $c_2 = (1 - \alpha) p_1 + \alpha p_2$. With $\alpha = 0.25$ they are 4.25 and 2.75. For $0 \le \alpha \le 1$ each child is a weighted average of the two parents with non-negative weights that sum to 1, so the children always lie between the parents. So repeated arithmetic crossover shrinks the population's spread, and crossover alone cannot move the population outside the range it started in.
Linear crossover (Wright, 1991) generates three candidates, the midpoint and two points beyond the parents on the line through them:
$$\tfrac{1}{2} p_1 + \tfrac{1}{2} p_2, \qquad \tfrac{3}{2} p_1 - \tfrac{1}{2} p_2, \qquad -\tfrac{1}{2} p_1 + \tfrac{3}{2} p_2,$$
here 3.5, 0.5 and 6.5. Wright keeps the best two of the three, which costs three evaluations per crossover.
Both operators produce a few fixed points. Blend crossover lets a random child land anywhere near the parents.
Blend crossover (BLX-α)
Blend crossover (Eshelman and Schaffer, 1993) draws each child uniformly from an interval that extends beyond the parents on both sides by a fraction $\alpha$ of their distance. With $d = |p_2 - p_1|$, the interval is
$$\left[ \min(p_1, p_2) - \alpha d, \; \max(p_1, p_2) + \alpha d \right].$$
For $\alpha = 0.5$ and the parents 2 and 5 the interval is $[0.5, 6.5]$, and a uniform random number $u = 0.3$ gives the child $0.5 + 0.3 \times 6 = 2.3$. The endpoints at $\alpha = 0.5$ are exactly Wright's two outer points, $\tfrac{3}{2} p_1 - \tfrac{1}{2} p_2$ and its mirror. BLX-0.5 is a common setting. Deb and Agrawal (1995) used it as the real-coded baseline when they introduced simulated binary crossover.
Simulated binary crossover (SBX)
Simulated binary crossover (Deb and Agrawal, 1995) was designed to give a real-valued GA the search behavior of one-point crossover on binary strings. Here is the idea in one sentence: children are placed symmetrically about the parents' mean, at a spread drawn from a distribution that favors spreads near the parents' own. The derivation below builds that distribution and shows how to sample it.
The formal version. Deb and Agrawal observed two properties of one-point crossover on decoded values. The mean of the two children equals the mean of the parents. And the spread factor
$$\beta = \frac{|c_2 - c_1|}{|p_2 - p_1|},$$
the ratio of the children's distance to the parents' distance, is usually close to 1: children near the parents are more likely than children far away. They modeled the distribution of $\beta$ with a polynomial,
$$\mathcal{P}(\beta) = \begin{cases} 0.5 (\eta + 1) \beta^{\eta}, & \beta \le 1, \\ 0.5 (\eta + 1) \dfrac{1}{\beta^{\eta + 2}}, & \beta > 1, \end{cases}$$
where the distribution index $\eta \ge 0$ controls the spread. Each branch carries probability 0.5, so contracting ($\beta < 1$) and expanding ($\beta > 1$) crossovers are equally likely. A large $\eta$ concentrates $\beta$ near 1, putting children close to their parents; a small $\eta$ spreads them out. Deb and Agrawal reported that values from 2 to 5 matched the behavior of one-point crossover in their simulations.
To sample $\beta$, draw $u$ uniformly from $[0, 1)$ and invert the cumulative distribution $F(\beta) = \int_0^{\beta} \mathcal{P}(b) \, db$. On the contracting branch,
$$F(\beta) = \int_0^{\beta} 0.5 (\eta + 1) b^{\eta} \, db = 0.5\, \beta^{\eta + 1}, \qquad \beta \le 1,$$
which reaches 0.5 at $\beta = 1$. On the expanding branch the first half is already accumulated, and
$$F(\beta) = 0.5 + \int_1^{\beta} 0.5 (\eta + 1) b^{-(\eta + 2)} \, db = 0.5 + 0.5 \left( 1 - \beta^{-(\eta + 1)} \right) = 1 - 0.5\, \beta^{-(\eta + 1)}, \qquad \beta > 1.$$
Setting $F(\beta) = u$ and solving each branch for $\beta$ gives
$$\beta = \begin{cases} (2u)^{1/(\eta + 1)}, & u \le 0.5, \\ \left( \dfrac{1}{2(1 - u)} \right)^{1/(\eta + 1)}, & u > 0.5. \end{cases}$$
The children are then placed symmetrically about the parents' mean:
$$c_1 = \tfrac{1}{2} \left[ (1 + \beta) p_1 + (1 - \beta) p_2 \right], \qquad c_2 = \tfrac{1}{2} \left[ (1 - \beta) p_1 + (1 + \beta) p_2 \right].$$
Adding the two formulas gives $c_1 + c_2 = p_1 + p_2$, so the children keep the parents' mean. Subtracting gives $c_2 - c_1 = \beta\,(p_2 - p_1)$, so their spread factor is the sampled $\beta$. These are the two properties the construction set out to reproduce.
The check. With $\eta = 2$ and $u = 0.3$, $\beta = 0.6^{1/3} = 0.8434$, a contracting crossover, and the children are 2.2349 and 4.7651. With $u = 0.8$, $\beta = 2.5^{1/3} = 1.3572$, an expanding one, and the children are 1.4642 and 5.5358. In both cases the children sum to 7, as the parents do, and their distance is $\beta$ times the parents' distance of 3.
Example (SBX at $u = 0.5$). When $u = 0.5$, SBX produces copies of the parents, whatever $\eta$ is. Then $\beta = (2 \times 0.5)^{1/(\eta + 1)} = 1$, and the formulas give $c_1 = p_1$ and $c_2 = p_2$. That is the point where the two branches meet, and, as the densities below show, where children are most likely to land.
Deb and Agrawal found that real-coded GAs using SBX performed as well as or better than binary-coded GAs with one-point crossover on the test problems they studied. The children's spread is proportional to the parents' distance. So SBX searches widely while the population is spread out and finely once it has converged. Deb and Beyer (2001) showed that this gives a real-valued GA with SBX, even without mutation, a self-adaptive behavior similar to that of self-adaptive evolution strategies. BLX-α also spreads its children in proportion to the parents' distance, since its interval is $(1 + 2\alpha)\,d$ wide.
Implementations differ in a detail the formulas above leave open. For a vector of variables, the pair of values that SBX produces for each variable can be assigned to the two children in a fixed order, as written here. Or it can be swapped at random for each variable, as in Deb's own NSGA-II code. The swap mixes the two parents' variables between children much as uniform crossover does, and it can change results substantially. In the NSGA-II article's experiments, it changes the median generational distance on ZDT1 by more than two orders of magnitude.
Mutation for real values
Uniform mutation replaces a value with one drawn uniformly from the variable's range. Gaussian mutation adds normally distributed noise, $x' = x + \sigma z$ with $z$ drawn from the standard normal distribution. With $x = 3$, $\sigma = 0.5$ and $z = -1.2$, $x' = 2.4$. The step size $\sigma$ is the critical parameter, and evolution strategies adapt it during the run, as described in the 1/5 success rule.
Polynomial mutation (Deb and Goyal, 1996) applies the same idea as SBX to a single parent. Take a variable bounded by $[x_L, x_U]$, a distribution index $\eta_m$, and $u$ drawn uniformly from $[0, 1)$. The basic form is
$$\delta = \begin{cases} (2u)^{1/(\eta_m + 1)} - 1, & u < 0.5, \\ 1 - \left[ 2(1 - u) \right]^{1/(\eta_m + 1)}, & u \ge 0.5, \end{cases} \qquad x' = x + \delta \, (x_U - x_L).$$
The perturbation $\delta$ lies in $[-1, 1)$ and is concentrated near 0, more strongly as $\eta_m$ grows. For $x = 3$ in $[0, 10]$:
| $\eta_m$ | $u$ | $\delta$ | $x'$ |
|---|---|---|---|
| 2 | 0.7 | +0.1566 | 4.5657 |
| 2 | 0.2 | −0.2632 | 0.3681 |
| 20 | 0.7 | +0.0240 | 3.2403 |
| 20 | 0.2 | −0.0427 | 2.5731 |
The basic form can push a value outside its bounds. Implementations clip it, or use a later variant whose distribution depends on the distance to each bound.
Single examples show individual children. The densities of the next section show where children land on the whole.
Where the children land
Write $m = (p_1 + p_2)/2$ for the parents' mean and $d = p_2 - p_1$ for their distance. The SBX formulas then simplify to $c_1 = m - \beta d / 2$ and $c_2 = m + \beta d / 2$. A child at distance $\lvert c - m \rvert$ from the mean corresponds to $\beta = 2 \lvert c - m \rvert / d$. Changing variables turns the density of $\beta$ into the density of a child, picked at random from the pair:
$$g(c) = \frac{1}{d} \, \mathcal{P}\!\left( \frac{2 \lvert c - m \rvert}{d} \right).$$
The factor $1/d$ has two parts. A step of $dc$ in the child's position is a step of $d\beta = (2/d)\,dc$ in $\beta$, which contributes $2/d$. The child is on a given side of the mean with probability $1/2$, which halves it.
The density peaks where $\beta = 1$, at $c = p_1$ and $c = p_2$. BLX-α has a flat density instead, $1/((1 + 2\alpha) d)$ over its interval. The figure plots both for the parents 2 and 5. It adds the density of polynomial mutation, which comes from the same change of variables. Solving the two branches of the mutation formula for $u$ gives the cumulative distribution of $\delta$:
$$u = \tfrac{1}{2} (1 + \delta)^{\eta_m + 1} \quad (\delta < 0), \qquad u = 1 - \tfrac{1}{2} (1 - \delta)^{\eta_m + 1} \quad (\delta \ge 0).$$
Differentiating either branch with respect to $\delta$ gives the density $\tfrac{1}{2} (\eta_m + 1)(1 - \lvert \delta \rvert)^{\eta_m}$ on $[-1, 1)$. Dividing by the range $x_U - x_L$ converts it to a density of $x' = x + \delta (x_U - x_L)$: $(\eta_m + 1)(1 - \lvert \delta \rvert)^{\eta_m} / (2 (x_U - x_L))$.
The shapes have practical consequences. The figure script computes them from the densities and checks them against a million samples of each operator:
- Inside or outside the parents. Under BLX-0.5, half the children land outside the interval between the parents, a quarter on each side, and the children are spread evenly. Under SBX the share between the parents is also exactly one half, because contracting and expanding crossovers are equally likely. But the children concentrate near the parents. With $\eta = 2$, a child lands within 0.5 of the midpoint 3.5 exactly when $\beta \le 2 \times 0.5 / 3 = 1/3$, which has probability $F(1/3) = 0.5\,(1/3)^3 = 0.019$. It lands within $[1, 6]$ when $\beta \le 2 \times 2.5 / 3 = 5/3$, with probability $F(5/3) = 1 - 0.5\,(5/3)^{-3} = 0.892$.
- Two centers, not a compromise. SBX treats the two parents as two centers. When they are far apart, the children stay near one or the other. SBX does not average two solutions into a compromise between them, as arithmetic recombination does.
- Clipping is common. Polynomial mutation of $x = 3$ in $[0, 10]$ with $\eta_m = 2$ sends a mutant outside the range with probability $0.5 (0.7)^3 + 0.5 (0.3)^3 = 0.185$. The first term is the chance of $x' < 0$, that is $\delta < -0.3$, which the cumulative distribution above gives as $\tfrac{1}{2}(1 - 0.3)^3$. The second is the chance of $x' > 10$, that is $\delta > 0.7$, which is $\tfrac{1}{2}(1 - 0.7)^3$. So the clipping mentioned above is not a corner case: clipped mutants pile up on the bound. With $\eta_m = 20$ the same two terms, with exponent 21, give 0.0003. Two-thirds of the mutants move by less than 0.5: that is $\lvert \delta \rvert < 0.05$, with probability $1 - 0.95^{21} = 0.659$.
Permutations
Many combinatorial problems, such as the traveling salesman problem and job scheduling, ask for an ordering. A permutation representation needs operators that always produce permutations, which, as the opening example showed, one-point crossover does not. The examples below use the opening's parents
P1 = 1 2 3 4 5 6 7 8 9 P2 = 9 3 7 8 2 6 5 1 4
and the segment from position 4 to position 7.
Partially mapped crossover (PMX)
Partially mapped crossover (Goldberg and Lingle, 1985) copies a segment from one parent and fills the rest from the other parent at the same positions. It repairs duplicates through the correspondence that the segment defines. The child starts with P1's segment, 4 5 6 7, at positions 4 to 7. Every other position takes P2's value at that position, unless that value is already in the segment:
- Positions 1, 2 and 8 take P2's values 9, 3 and 1, which are not in the segment.
- Position 3 would take 7, which is already present. In the segment, P1's 7 sits at position 7, where P2 has 5, so 7 maps to 5. But 5 is also in the segment: P1's 5 sits at position 5, where P2 has 2, so 5 maps to 2. The value 2 is not in the segment, and position 3 takes 2.
- Position 9 would take 4, which is already present. P1's 4 sits at position 4, where P2 has 8, so 4 maps to 8. The value 8 is not in the segment, and position 9 takes 8.
The chain always ends, and the child is always a permutation. Each step replaces a value of P1's segment by P2's value at the same position, so different values are replaced by different values. The chain cannot return to its starting value: P2 holds that value outside the segment, while every later value of the chain is one P2 holds inside it. A chain that repeated any other value would, traced back one step at a time, have to repeat its starting value too. So the chain leaves the segment's values after at most as many steps as the segment is long. It ends on a value that P2 holds inside the segment and P1's segment lacks. Traced backward, a chain is determined by its end, so two positions never receive the same value. The script confirms on 10,000 random pairs that every PMX child is a permutation.
The child is 9 3 2 4 5 6 7 1 8. PMX is also often implemented as a sequence of swaps: start from a copy of P2 and, for each position in the segment, swap P1's value into that position. The script checks that the two implementations give identical children on 10,000 random pairs of permutations. PMX keeps values at the positions they had in a parent. Outside the segment, this child agrees with P2 at three of the five positions.
Order crossover (OX)
Order crossover keeps relative order instead of absolute position. Davis (1985) described its precursor while applying adaptive algorithms to bin packing with list encodings. Keep a parent's list up to a random break point, and order the remaining items as they appear in the other parent. In his example, (3 1 2 6 4 5) broken after its second item and crossed with (4 1 6 5 2 3) gives (3 1 4 6 5 2). The same paper used scramble mutations, which shuffle a segment of the list.
The two-point version found in textbooks (Eiben and Smith, 2015, ch. 4) copies P1's segment to the child. It then fills the remaining positions with the values of P2 in the order they appear in P2, skipping values already present. Both the filling and the reading start after the segment and wrap around to the front. Reading P2 from position 8 onward gives 1 4 9 3 7 8 2 6 5. Removing 4, 5, 6 and 7 leaves 1 9 3 8 2, which fills positions 8, 9, 1, 2 and 3:
| Read from P2 (position) | Value | Already in child? | Placed at |
|---|---|---|---|
| 8 | 1 | no | 8 |
| 9 | 4 | yes, skip | |
| 1 | 9 | no | 9 |
| 2 | 3 | no | 1 |
| 3 | 7 | yes, skip | |
| 4 | 8 | no | 2 |
| 5 | 2 | no | 3 |
| 6 | 6 | yes, skip | |
| 7 | 5 | yes, skip |
The child is 3 8 2 4 5 6 7 1 9. Outside the segment it agrees with P2 at only one position, but the cities from P2 appear in P2's cyclic order.
The demo below builds the children of PMX, OX and the cycle crossover of the next section one step at a time, for the article's parents or for random ones, and for any segment.
PMX keeps positions only partly. Cycle crossover keeps every value at a position one parent gave it.
Cycle crossover (CX)
PMX's repairs move values to positions neither parent used: in the PMX child, 2 sits at position 3 and 8 at position 9, where neither parent had them. Cycle crossover, which Cicirello (2023) credits to Oliver, Smith and Holland (1987), keeps every value at a position where one of the parents had it.
The idea is that positions come in groups that must be inherited together. Start at position 1 and follow the chain of forced choices:
- If the child takes P1's value at position 1, which is 1, it cannot also take P2's value there, 9. So 9 must come from P1 too, from position 9, where P1 has it.
- At position 9 P2 has 4, which then also has to come from P1, at position 4.
- There P2 has 8, which P1 holds at position 8.
- There P2 has 1, and the walk is back where it began.
Positions 1, 9, 4 and 8 form a cycle. The child takes all four from P1, or all four from P2, or it duplicates a value. Repeating the walk from the first position not yet visited finds the other cycles. For the article's parents there are three:
| Cycle | Walk through the positions | Values |
|---|---|---|
| 1 | 1 → 9 → 4 → 8 → 1 | 1, 9, 4, 8 |
| 2 | 2 → 3 → 7 → 5 → 2 | 2, 3, 7, 5 |
| 3 | 6 → 6 | 6 (the parents agree) |
The cycles are the cycles of the permutation that maps each position to the position in P1 of P2's value there. The cycles of a permutation partition the set it acts on, so every position lies in exactly one cycle. Any choice of parent per cycle gives a valid permutation, for this reason. Within one cycle, P2's value at each position is P1's value at the next position of the walk. So the two parents hold the same set of values at the cycle's positions, in different places. Whichever parent a cycle is copied from, it supplies that same set of values, and the sets of different cycles do not overlap. The child therefore holds every value exactly once. In the common form of the operator, the first child takes the odd-numbered cycles from P1 and the even-numbered ones from P2, and the second child the reverse. Here the first child takes cycles 1 and 3 from P1 and cycle 2 from P2:
position 1 2 3 4 5 6 7 8 9
child 1 1 3 7 4 2 6 5 8 9
child 2 9 2 3 8 5 6 7 1 4
Cicirello (2023) describes a variant that picks one cycle at random and exchanges only that cycle between the parents. Either way, CX has no segment and no cut points: the parents alone decide the cycles. When the parents differ everywhere in one long cycle, the children are copies of the parents.
The three children of P1 and P2 inherit different things. The figure script counts two things for each child: the positions at which it agrees with a parent, and the edges of the closed tour that also appear in a parent. An edge is a pair of adjacent cities, with the last city adjacent to the first.
| Child | Positions agreeing with P1 | With P2 | Tour edges found in a parent |
|---|---|---|---|
| PMX, 9 3 2 4 5 6 7 1 8 | 4 | 4 | 6 of 9 |
| OX, 3 8 2 4 5 6 7 1 9 | 5 | 2 | 6 of 9 |
| CX, 1 3 7 4 2 6 5 8 9 | 5 | 5 | 5 of 9 |
Position 6 holds 6 in both parents, so it counts toward both columns. Only the CX child has every position from a parent (5 + 5 − 1 = 9). None of the three inherits all of its edges. That is the gap that edge-based operators, designed for the traveling salesman problem, aim to close (Cicirello, 2023).
Which property matters depends on the problem. In a schedule, the absolute position of a job may carry the meaning, which suits PMX or CX. In a symmetric traveling salesman tour, what counts is which cities are adjacent, and a tour has no fixed starting position. That suits operators that preserve order or adjacency.
Permutation mutations
Each of these turns a permutation into another permutation. Applied to 1 2 3 4 5 6 7 8 9:
- Swap exchanges two values. Swapping positions 2 and 5 gives 1 5 3 4 2 6 7 8 9.
- Insert moves one value to another position, shifting the values between. Moving 5 to just after 2 gives 1 2 5 3 4 6 7 8 9.
- Inversion reverses a segment. Reversing positions 2 to 5 gives 1 5 4 3 2 6 7 8 9.
- Scramble shuffles a segment. One possible result for positions 2 to 5 is 1 4 2 5 3 6 7 8 9.
Example (edges changed by a swap and by an inversion). Read each result as a closed tour. The inversion of positions 2 to 5 changes fewer edges than the swap of positions 2 and 5. It removes only the edges 1-2 and 5-6 at the ends of the segment and adds 1-5 and 2-6; the edges inside are the same pairs, traversed backward. The swap removes four edges (1-2, 2-3, 4-5 and 5-6) and adds four (1-5, 5-3, 4-2 and 2-6). For a symmetric tour, inversion is a small change in the sense that matters. It is the 2-opt move of hill climbing. The same move drives the simulated annealing and tabu search examples on the TSPLIB instance kroA100 and its first 12 cities in escaping local optima.
The counts in the example are the general ones. A swap changes the two edges on either side of each swapped value, at most four. An insert changes at most three: the two beside the moved value's old place merge into one, and one edge at the new place splits into two. The move of 5 above removes 4-5, 5-6 and 2-3 and adds 4-6, 2-5 and 5-3. Both operators leave the relative order of all the other values unchanged. An inversion changes at most the two edges at the ends of its segment (none, for example, when the segment is the whole tour but one city), and it reverses the order inside the segment. Scramble preserves only the values outside the segment.
Exploration and exploitation
Every operator above has a parameter that sets how far children land from their parents:
- the number of cut points, and the mask probability, for bit-string crossover;
- $\alpha$ in BLX, and $\eta$ in SBX and polynomial mutation;
- $\sigma$ in Gaussian mutation, and $p_m$ for bit flips.
Large steps explore, sampling new regions; small steps exploit, refining what has been found. Neither is good on its own. An operator that always lands far from its parents ignores the information that selection has gathered. One that always lands close cannot leave the neighborhood of a local optimum, the problem described in escaping local optima.
Two observations from the examples help in choosing. First, operators whose step scales with the distance between parents, such as SBX and BLX-α, adjust automatically as the population converges. Fixed-step mutations such as Gaussian mutation with constant $\sigma$ do not. Second, variation and selection have to be balanced together. A disruptive operator can tolerate strong selection, while gentle operators combined with strong selection lead to premature convergence. The course's own genetic algorithms used two-point crossover with probability 0.9 and mutation at rate $1/L$ or $1/N$. How those choices played out is measured in the De Jong functions article and the bin-packing article.
What we have learned
A variation operator must respect its representation. On bit strings, one-point, two-point and uniform crossover exchange the same bits but separate two fixed positions with very different probabilities, from $\delta/(L-1)$ for one cut to one half at any distance for a uniform mask. On OneMax, mutation at $0.5/L$ to $1/L$ found the optimum in every run, no mutation stalled at 88, and $2/L$ or more settled into a mutation-selection balance below the optimum. On real vectors, SBX places children symmetrically about the parents' mean, most often near the parents themselves, with a spread that shrinks as the population converges. On permutations, PMX, OX and CX each keep a different property of the parents: positions, relative order, or a parent's position for every value.
The disruption counts lead to the unit's theory. One-point crossover keeps short patterns of bits together and breaks long ones. Holland argued that this explains why a genetic algorithm works: short, good patterns spread and combine. Holland's schema theorem states his argument as a bound, tests it, and reports the limits later theory found in it.
References
- Cicirello, V. A. (2023). A survey and analysis of evolutionary operators for permutations. In Proceedings of the 15th International Joint Conference on Computational Intelligence (IJCCI 2023), 288–299. SciTePress. record
- Davis, L. (1985). Applying adaptive algorithms to epistatic domains. In Proceedings of the Ninth International Joint Conference on Artificial Intelligence (IJCAI-85), 162–164. record
- Deb, K., and Agrawal, R. B. (1995). Simulated binary crossover for continuous search space. Complex Systems, 9(2), 115–148. record · 3 pages
- Deb, K., and Beyer, H.-G. (2001). Self-adaptive genetic algorithms with simulated binary crossover. Evolutionary Computation, 9(2), 197–221. record
- Deb, K., and Goyal, M. (1996). A combined genetic adaptive search (GeneAS) for engineering design. Computer Science and Informatics, 26(4), 30–45. record
- Droste, S., Jansen, T., and Wegener, I. (2002). On the analysis of the (1+1) evolutionary algorithm. Theoretical Computer Science, 276(1–2), 51–81. record · 5 pages
- Eiben, A. E., and Smith, J. E. (2015). Introduction to Evolutionary Computing, 2nd ed., chapter 4. Springer. record · 35 pages
- Eshelman, L. J., Caruana, R. A., and Schaffer, J. D. (1989). Biases in the crossover landscape. In Proceedings of the Third International Conference on Genetic Algorithms, 10–19. Morgan Kaufmann. record
- Eshelman, L. J., and Schaffer, J. D. (1993). Real-coded genetic algorithms and interval-schemata. In L. D. Whitley (ed.), Foundations of Genetic Algorithms 2, 187–202. Morgan Kaufmann. record
- Goldberg, D. E., and Lingle, R. (1985). Alleles, loci, and the traveling salesman problem. In Proceedings of the First International Conference on Genetic Algorithms and Their Applications, 154–159. record
- Oliver, I. M., Smith, D. J., and Holland, J. R. C. (1987). A study of permutation crossover operators on the traveling salesman problem. In Proceedings of the Second International Conference on Genetic Algorithms and Their Application, 224–230. Lawrence Erlbaum. record
- Syswerda, G. (1989). Uniform crossover in genetic algorithms. In Proceedings of the Third International Conference on Genetic Algorithms, 2–9. Morgan Kaufmann. record
- Wright, A. H. (1991). Genetic algorithms for real parameter optimization. In G. J. E. Rawlins (ed.), Foundations of Genetic Algorithms, 205–218. Morgan Kaufmann. record
Reviewed: verified, 16 Nov 2026 · citations checked, 16 Nov 2026 · editorial review, 23 Nov 2026 · 10 revisions