June 2012


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
Sean Luke <[log in to unmask]>
Reply To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Fri, 29 Jun 2012 16:43:18 -0400
text/plain (27 lines)
On Jun 28, 2012, at 5:36 AM, Andreas Meier wrote:

> I just replaced the lines as you have stated, but now, I get
> NullPointerExceptions sometimes.

Sorry, my bad.  I wasn't setting the Fitness.  Anyway, I forgot there's a more proper ECJ method for creating a blank new Individual.  Try this line:

DoubleVectorIndividual v = 
	(DoubleVectorIndividual)(state.population.subpops[subpop].species.newIndividual(state, thread));

> Regarding the randomness. I tried to reproduce it and this error does not
> occur in single-threaded runs. However, if I use multiple threads, the
> results of repeated runs differ. Is this behavior related to the thread
> scheduling of the operating system? Is it possible to force a thread
> synchronization so that repeated runs of multi-threaded problems always
> deliver the same results?

Well first things first: at present the DE package cannot do multithreaded breeding at all -- it simply ignores that parameter.  Thus the only thing that could be causing the problem is multithreaded evaluation.  However ECJ's evaluator breaks the subpopulation into chunks, one per thread, in a deterministic way, and then hands each chunk to a thread to evaluate with its own random number generator.  This means that there are only two possibilities:

	1. a bug in ECJ
	2. a race condition bug in your evaluation code which is causing you to use the same RNG or some other common variable from multiple threads.

The ECJ threading code is pretty simple and has been banged on a lot.  So before we look into #1 as a possibility (and it's always a possibility), you might check to see if your evaluation code has any race conditions.  In particular, are you using random[thread] or are you doing something like random[0]?