Hello,
I've been using DEAP for one of my research projects and it's been working great. Thank you for developing such a wonderful code library!
I'm looking to implement multiple mutation operators in my DEAP GP algorithm. For example, I may want a mutUniform, a mutInsert, or a mutShrink to happen during a mutation all with equal probability. What is the proper way to implement this mutation scheme? Currently, I have it coded as follows:
toolbox.register('expr_mut', gp.genFull, min_=0, max_=2)
def random_mutation_operator(individual):
'''
Randomly picks a replacement, insert, or shrink mutation.
'''
roll = random.random()
if roll <= 0.333333:
return gp.mutUniform(individual, expr=toolbox.expr_mut, pset=pset)
elif roll <= 0.666666:
return gp.mutInsert(individual, pset=pset)
else:
return gp.mutShrink(individual)
toolbox.register('mutate', random_mutation_operator)
but that feels a bit "hacky." Is there a built-in way to do this?
Best regards,
Randy Olson