Reputation: 63
I'm experimenting with pygad. Have created initial population of lists of 0 and 1:
llist = [[random.randint(0,1) for _ in range(40)] for _ in range(10)]
my fitness functions does simple
sum(solution)
I'm trying to create model which will evolve list to contain only 1 i.e. [1,1,1,1.....1] as this is the best fitness for the population. However, results of the population are floats ranging from -2 to +15. Is there any way to restrict the solution values?
Is there any way to get solution to contain only list of 1 ?
Upvotes: 1
Views: 515
Reputation: 63
After looking into the documentation, it turns out that gen_type=int and gene_space=[0,1] does the trick!
Upvotes: 2