Print

Print


On Dec 22, 2014, at 4:13 PM, Rodrigo Coelho Barros <[log in to unmask]> wrote:

> Im trying to build an EDA instead of a GA. I figured I could use the InitializationPipeline to always generate random individuals after each generation.
> Nevertheless, if my pipeline consists of the InitializationPipeline alone (that is, pop.subpop.0.species.pipe = ec.breed.InitializationPipeline, and nothing else), I get an error that "num-sources value must be > 0.

Weird: InitializationPipeline worked in the past, and yet that would have been impossible.  Your error report is completely right.

The issue is that BreedingPipeline.DEFAULT_SOURCES = 0.  So the logic followed for source loading is as follows:

if (numSources() == DEFAULT_SOURCES)  // this may return DEFAULT_SOURCES
    determine nummber of sources from the parameter file using "num-sources"
    if "num-sources" == 0, generate error
else 
    use numSources() as the number of sources
load the sources

The problem is that InitializationPipeline (properly) returns 0 for its numSources().  But since DEFAULT_SOURCES==0 this triggers BreedingPipeline to try loading the number of sources using num-sources.  Since you (properly) don't have a num-sources parameter, BreedingPipeline freaks out.

The fix is to set DEFAULT_SOURCES to -1.  I've added in a little bit of better checking code in BreedingPipeline to deal with this.

I also added in some more checking code in the two classes for which DEFAULT_SOURCES is relevant: MultipleVectorCrossoverPipeline and MultiBreedingPipeline, since it's now possible for num-sources=0 and they shouldn't permit that.

The result is out on SVN, go grab it.  Or if you like, here are the relevant changed files.