Search code examples
pythonrandomtheanogenetic-algorithmgenetic-programming

How to initialize a genetic algorithm (GA) with a specific population in Python


The following equations show a randomly initial population for a genetic algorithm by Python.
toolbox.register("attr_bool", random.randint, 0, 1)

toolbox.register("individual", tools.initRepeat, creator.Individual, toolbox.attr_bool, 100)

toolbox.register("population", tools.initRepeat, list, toolbox.individual)

The question is how to initialize the population with a specific matrix? I am not interested in starting a GA with randomly initialization.


Solution

  • The best answer found in "https://groups.google.com/forum/#!topic/deap-users/B_KaNroEJjE". It is from Google group