Tournament size and relation to mutation probability

Once again, we start by changing back to the original settings of the program before we make new modifications:

  1. We will first modify the tournamentSize parameter of the tournament selection algorithm to 2 (instead of the original value of 3):
toolbox.register("select", tools.selTournament, tournsize=2)

This does not seem to have a noticeable effect on the algorithm's behavior:

Stats of the program solving the OneMax problem, after decreasing the tournament size to two
  1. What if we increase the tournament size to a very large value, say 100? Let's see:
toolbox.register("select", tools.selTournament ...

Get Hands-On Genetic Algorithms with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.