Exploring Crossover

Genetic Algorithms in Elixir — by Sean Moriarity (51 / 101)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Solving N-Queens with Order-One Crossover | TOC | Implementing Other Common Crossover Strategie s 👉

With the N-queens problem, you saw how much choosing the correct crossover strategy can affect your algorithms. Now, you need to develop an understanding of what crossover is and how it works.

Crossover is analogous to reproduction — the process of combining the genes of two chromosomes to create new chromosomes. The idea is that solutions will combine to create even better solutions — like how evolution slowly optimizes organisms to adapt and become stronger in their environment.

While the parallels between biological reproduction and crossover are neither perfect nor sound, you can better understand crossover if you have a general understanding of biology. In biology, traits are passed down to children from parents. These traits, for example, include hair color, eye color, and muscle composition. If both parents possess the same traits, the child is more likely to inherit those traits from their parents.

Now, imagine two sets of parents. One set of parents consists of two world-class distance runners. The other set of parents consists of two world-class weightlifters. Which set of parents is more likely to produce a better distance runner? The set of distance runners, because they possess and are more likely to pass on traits that contribute to success in distance running.

--

--