I am using DEAP in Python, and use genetic algorithm there. The following is the definition of attributes(chromosome) with size of 100.
toolbox.register("attr_bool", random.randint, 0, 1)
The following expression creates a population with 300 sizes in which each individual column is a chromosome or a solution.
pop = toolbox.population(n=300)
The question is that how we can force pop to have a column (choromosom or solution) is all 1. By this way, I want to make sure that there is a solution with a vector of 1 in population.
Aucun commentaire:
Enregistrer un commentaire