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.
|