If I do this, I will implement a check() method for the Individual class you are using. (Assuming you have one tree for every individual) In this check method, I traverse through the tree and keep track of occurances of each kind of node. If the tree does not satisfy you condition. I will mark it as "bad". 
You can remove "bad" individuals from your population in many places. Maybe pre-breed or post-breed.
Other means are also possible, you don't need to strictly follow this.

On Tue, Feb 25, 2014 at 1:43 AM, Francisco Lopez de la Franca <[log in to unmask]> wrote:
But, how do I do that? I mean, where do I check (in the code) that the individual generated does not fulfill the requirement of appearing every node at least once?
Thanks a lot.


2014-02-24 19:56 GMT+01:00 Xiaomeng Ye <[log in to unmask]>:

Or you can simply discard any non-conformed individuals, during any process (initialization, breeding). And keep generating new individuals until your population is filled with the individuals conforming to this rule.


On Mon, Feb 24, 2014 at 1:13 PM, Sean Luke <[log in to unmask]> wrote:
Francisco, ECJ can't do this by default: and I really have no idea how to require this constraint.  You'll have to either enforce this rule in the tree builder algorithm and/or the crossover mutation operators.  Alternatively you can assess the fitness of non-confirming individuals as very low.

Sean

On Feb 24, 2014, at 6:57 AM, Francisco Lopez de la Franca <[log in to unmask]> wrote:

> Hello.
>
> I am new in ECJ. I'm going to use ECJ to find the solution of a second degree equation, that is, x=(-b+sqrt(b^2-4ac))/(2a).
> I've implemented as FunctionSet the following nodes: add, sub, sqrt, square, mul, div, neg, a, b, c, 2 and 4.
> I've followed the instructions described both in the tutorial4 in the documentations provided with ECJ and the one in the ECJ manual.
>
> What I need and donot find the way, is to force to appear in the result tree the nodes: a, b, c, 2, 4, -, +, sqrt, square, div and mul. That is, to specify in some manner that the nodes must appear at least once. Moreover, I'd like to know if it is possible to set that one node must appear a number of times in the solution.
>
> I hope to have explained well.
>
> Thank you very much in advance.
>
> Regards.