ECJ-INTEREST-L Archives

December 2007

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Proportional Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Sean Luke <[log in to unmask]>
Reply To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Date:
Mon, 17 Dec 2007 23:26:04 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (60 lines)
The job mechanism is intended to allow you to fiddle with parameters  
based on job information, but you have to override a hook manually.   
You can either:

	- make your own main() method, or add code to the existing one and  
recompile.  This isn't remotely so bad as it sounds, just look at the  
existing Evolve.main method and there's a spot where you can add your  
code.  You can tell the job number (it's an integer called, oddly,  
'job').

	- override EvolutionState.startFresh() in your own EvolutionState  
subclass (or scribble it into EvolutionState, where startFresh() is  
empty).  This is my suggested hook.  Here the job number will be an  
Integer stored in the instance variable self.job[0]

Either way, you can change parameters in the ParameterDatabase by  
just calling state.parameters.set(new Parameter(key), value), where  
key is a String representing the parameter key, and value is the  
String you want to set it to.  Let's say you want to change  
pop.subpop.0.duplicate-retries=100 when the job number is more than  
4.  You might write something like:

package this.is.my.package;
import ec.util.*;
import ec.simple.*;
public class MyEvolutionState extends SimpleEvolutionState   /*  
assuming you're using that */
	{
	public void startFresh()
		{
		super.startFresh();
		int job = ((Integer)(self.job[0])).intValue();
		if (job > 4)
			self.parameters.set(new Parameter("pop.subpop.0.duplicate- 
retries"), "100");
		else
			self.parameters.set(new Parameter("pop.subpop.0.duplicate- 
retries"), "0");
		}
	}

... now you just change your EvolutionState parameter in your  
parameter file:

	state =  this.is.my.package.MyEvolutionState

Or something like that.

Sean

On Dec 17, 2007, at 7:49 PM, [log in to unmask] wrote:

> Hi,
> I was wondering if it were possible to change the parameter values  
> for each job. Currently I have the Job number set to 3 and was  
> wondering if I could then have three different values for the max- 
> gene variable, a different variable for each job?
>
> Thanks in advance.

ATOM RSS1 RSS2