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

Added generic GP with value types support #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tomerf
Copy link
Contributor

@tomerf tomerf commented Oct 1, 2012

GP tree can now define value types to nodes in the tree.
It now support building trees with mixed types, like integers and booleans.

@tomerf
Copy link
Contributor Author

tomerf commented May 25, 2013

Yes, that's exactly what my patch does. I already forgot about it, so now I need to reverse engineer it. Or not, apparently I also posted the modifications and explanation on the pyevolve google group :)
What I do is detect the function prefix by the input/output types and set a different prefix for each combo, e.g.:

ga.setParams(gpi_terminals = ['x', 'y', 'ephemeral:random.randint(-10,10)',
gpii_function_prefix = "gp_i_",
gpbi_function_prefix = "gp_i2b_",
gpbb_function_prefix = "gp_b_")

The first character is the output type and the second is the input type. So, in this example the first prefix is from integer ('i') to integer ('i'), the second is from input integer ('i') to output boolean ('b') and the last is boolean ('b') to boolean ('b').

It is also "invisible" if one doesn't want to define multiple types, since the default type has an empty prefix ('') so it shouldn't break any existing programs that use pyevolve.

I haven't figured what how to mix multiple input types, it's just the basic framework and should be extended. And probably be more user friendly before...

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

Successfully merging this pull request may close these issues.

2 participants