Subject: | |
From: | |
Reply To: | |
Date: | Fri, 7 Jun 2013 09:52:47 +0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Jun 6, 2013, at 8:23 PM, Bojan Janisch wrote:
> is there a way to set probabilities to a GPNode. So that this GPNode may occur
> with a probability of X percent in the GPTree. The background to my question is
> that I have a GPNode called "not" for my rules. Like the name says it negates
> a condition for example "not Object()" means that there has to be no objects in
> session.
There is no way to guarantee the probability of appearance of nodes in a tree. And if you think about it the general case is impossible: how would you guarantee that all leaf nodes appear with 0% probability, for example? Strong typing also seriously complicates the issue.
However you can hack things. First, you'll need a tree builder which generates nodes with a certain node probability distribution. The best choice here is PTC2 (which ECJ has). Second, you'll need to figure out how to guarantee that crossover and/or mutation operators guarantee this distribution. This is much harder.
In general I would recommend against trying to guarantee node distribution during breeding: you're very seriously constraining what kinds of trees you can generate.
Sean
|
|
|