def evalKnapsack(individual):
weight = 0.0
value = 0.0
for item in individual:
weight += items[item][0]
value += items[item][1]
print items[item][0]
print items[item][1]
if len(individual) > MAX_ITEM or weight > MAX_WEIGHT:
return 10000, 0
return weight, value
--
You received this message because you are subscribed to the Google Groups "deap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# Update the statistics with the new population record = stats.compile(population) if stats is not None else {} max_ind = record['max'].item(0) for ind in population: if ind.fitness.values[0] == max_ind: print "MAX", ind break
But it did not go well.
Please tell me the solution