Print

Print


It's not built into ECJ, but it's a snap to implement.

- if you're trying to do (for example) maximum tree depth for  
children after crossover, then you just need to modify the maxDepth  
variable in the Crossover pipeline located in the breeding pipeline  
of your species.

- likewise for mutation operators, they typically have a similar  
maximum tree depth

- If your goal is to modify the tree depth of the generated tree for  
subtree mutation, it depends on the GPNodeBuilder you're using.  If  
you're just using Grow or Full or Ramped Half-and-half, then you can  
change the minSize and maxSize variables in your node builder.  The  
node builder is located in the 'builder' variable in your Mutation  
pipeline.

So when should you call this?  Remember that the pipelines are  
generated before each breeding stage.  So you want to modify the  
prototypes BEFORE breeding starts for each generation, else the  
pipelines will have been copied from the prototypes before you got to  
them.  You can modify them by doing any of:

- override Breeder.breedPopulation() to modify the pipeline prototype  
and THEN call super.breedPopulation()
- modify your pipeline's clone() method to change its own variable to  
what you want during cloning  [not recommended]
- add a statistics object which has implemented preBreedingStatistics 
(), and change the variable there
- override Evaluator.evaluatePopulation() to call  
super.evaluatePopulation() and then modify the pipeline prototype
- heck, you could just modify the prototype right in your  
Problem.evaluate() method.  This would modify the pipeline every time  
a single individual is evaluated, which is wasteful, but it'd  
probably not matter much timewise.

Sean



On Sep 11, 2007, at 9:34 AM, Loretta Macklem wrote:

> Hi,
>
> I have been using ECJ for about a year, and I want to implement  
> dynamically changing maximum tree depth using ECJ. I have been  
> looking around ECJ, and have not seen any existing mechanisms that  
> would do something like this. I just wanted to see if I was missing  
> something, or if I was correct that currently ECJ does not have  
> this feature, and I will have to create it. I realize to create it  
> I would just have to vary the parameter that controls maximum  
> depth, but I was wondering if there was something in ECJ that  
> perhaps would do this already.
>
> Thank you very much for your time,
>
> Loretta Macklem
> Graduate Teaching Assistant
> Michigan State University
> [log in to unmask]