luca-scr / GA

An R package for optimization using genetic algorithms
http://luca-scr.github.io/GA/
91 stars 29 forks source link

In runif(object@popSize, min[j], max[j]) : NAs produced #13

Closed JasonCEC closed 6 years ago

JasonCEC commented 6 years ago

Under certain conditions, the population will be filled with NA values instead of truncated.

I think it should just drop the remainder of the population that it can't generate a sampling of; so if pipSize is set to 100, and runif(object@popSize, min[j], max[j]) can only produce a sampling of 50, it should drop the remaining 50 with a warning.

JasonCEC commented 6 years ago

This is actually not a problem in GA; it is caused when min is greater than max in runif(...). Perhaps we can check for that in the ga function?