jeffheaton / encog-java-core

http://www.heatonresearch.com/encog
Other
742 stars 268 forks source link

Genome constructor does not set the population reference #134

Closed fdietze closed 11 years ago

fdietze commented 11 years ago

I'm using the org.encog.ml.ea.train.basic.TrainEA class to implement a genetic algorithm. The Genome is a DoubleArrayGenome and one of the Operations is MutatePerturb. When iterating I get NullPointerExceptions in the second generation. I tracked this down to the fact that MutatePerturb is accessing the population to access the GenomeFactory. This fails, because The Factory calls the constructor of DoubleArrayGenome (same for IntegerArrayGenome) which only clones the Data, but does not set the population.

fdietze commented 11 years ago

I am setting the population now after every operation: https://github.com/encog/encog-java-core/pull/135