I want to use more than one mutation method in GP, for example both mutUniform and mutEmphemeral. But all the algorithm can only receive one parameter. Is there method can solve this?
Asked
Active
Viewed 43 times
1 Answers
0
Assuming you have already defined mutUniform
and mutEmphemeral
, you can define a new mutation function that runs both mutations, and register that new function to your toolbox.
This would look something along the lines of
def mutMyWay(individual, mutpb, uniform_parameters, emphemeral_parameters):
if random.random()<mutpb:
individual = mutUniform(individual, *uniform_parameters)
individual = mutEmphemeral(individual, *emphemeral_parameters)
toolbox.register('mutate', mutMyWay)

usernumber
- 1,958
- 1
- 21
- 58