I would have probably gone another way to do this:
the evaluation procedure would compute f1, then
changed the ADF1 tree with a constant, computed and recorded f2 and then
replaced ADF2 with a constant, ..., then put the original ADFs back inside
This way you dont allocate arrays, and the fake/backup/contingency/what-if
ADFs would be reused (right?) from individual to individual.
Never mind this, though. Unless somebody gets the gotcha off the top of
his head, sent me the code (and .params file) and I'll debug it for you
On Fri, 1 Jun 2007, Mehdi Khoury wrote:
> Just trying to contribute by adding one small tutorial to write individuals
> in a file in a simple and quick fashion (no need to use statistic or
> complicated stuff) with ECJ.
> For those interested, see at :
> I also have a specific problem, and I am really banging my head on walls
> with this one...
> Any help would be greatly appreciated :)
> On individual is composed of ADFs the following way:
> | | |
> ADF1 ADF2 ADF3
> ADF2 can reuse as a terminal ADF1, and ADF3 can reuse ADF1 and ADF2.
> I evaluate the fitness f1 of an individual the normal way, and return my
> global fitness at the top of the tree.
> I also want to record what would be the fitness f2 of the individual if ADF1
> was equal to a different value.
> Similarly, I would also like to record what would be the fitness f3 of the
> individual if ADF1 and ADF2 were equal to different values.
> To be able to do that, my GPNode functions and terminals are returning an
> array of values (as extension of GPData ) instead of just one value. Each
> cell in the array correspond to one different scenario for a fitness value.
> My problem is the following: every normal operator and terminal return the
> right thing. Except the ADFs !! I want every ADFs terminal to return an
> array of values:
> - one value being the normal calculated value resulted from the generated tree
> - other values being new input values that I choose to substitute.
> I guess something must be done in the eval() method at the level of one of
> the ADFs classes : either ADF, or ADFArgument or ADFContext.
> I am a bit confused about how to proceed, though...
> Any Idea ?
> Best regards.
> Mehdi Khoury