Customizing Mutation in Your Framework

Learn how to modify our mutation function to incorporate it into our framework.

Incorporating mutation into the framework

Just like in the chapter Selecting the Best, and the chapter Generating New Solutions, we’ll need to slightly modify our framework to allow us to customize mutation hyperparameters. These hyperparameters are mutation strategy and mutation rate.

In this lesson, we’ll create a mutation toolbox and modify our framework in order to easily customize mutation in our algorithms.

Creating the toolbox

First, create a mutation toolbox, jjust like the one in which we created a selection and crossover toolbox. Over here, we create a new file in toolbox called mutation.ex.

Next, we create the Toolbox.Mutation module, like this:

Get hands-on with 1400+ tech skills courses.