ecr2 icon indicating copy to clipboard operation
ecr2 copied to clipboard

ecr::evaluateFitness fails if package is not loaded

Open be-marc opened this issue 3 years ago • 1 comments

ecr::evaluateFitness fails if package is not loaded

objective_function = function(x) {
  sum(x)
}

ctrl = ecr::initECRControl(fitness.fun = objective_function, n.objectives = 1)

population = ecr::initPopulation(mu = 10, gen.fun = ecr::genBin, n.dim = 4)

fitness = ecr::evaluateFitness(ctrl, population)

> Error in parallelMap(function(x) do.call(fitness.fun, c(list(x), list(...))),  : 
   Level 'ecr.evaluateFitness' not registered

You can fix this by using .onLoad() instead of .onAttach in https://github.com/jakobbossek/ecr2/blob/53adbfb50253ceaeecd4af7d3bba106add092950/R/zzz.R#L17

With greetings from Michel

be-marc avatar Jul 20 '20 13:07 be-marc

Hi Marc,

thanks for the report. We already figured this one out in #130. Going to fix this soon.

Cheers, Jakob

jakobbossek avatar Jul 21 '20 13:07 jakobbossek