Print

Print


On Jul 14, 2013, at 2:46 AM, Bojan Janisch wrote:

> I don't want to evaluate useless rules. Also I don't want that these rules flow into my next generation. Because until now ECJ is only blind trying to find a good rule. It is not really an optimization of rules.

Why not delete them during the evaluation process?  You have to determine that they're useless somewhere, either after breeding or after evaluation.

> For this purpose I have to write a Breeder which can manipulate and mix a GPTree (that represents my rule). If  the result is worse than the originals it removes the created tree and tries again (until limit,  then using other GPTrees for mix)

I think what you're trying to do here is compare the child to the parent.  You could do this in a Breeder or possibly in a BreedingPipeline.  What I would do is override SimpleBreeder.breedPopChunk.  If you look at the code of this method you will note that it has a section that looks like this:

                x=from[subpop];
                int upperbound = from[subpop]+numinds[subpop];
                while(x<upperbound)
                    x += bp.produce(1,upperbound-x,x,subpop,
                        newpop.subpops[subpop].individuals,
                        state,threadnum);

I would just change that to something like:

	for(int x = from[subpop]; x < from[subpop]+numinds[subpop]; x++)
		{
		while(true)
			{
			bp.produce(1, 1, x, subpop, newpop.subpops[subpop].individuals, state, threadnum);
			if (newpop.subpops[subpop].individuals[x]) meets my criteria....
				break;
			}
		}

Watch out for infinite loops.  Note that this code forces the breeding pipelines to generate one child at a time; that is, the second child in each crossover will be discarded.

Sean