Print

Print


Hey Sean, thanks for your fast response!

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

Deletion would be an option, but how do I delete a GPTree while evaluation? I did not find any informations about manually removing GPTrees in the manual. Do you got an example?

> 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;
> 			}
> 		}

The problem is, I cannot check for something semantically. Only after the GPTree is interpreted as a rule, I could check and say that I can run the rule with my rule engine. Which means even if I check for some syntactically criteria, I don't know if this rule is useless or not, because I have to compare the results of the rule to get a score which tells me how good this rule is.

I wanted to create a breeder, which checks for this score and then decides what to do with the GPTree. 
Is there a way to get the fitness of an individual?

Greetings

Bojan

----- Urspr√ľngliche Mail -----
Von: "Sean Luke" <[log in to unmask]>
An: [log in to unmask]
Gesendet: Montag, 15. Juli 2013 09:13:52
Betreff: Re: AW: Writing a Breeder

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