Experimenting with the algorithm’s settings
We can now experiment with the various settings and definitions we placed into the program and observe any changes in their behavior and results.
In each of the following subsections, we’ll start from the original program settings and make one or more changes. You are encouraged to experiment with making your own modifications, as well as combining several modifications to be made to the same program.
Bear in mind that the effects of changes we make may be specific to the problem at hand – a simple OneMax, in our case – and may be different for other types of problems.
Population size and number of generations
We will start our experimentation by making modifications to the population size and the number of generations used by the genetic algorithm:
- The size of the population is determined by the
POPULATION_SIZE
constant. We will start by increasing the value of this constant from 200 to 400...