Print

Print


Hmm.  That is odd, because, from what I can see, ECJ only calls the Gene.reset() method via the VectorSpecies class—so state.population.subpops[0].species should not be null at the time your method is called.

If you share your parameter file and the code for your reset() method I can see if any obvious issue jumps out to me as the cause for the NPE.

On Thu, Dec 29, 2016 at 4:08 PM, Enzo Fabbiani <[log in to unmask]> wrote:
Eric,

I was able to get access to problem information by adding those sentence in my code in the reset function (not setup), but I'm getting null pointer exception when trying to retrieve the Species object.

2016-12-28 21:54 GMT-03:00 Eric 'Siggy' Scott <[log in to unmask]>:
Enzo,

Were you able to solve your problem?  Or could you still use assistance?

The usual way to access information in another class when initializing an object in ECJ is to use the global EvolutionState object to walk through the program's state and find what you want.

So, in the 'setup()' method of your BusProblemLine class, you would retrieve the Species object with something like this:

final GeneVectorSpecies species = (GeneVectorSpecies) state.population.subpops[0].species;

On Mon, Dec 19, 2016 at 9:11 AM, Enzo Fabbiani <[log in to unmask]> wrote:

Hi there, I'm facing some trouble when trying to initialize population.


My custom class BusProblemLine (which extends from Gene) implements reset function.

In order to do that, some problem information is needed. This info is read from files and loaded into atributes in the setup function in GeneVectorSpecies and can be accessed from evaluate function in my problem class.

How can I access to this information in BusProblemLine to initialize the population (as well as mutate and crossover).

I've tried to read data in the reset function but it explodes for out of memory. What is more, it gets initializing more times than the population size, is this ok?

Regards,
Enzo



--

Ph.D student in Computer Science, George Mason University
CFO and Web Director, Journal of Mason Graduate Research




--

Ph.D student in Computer Science, George Mason University
CFO and Web Director, Journal of Mason Graduate Research
http://mason.gmu.edu/~escott8/