I am using DEAP to resolve a problem using a genetic algorithm. I need to create a custom function to generate the individuals. This function checks the values inside in order to append 0 or 1.
Now I'm trying to register this function on the toolbox.
The function I have written is called individual_creator(n), n=IND_SIZE and it returns a vector [].
After creating individuals as a list:
creator.create("Individual", list, fitness=creator.FitnessMin)
I registered individual and population on my toolbox like the following:
toolbox.register("individual", individual_creator, creator.Individual, n=IND_SIZE)
toolbox.register("population", tools.initRepeat, list, toolbox.individual)
Using this code this error appeared: TypeError: individual_creator() got multiple values for argument 'n'
Registering individual without using n parameter doesn't work either:
toolbox.register("individual", individual_creator, creator.Individual)
TypeError: 'type' object cannot be interpreted as an integer
Could someone please help me? I need to create custom individuals using my function and then create the population.
Thank you in advance!