ECJ-INTEREST-L Archives

February 2006

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Proportional Font
Show HTML 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:
Tue, 7 Feb 2006 10:28:27 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (38 lines)
Each thread clones its own separate Problem instance.  So put it in  
your Problem subclass, and clone it when the Problem is cloned like  
this:

     MyClass myObject;  // or myObject = new ....    [see setup below]

     public void setup(final EvolutionState state,
                       final Parameter base)
         {
         super.setup(state,base);
	// make the myObject here, loaded from the database or
	// just created from scratch.  You could also just make
	// it in the default constructor or assign it at top
	}

     public Object protoClone() throws CloneNotSupportedException
         {
         Object returnval = super.protoClone();
         myObject = (MyClass)(myObject.clone());
         return returnval;
         }



On Feb 7, 2006, at 10:20 AM, Sandeep Mulgund wrote:

> I'm using multiple evaluation threads in my ECJ-based application.   
> The
> fitness function needs to use a class that doesn't seem to like  
> concurrent
> access from multiple threads.  Is there any way I can allocate one  
> instance
> of this class per eval thread, and if so, where would it go?
>
> Thanks
>
> Sandeep

ATOM RSS1 RSS2