ECJ-INTEREST-L Archives

February 2008

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced 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:
Sun, 3 Feb 2008 13:43:05 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (90 lines)
I've not done this with ECJ but it should work (ECJ *should* be  
entirely self-contained by now).  I might suggest that you create the  
nested parameter database one time and then reuse it over and over  
again rather than loading from the file each time.  That is, assuming  
your implementation doesn't change any parameters programmatically.

If you change parameters programmatically, or need to adjust a  
parameter each time you set up the new EvolutionState, there's a hack  
you might be able to use to do that.  Parameter Databases have parent  
databases, which have parent databases, and so on.  When you set a  
parameter programmatically, it's set in the root database -- the  
parents are untouched.  So in theory you should be able to load a  
ParameterDatabase:

ParameterDatabase parent = Evolve.loadParameterDatabase(
	new String[] { Evolve.A_FILE, "my_param_file.params" });

... and then reuse it by making a new ParameterDatabase which points  
to it as a parent, like this:

ParameterDatabase data;
data = new ParameterDatabase(parent);

... and then do it again for aanother child, etc.:

data = new ParameterDatabase(parent);

... allowing you to change parameters in the 'data' database, sort of  
as a wrapper.

However, there doesn't *exist* a ParameterDatabase constructor of the  
kind I just described.  Yet.  I don't have time to hack one up right  
now but it should be pretty dang easy, along the lines of:

public ParameterDatabase(ParameterBase parent)
	{
	this();
	parents.addElement(parent);
	}

Sean



On Feb 3, 2008, at 5:36 AM, Michael Hart wrote:

> Hi Anais,
>
> This works for me:
>
> ----
>
> ParameterDatabase problemParams = Evolve
>     .loadParameterDatabase(new String[] { Evolve.A_FILE,
>         "my_param_file.params" });
>
> EvolutionState problemState = Evolve.initialize(problemParams, 0);
>
> ----
>
> Cheers,
>
> Michael
>
> On 02/02/2008, at 12:19 AM, Anais Martínez wrote:
>
>> Hi. I'm trying to make a GA problem in which each evaluation of  
>> individuals
>> is other GA. I've followed the example in this list of GA nested  
>> GP, but it
>> doesn't work.
>>
>> My code is:
>>
>> ---
>> File  f = new File("ec/app/EC/EC.params");
>> try{
>>    dataB = new ParameterDatabase(f);
>>    }catch(Exception e){
>> System.out.println(e);
>>   }
>>
>> state2 = Evolve.initialize(dataB,ECRandomOffset++);
>> ---
>> when it is executed, dataB has got all parameters of EC.params,  
>> but state2
>> doesn't. Where is the mistake?
>>
>> Thank you.

ATOM RSS1 RSS2