MIT
MIT

Reputation: 17

Difference between DEAP fitness and fitness.value

For the following code, why does printing out ind.fitness and printing out ind.fitness.values returns the same exact output. Does it mean the method is the same or is there any difference?

for ind, fit in zip(pop, fitnesses):
        #print(ind, fit)
        ind.fitness.values = fit
        print("Fitness", ind.fitness)
        print(ind.fitness.values)

Upvotes: 1

Views: 164

Answers (1)

Oren
Oren

Reputation: 5309

ind.fitness is an object that has different functions, variables etc.. It was implemented so that printing this object will print the variable "values" which is a variable in this object. enter image description here

Upvotes: 1

Related Questions