I have to make correction in my error message which I introduced in my original message. Sorry for my mistake. Finally, I had the following error message after running the function 'genoud'.
Error in optim(foo.vals, fn = fn1, gr = gr1, method = optim.method, control = control) : non-finite finite-difference value [1] When I execute 'traceback()' to trace where the error occured, I got the following results. Unfortunately, I could not figure out what was the problem from the above information. 6: optim(foo.vals, fn = fn1, gr = gr1, method = optim.method, control = control) 5: function (foo.vals) { ret <- optim(foo.vals, fn = fn1, gr = gr1, method = optim.method, control = control) return(c(ret$value, ret$par)) }(c(0.220878697173384, -13.3643173824871)) 4: .Call("rgenoud", as.function(fn1), new.env(), as.integer(nvars), as.integer(pop.size), as.integer(max.generations), as.integer(wait.generations), as.integer(nStartingValues), as.real(starting.values), as.vector(P), as.matrix(Domains), as.integer(max), as.integer(gradient.check), as.integer(boundary.enforcement), as.double(solution.tolerance), as.integer(BFGS), as.integer(data.type.int), as.integer(provide.seeds), as.integer(unif.seed), as.integer(int.seed), as.integer(print.level), as.integer(share.type), as.integer(instance.number), as.integer(MemoryMatrix), as.integer(debug), as.character(output.path), as.integer(output.type), as.character(project.path), as.integer(hard.generation.limit), as.function(genoud.optim.wrapper101), as.integer(lexical), as.function(fnLexicalSort), as.function(fnMemoryMatrixEvaluate), as.integer(UserGradient), as.function(gr1func), as.real(P9mix), as.integer(BFGSburnin), as.integer(transform), PACKAGE = "rgenoud") 3: genoud(Qmin, nvars = 2, starting.values = InitVal, max.generations = 10, wait.generations = 3, n = n, yper = yper, pertype = pertype) at wFGN.R#75 ----- Wonsang You Leibniz Institute for Neurobiology -- View this message in context: http://r.789695.n4.nabble.com/How-to-fix-error-in-the-package-rgenoud-tp2993489p2993619.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.