Implementing Common Selection Strategies

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

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Customizing Selection in Your Framework | TOC | What You Learned 👉

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 strategies you’ll learn about in this section are:

  • Elitism selection
  • Random selection
  • Tournament selection
  • Roulette selection

You’ll see how these strategies work, what each of their drawbacks are, and how to implement them in Elixir so you 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, you can counteract the lack of diversity with mutation, large populations, and even large…

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.