DEAP / deap

Distributed Evolutionary Algorithms in Python
http://deap.readthedocs.org/
GNU Lesser General Public License v3.0
5.88k stars 1.13k forks source link

gp.generate sucks #650

Closed TheMightiestCarrot closed 2 years ago

TheMightiestCarrot commented 2 years ago

Hi,

I have a situation where i dont want to create terminal of a specific type (type which can be only achieved as a result of another primitive) and on the other hand i have a primitive that requires terminal of a type which doesnt have its own primitive. With pset like this gp.generate raises an error. To make it work i am forced to create redundant terminals and primitives like this: pset.addPrimitive(identity, [int], int) pset.addTerminal(True, bool) which then leads to redundant situations like this: 'if_then_else(True, identity(identity(identity(5))), 6)'

TheMightiestCarrot commented 2 years ago

alright this guy has solved it https://gist.github.com/macrintr/9876942