January 2020
Intermediate to advanced
346 pages
9h 8m
English
The init.py file of the tools module contains several functions that can be useful for creating and initializing the population for the genetic algorithm. One particularly useful function is initRepeat(), which accepts three arguments:
For example, the following line of code will produce a list of 30 random numbers between 0 and 1:
randomList = tools.initRepeat(list, random.random, 30)
In this example, list is the type serving as the container to be filled, random.random is the generator function, and 30 is the number of times we ...
Read now
Unlock full access