Print

Print


Gabriel is correct, but it will only work if you set this *before*  
the mutator's setup() method is called -- when it loads its  
parameters that is.

Since you want to do this once per generation, you need to actually  
change the instance variable that the mutator relies on.  This will  
depend on the particular mutator you're using.  You have three major  
options:

1. Let the mutator determine the mutation value on the fly based on  
the generation number (it has access to state.generation).  You'll  
need to make a custom mutator for sure this way.

Or

2. Change some mutation variable in the mutator PROTOTYPE (you'll  
need to hunt through the pipeline to find it), perhaps in some  
statistics object's pre-breeding-statistics method.  Here you'll need  
to make a statistics object which knows how to search through the  
entire prototype breeding tree.

Or

3. Create a statistics object which changes some standard variable  
located somewhere which a custom mutator looks up when it's run.  It  
don't suggest this.

I suggest #1 fairly strongly.  It's what ECJ's good at.

Sean


On Feb 20, 2008, at 8:57 AM, Gabriel Catalin Balan wrote:

> Use ParameterDatabase's "set" method
>
> public final synchronized void set(Parameter parameter, String value)
>
>
> Gabriel
>
>
> On Wed, 20 Feb 2008, ghada wrote:
>
>> Hi all,
>>
>>
>>
>> I need to set the mutation rate inside my program (and not in  
>> the .params
>> file) , to be able to make it dynamic with the generation number -  
>> for
>> example to start with a low mutation rate that gets higher as the  
>> generation
>> number increases. Any idea how to do that in the ECJ?
>>
>>
>>
>> Best regards
>>
>> Ghada
>>
>>