Thank you very much for your favor.
As you mentioned, I made my operators return tuples.
However, I still got an error message from the main function.
The error message is:
<ipython-input-194-167168659d53> in main()
57
58 # Select the next generation population from parents and offspring
---> 59 pop = toolbox.select(pop + offspring, MU)
60
61 # Compile statistics about the new population
~\Anaconda3\lib\site-packages\deap\tools\emo.py in selNSGA2(individuals, k, nd)
32 """
33 if nd == 'standard':
---> 34 pareto_fronts = sortNondominated(individuals, k)
35 elif nd == 'log':
36 pareto_fronts = sortLogNondominated(individuals, k)
~\Anaconda3\lib\site-packages\deap\tools\emo.py in sortNondominated(individuals, k, first_front_only)
74 map_fit_ind = defaultdict(list)
75 for ind in individuals:
---> 76 map_fit_ind[ind.fitness].append(ind)
77 fits = list(map_fit_ind.keys())
78
AttributeError: 'tuple' object has no attribute 'fitness'
The returns of my operators have this form:
toolbox.individual()
=>tuple of list
([2, 90, 910],
[4, 180, 1235],
[1, 20, 537],
[0, 10, 762],
[1, 280, 568],
[0, 170, 183])
toolbox.population(5)
=> list of tuples of list
[([2, 180, 698],
[0, 190, 1248],
[4, 100, 1107],
[3, 190, 807],
[4, 130, 234],
[2, 50, 835]),
([3, 190, 1002],
[0, 140, 561],
[1, 30, 665],
[3, 190, 834],
[3, 40, 759],
[2, 100, 1130]),
([3, 250, 1015],
[1, 90, 781],
[3, 310, 428],
[0, 210, 1151],
[4, 50, 182],
[1, 100, 92])]
I made the individual a tuple,
My population is a list.
creator.create("Individual", tuple , fitness=creator.FitnessMax)
creator.create("FitnessMax", base.Fitness, weights=(1.0, 1.0, -1.0))
creator.create("Individual", list , fitness=creator.FitnessMax)
Again, any help would be greatly appreciated.