Subject: | |
From: | |
Reply To: | |
Date: | Tue, 11 Feb 2014 15:15:44 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Tomas, ECJ does not have built-in support for nonterminals with variable numbers of children, but it has sufficient hooks that you can do it yourself. The big issue is in the tree-generation algorithms: all of the built-in tree generators assume fixed and predefined numbers of node constraints. This means you'll need to create your own tree-generation algorithm.
Assuming your tree-generation algorithm is ignoring the tree constraints, you can then set the GP tree's number of children to CHILDREN_UNKNOWN in your particular GPNode.
Sean
On Feb 11, 2014, at 12:44 PM, Tomas nikima <[log in to unmask]> wrote:
> I want to define a non-terminal node in GP that can have different number of
> children. For example, in a case it has two children, and in another case 5
> children. However, it must have at least one child.
>
> I tried to define a constrain with no size, but it does not work.
>
> #No size is set
> gp.nc.1 = ec.gp.GPNodeConstraints
> gp.nc.1.name = undefinedChildren
> gp.nc.1.returns = nil
>
> Please let me know how can I define a node capable of having different
> number of children.
>
> Thanks.
> Tomas.
|
|
|