Thank you for your prompt response Sean!
I should have mentioned that I only intend to modify ECJ's GP package so I
think it is easy enough to keep track of the "parent" (my final goal is to
see the impact of the new crossover strategy on program bloat)
I would like to think of it as follows (correct me if I'm wrong):
In the "produce" method of the class -say- "CrossoverPipeline", after all
of the constraints are checked, the newly created individuals (which are
created using a point-crossover) are added to the population in those last
lines of code (in the section that you have commented):

// add the individuals to the population
inds[q] = j1;

if (q<n+start && !tossSecondParent)
inds[q] = j2;

so basically the j1 and j2 individuals should be compared against
parents[0] and parents[1] and if they are fitter, then they are added to
"inds" array.
Am I on the right track?

On Wed, Jan 2, 2013 at 4:03 PM, Sean Luke <[log in to unmask]> wrote:

> Hi Mehran, it'd ordinarily be straightforward to create a BreedingPipeline
> object which produced an individual and returned it only if it was fitter
> than its parent.  The procedure would be to produce the individual from a
> child BreedingPipeline object, then clone a Problem instance from the
> Evaluator's Problem prototype, then test the individual and see how good it
> is.  But that's not the big problem.  The big problem is: what is the
> "parent"?
> ECJ allows arbitrarily complex breeding pipelines.  So you could have a
> child generated from a series of crossover and mutation objects involving,
> I dunno, 20 parents.  Who do you compare against?
> So let's say you've got that figured out.  Your next issue would be to
> figure out how to keep around the parent (or an index pointing to it in the
> population) so you know who to compare to.  ECJH doesn't pass that through
> its breeding pipelines, so we'd have to hack it.  The obvious hack would be
> to store in each Individual a pointer to its "parent", perhaps best as an
> index, not a real pointer.  Selection methods would store the index to the
> individual itself.  Crossover operators and mutation operators would decide
> which parent was the "parent" of the new child.  Then when it bubbled up to
> your BreedingPipeline object, you'd know what Individual to compare against.
> Sean
> On Jan 2, 2013, at 3:21 PM, Mehran Maghoumi wrote:
> > Hi,
> > I'm trying to add a feature to ECJ for a project. When doing a crossover
> or
> > mutation, I want to keep the resulting individuals only if their fitness
> is
> > better than that of their parents.
> > I pretty much know what I have to do and have pinpointed the location
> that
> > I would need to put my decision code in (in the produce method of the
> > CrossoverPipeline class for when the crossover is done)
> >
> > However, since the new individual has no fitness value associated with
> it, I
> > would need to somehow evaluate it at that early stage and toss it if its
> > fitness is not better than its parent. I know that the an Evaluator
> instance is
> > responsible for evaluating a population, but what should I do for a
> single
> > individual? What do you recommend?
> >
> > Thank you very much in advance.
> >
> > --
> > Mehran Maghoumi

Mehran Maghoumi