2

Is there a way in DEAP to use more than one mutation or more than one crossover with their own probability?

The algorithms expect 'mate' and 'mutate' to be registered in the toolbox.

I can technically create my own function that chooses which mutation to use based on a random value and pass it as the operator.

But I am wondering if there's a way to do it with the library. All the examples I've seen uses one mutation operator and one crossover operator.

Thanks

T.J.
  • 61
  • 5
  • 1
    Not really. You'd need to at least: define your own algorithm, or override `algorithms.varAnd` or `algorithms.varOr`. Maybe you could get creative with [tool decoration](https://deap.readthedocs.io/en/master/tutorials/basic/part2.html#tool-decoration) but I suspect that would be convoluted. – Michael Ruth May 31 '21 at 19:25
  • thanks @MichaelRuth One easy solution I am using now is to write a wrapper around the mutation and crossover function, that basically takes the same parameters as all operators and then choose which mutation to use based on probability that I specify. And I am passing this mutation wrapper as the mutation. So far it is working. But the I don't know how it will play with all the other features like logging and history – T.J. Jun 01 '21 at 14:43
  • However, any idea why the design of the library limits to one mutation and one crossover? from EA literature perspective, I don't think that's common to do. Maybe I am wrong. – T.J. Jun 01 '21 at 14:46
  • Unfortunately, deep is not very customizable, but it doesn't require much time to divi into it and modify it, as the code is quite simple and not sophisticated. – nbro Jul 01 '21 at 21:02

0 Answers0