Implementing Common Selection Strategies

Learn how different selection strategies can be implemented in Elixir.

Common selection strategies

Balancing genetic diversity with strong solutions can be difficult to achieve without a smart selection strategy. Fortunately, there are common selection strategies that are battle-tested and proven to work well for many different problem sets.

The selection strategies we’ll learn about in this course are the following:

  • Elitism selection

  • Random selection

  • Tournament selection

  • Roulette selection

We’ll see how these strategies work, what each of their drawbacks are, and how to implement them in Elixir so we can add them to your toolbox.

Elitism selection

Elitism selection is the simplest and most common selection strategy. The idea is simple: choose the best n chromosomes to reproduce. Elitism selection gives preference to the most elite chromosomes.

The problem with elitism selection is that it doesn’t factor genetic diversity into the mix at all. It’s common with elitism selection that your algorithms will converge onto a strong solution quickly but fail to improve from that point on because your population is too similar. Fortunately, we can counteract the lack of diversity with mutation, large populations, and even large chromosomes.

The algorithm behind elitism selection is straightforward. Given a population of sorted chromosomes, select the n best. The image shown below should help to visualize elitism selection:

Get hands-on with 1200+ tech skills courses.