Open cghsncg opened 11 months ago
Do it like this `# bloat control: LIMIT_TREE_HEIGHT = 50 toolbox.decorate("mate", gp.staticLimit(key=operator.attrgetter("height"), max_value=LIMIT_TREE_HEIGHT)) toolbox.decorate("mutate", gp.staticLimit(key=operator.attrgetter("height"), max_value=LIMIT_TREE_HEIGHT))
toolbox.decorate("mate", gp.staticLimit(key=len, max_value=limitLength)) toolbox.decorate("mutate", gp.staticLimit(key=len, max_value=limitLength)) `
I use the code "toolsbox.decorate("mate", gp.staticLimit(key=operator.attrgetter("height"), max_value=12))" to set the limit of the tree but when I use the code "toolsbox.mate(child1, child2)" after many steps, deap shows that "Error in tree evaluation : Python cannot evaluate a tree higher than 90. To avoid this problem, you should use bloat control on your operators." Is there any where ,I need to add new hight limit code? Thanks a lot !