Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about the height of gp tree #731

Open
cghsncg opened this issue Nov 5, 2023 · 1 comment
Open

question about the height of gp tree #731

cghsncg opened this issue Nov 5, 2023 · 1 comment

Comments

@cghsncg
Copy link

cghsncg commented Nov 5, 2023

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 !

@Mujtaba1986
Copy link

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)) `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants