So far in this series on genetic algorithms, I've talked about encoding individuals and selection methods. The next task in a generic algorithm is to mate individuals using an operator called crossover.
Crossover produces two (or more) new individuals (children) from two (or more) existing individuals (parents). The idea behind crossover is twofold: Sharing of worthwhile traits allows for individuals to be created which inherit the best traits of their parents (optimization), and new combinations of traits may reveal as-yet-unexplored possibilities (search).
In this post I'll describe a few general crossover techniques. These approaches are not order preserving, meaning that they do not ensure that a viable solution is created when the solution involves the ordered traversal of genes (e.g., traveling from city to city for the TSP). If you want a good 10,000 foot overview of order preserving approaches (plus some nice graphic illustrations), I suggest starting with the Wikipedia page on crossover.
Single-point crossover creates two new individuals from two existing individuals - chosen via selection - by picking a single point in the chromosome string (usually at random), and swapping the contents of the two parents at the crossover point (vertical pipe, see below).
Multi-point crossover is exactly like single-point, except that more than one crossover point is chosen. This approach allows for more than two offspring to be created from two parents:
Uniform crossover gives every gene in a pair of selected individuals a constant probability of being swapped in the child. In this approach, there are 2^k-2 possible children available from 2 parents.
There are lots of other crossover techniques possible that I haven't discussed, and many of the contributions in genetic algorithms research is in new crossover operations for particular individual encoding schemes. There are as many possibilities as there are potential individual encodings.
Please feel free to leave me comments or reach out on Twitter or LinkedIn.
Crossover produces two (or more) new individuals (children) from two (or more) existing individuals (parents). The idea behind crossover is twofold: Sharing of worthwhile traits allows for individuals to be created which inherit the best traits of their parents (optimization), and new combinations of traits may reveal as-yet-unexplored possibilities (search).
In this post I'll describe a few general crossover techniques. These approaches are not order preserving, meaning that they do not ensure that a viable solution is created when the solution involves the ordered traversal of genes (e.g., traveling from city to city for the TSP). If you want a good 10,000 foot overview of order preserving approaches (plus some nice graphic illustrations), I suggest starting with the Wikipedia page on crossover.
Single-point Crossover
Single-point crossover creates two new individuals from two existing individuals - chosen via selection - by picking a single point in the chromosome string (usually at random), and swapping the contents of the two parents at the crossover point (vertical pipe, see below).
aaaaa | aaaaaaaaaaa Parent A
bbbbb | bbbbbbbbbbb Parent B
aaaaa | bbbbbbbbbbb Child AB
bbbbb | aaaaaaaaaaa Child BA
Multi-point Crossover
Multi-point crossover is exactly like single-point, except that more than one crossover point is chosen. This approach allows for more than two offspring to be created from two parents:
aaaaa | aaaaaa | aaaaa Parent A
bbbbb | bbbbbb | bbbbb Parent B
aaaaa | aaaaaa | bbbbb Child AAB
aaaaa | bbbbbb | aaaaa Child ABA
aaaaa | bbbbbb | bbbbb Child ABB
bbbbb | aaaaaa | aaaaa Child BAA
bbbbb | aaaaaa | bbbbb Child BAB
bbbbb | bbbbbb | aaaaa Child BBA
Uniform Crossover
Uniform crossover gives every gene in a pair of selected individuals a constant probability of being swapped in the child. In this approach, there are 2^k-2 possible children available from 2 parents.
There are lots of other crossover techniques possible that I haven't discussed, and many of the contributions in genetic algorithms research is in new crossover operations for particular individual encoding schemes. There are as many possibilities as there are potential individual encodings.
Please feel free to leave me comments or reach out on Twitter or LinkedIn.