On Jan 9, 2010, at 10:03 AM, Vlad Palnik wrote:
> As I understand ECJ it looks like each individual in a population
> has his
> own deep cloned copy of Problem. So with the way (TestProblem)problem
> is set up each problem will have different data and the data will
> at each fitness evaluation.
Not quite. When ECJ needs to evaluate a population, it first
determines how many threads it will use. Let's say there are N of
them. Then it divvies up the population among the N threads. Each
thread is responsible for evaluating its chunk of the population.
Each *thread* is given a deep-cloned Problem and uses that Problem to
evaluate its children. Typically the number of threads is 1, so
during evaluation all the individuals happen to use the same Problem
instance. After each generation, all the deep-cloned Problems are
> I would like to know if anyone has any idea on how to correctly set
> up resetNode(). As I understand the function is called every time a
> instance of TERC is created within an individual. By biggest concern
> is accessing the correct problem, the problem beloning to the
> of this.node so I can get to the right data. Also how would this work
> with multi threaded runs???
resetNode() isn't called during evaluation but rather, as you have
found, during initialization and mutation. If you need access to a
Problem in order to gather data to have resetNode() called properly,
the easiest approach would be to grab the Problem Prototype, located
in Evaluator, like this:
MyProblem p_problem = (MyProblem)(state.evaluator.p_problem);
Keep in mind that what you now have is NOT the Problem that will
actually be used to evaluate your individual, but rather the
*prototypical* Problem instance from which all other Problem instances
are cloned. It's supposed to be held in reserve so to speak, so don't
write anything in it -- just read.
Hope this helps a bit.