ECJ-INTEREST-L Archives

December 2007

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:
Thu, 6 Dec 2007 23:52:31 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
There are lots of possible places.  But my top choice: in the setup()  
method of your Problem.  Problem is a Prototype, so one Problem will  
be instantiated, then setup() will be called on it, then clone() will  
be called on it many times and ECJ will use the clones.  If you wish  
all your Problem instances to share your data, then put it in an  
instance variable during setup(), and don't touch the variable during  
clone().  If you wish your Problem instances to have their own  
copies, then copy the variable to the cloned object during clone().    
Be sure to call super.clone().  See Prototype for more info.

Sean

On Dec 6, 2007, at 11:04 PM, Michael B Sullivan wrote:

> Hi All,
>
> I have a simple question: What would be the best way to have some  
> initialization code called at the beginning of an ECJ run (before  
> the evaluation threads are spawned)?
>
> I have an evaluation function which requires data to be loaded into  
> memory before the first time it is run.  Currently, I have it such  
> that the data is loaded upon the first time it is called, but I  
> could load the data through an initialization function (or some  
> equivalent), if necessary.
>
> My problem is that a multithreaded ECJ run will call the function  
> multiple times before the data is fully loaded into memory,  
> resulting in ugly results for the first couple evaluations.
>
> If this issue doesn't fit nicely into the ECJ world view, I can fix  
> it with mutex locks, etc.  However, if there's an easy way to  
> execute code at the beginning of an ECJ run, I would love to hear it.
>
> Thanks!
> Mike

ATOM RSS1 RSS2