Closed welaunchcn closed 3 years ago
Generally, the N
is not a big number, right? If so, you can simply register multiple shift
but with different names. For example, shift1(a)
is equivalent to shift(a, 1)
, shift2(a)
is equivalent to shift(a, 2)
.
Yes that is the work around I'm using. The problem is that since we are having multiple instances for the same function, the creation of individuals tends to give much more weight to it.
Yes, you are right. I noticed this issue also for adding terminals. The reason is that each primitive is chosen according to a uniform distribution. Ideally, there should be a weight along with each primitive, but I don't have time to make it for now. You may fork this project and do it at your willingness.
A workaround is that, supposing you have added 5 versions of shift
, you can also add other functions 5 times as long as the name
parameter in add_function
is unique (see source).
Thanks for your help, I will try as your suggested.
For example, function shift(a, N) takes two parameters. The value for 'N' must be in the range of 1 to 5. The value comes from a random integer number directly, not from output of any other functions.
Is it possible to specify this kind of constraints?