Implementing Common Mutation Strategies

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

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Customizing Mutation in Your Framework | TOC | Other Methods to Combat Convergence 👉

You’ll likely only ever need to work with a few mutation strategies depending on the genotype of your solutions. The mutation strategy you use has less of an impact on your algorithm than, say, crossover strategy or selection strategy. The presence of mutation matters more — so long as the mutation strategy you choose maintains the validity of your solutions.

In this section, you’ll learn how to implement three different types of mutation that you can use for binary, permutation, and real-value genotypes. At the end of this section, you’ll find a list of other common mutation strategies to research and implement on your own.

Flip Mutation

Flip mutation, also known as bit flip mutation, is the type of mutation proposed in the Holland’s original genetic algorithm. It’s simple and effective on binary genotypes. Flip mutation “flips” some or all of the bits in the chromosome. So, if a gene is a 1, it’s flipped to a 0. If a gene is a 0, it’s flipped to a 1.

The following image depicts flip mutation:

images/PreventingPrematureConvergence/FlipMutation.png

--

--

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.