CRAN Package Check Results for Package optimx

Last updated on 2019-12-15 09:46:47 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 2018-7.10 12.91 103.32 116.23 ERROR
r-devel-linux-x86_64-debian-gcc 2018-7.10 9.52 84.15 93.67 OK
r-devel-linux-x86_64-fedora-clang 2018-7.10 143.09 OK
r-devel-linux-x86_64-fedora-gcc 2018-7.10 136.68 OK
r-devel-windows-ix86+x86_64 2018-7.10 14.00 155.00 169.00 OK
r-devel-windows-ix86+x86_64-gcc8 2018-7.10 16.00 163.00 179.00 OK
r-patched-linux-x86_64 2018-7.10 10.93 99.29 110.22 OK
r-patched-solaris-x86 2018-7.10 164.00 ERROR
r-release-linux-x86_64 2018-7.10 11.17 99.63 110.80 OK
r-release-windows-ix86+x86_64 2018-7.10 20.00 114.00 134.00 OK
r-release-osx-x86_64 2018-7.10 ERROR
r-oldrel-windows-ix86+x86_64 2018-7.10 14.00 109.00 123.00 OK
r-oldrel-osx-x86_64 2018-7.10 ERROR

Check Details

Version: 2018-7.10
Check: examples
Result: ERROR
    Running examples in 'optimx-Ex.R' failed
    The error most likely occurred in:
    
    > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
    > ### Name: coef
    > ### Title: Summarize opm object
    > ### Aliases: coef<- coef.opm coef<-.opm coef.optimx coef<-.optimx
    > ### Keywords: nonlinear optimize
    >
    > ### ** Examples
    >
    > ans <- opm(fn = function(x) sum(x*x), par = 1:2, method="ALL", control=list(trace=0))
    This problem is unconstrained.
    Warning in optimr(par, fn, gr, hess = hess, method = meth, lower = lower, :
     Note: snewton needs gradient function specified
    Warning in optimr(par, fn, gr, hess = hess, method = meth, lower = lower, :
     Note: snewton needs Hessian function (hess) specified
    Warning in optimr(par, fn, gr, hess = hess, method = meth, lower = lower, :
     Note: snewtonm needs gradient function specified
    Warning in optimr(par, fn, gr, hess = hess, method = meth, lower = lower, :
     Note: snewtonm needs Hessian function specified
    Warning in optimr(par, fn, gr, hess = hess, method = meth, lower = lower, :
     Successful convergence Restarts for stagnation =0
    > print(coef(ans))
     p1 p2
    BFGS 2.228468e-13 -1.109715e-13
    CG -4.103643e-07 -8.207287e-07
    Nelder-Mead 1.274686e-04 1.447624e-04
    L-BFGS-B 7.623310e-21 -3.515189e-20
    nlm -3.558074e-17 1.766298e-17
    nlminb 2.953466e-31 9.870427e-31
    lbfgsb3 -2.838207e-11 -3.036971e-11
    Rcgmin NA NA
    Rtnmin NA NA
    Rvmmin NA NA
    snewton NA NA
    snewtonm NA NA
    spg -5.240253e-08 -5.595524e-08
    ucminf -4.356895e-09 -5.256497e-09
    newuoa 7.801992e-10 -5.695938e-10
    bobyqa 6.933067e-08 2.918226e-08
    nmkb 6.289555e-04 3.953361e-04
    hjkb 0.000000e+00 0.000000e+00
    hjn 0.000000e+00 0.000000e+00
    lbfgs NA NA
    subplex 2.818926e-17 -1.084202e-18
    >
    > ansx <- optimx(fn = function(x) sum(x*x), par = 1:2, control=list(all.methods=TRUE, trace=0))
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    optimx
     --- call from context ---
    optimx.run(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower,
     upper, optcfg$method, itnmax, hessian, optcfg$ctrl, ...)
     --- call from argument ---
    if (class(nhatend) != "try-error") {
     hessOK <- TRUE
    }
     --- R stacktrace ---
    where 1: optimx.run(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower,
     upper, optcfg$method, itnmax, hessian, optcfg$ctrl, ...)
    where 2: optimx(fn = function(x) sum(x * x), par = 1:2, control = list(all.methods = TRUE,
     trace = 0))
    
     --- value of length: 2 type: logical ---
    [1] TRUE TRUE
     --- function from context ---
    function (par, ufn, ugr = NULL, uhess = NULL, lower = -Inf, upper = Inf,
     method = c("Nelder-Mead", "BFGS"), itnmax = NULL, hessian = FALSE,
     ctrl, ...)
    {
     have.bounds <- ctrl$have.bounds
     ctrl$have.bounds <- NULL
     npar <- length(par)
     if (length(lower) == 1 && is.finite(lower))
     lower <- rep(lower, npar)
     if (length(upper) == 1 && is.finite(upper))
     upper <- rep(upper, npar)
     nmeth <- length(method)
     pstring <- names(par)
     if (is.null(pstring)) {
     pstring <- NULL
     for (j in 1:npar) {
     pstring[[j]] <- paste("p", j, sep = "")
     }
     }
     cnames <- c(pstring, "value", "fevals", "gevals", "niter",
     "convcode", "kkt1", "kkt2", "xtime")
     ans.ret <- matrix(NA, nrow = nmeth, ncol = npar + 8)
     colnames(ans.ret) <- cnames
     row.names(ans.ret) <- method
     ans.details <- list()
     ansout <- NULL
     for (i in 1:nmeth) {
     meth <- method[i]
     conv <- -1
     if (!is.null(itnmax)) {
     if (length(itnmax) == 1) {
     ctrl$maxit <- itnmax
     }
     else {
     if (length(itnmax) != nmeth) {
     stop("Length of itnmax =", length(itnmax),
     " but should be ", nmeth)
     }
     else {
     ctrl$maxit <- itnmax[i]
     }
     }
     if (ctrl$follow.on && (ctrl$trace > 0))
     cat("Do ", ctrl$maxit, " steps of ")
     }
     if (ctrl$trace > 0)
     cat("Method: ", meth, "\n")
     mcontrol <- ctrl
     mcontrol$follow.on <- NULL
     mcontrol$usenumDeriv <- NULL
     mcontrol$save.failures <- NULL
     mcontrol$kkt <- NULL
     mcontrol$starttests <- NULL
     mcontrol$all.methods <- NULL
     mcontrol$dowarn <- NULL
     mcontrol$kkttol <- NULL
     mcontrol$kkt2tol <- NULL
     mcontrol$maximize <- NULL
     mcontrol$badval <- NULL
     mcontrol$scaletol <- NULL
     ans.ret[i, "value"] <- .Machine$double.xmax
     if (meth == "Nelder-Mead" || meth == "BFGS" || meth ==
     "L-BFGS-B" || meth == "CG" || meth == "SANN") {
     if (have.bounds) {
     if (meth != "L-BFGS-B")
     stop("Bounds constraints for optim() require L-BFGS-B")
     else {
     time <- system.time(ans <- try(optim(par = par,
     fn = ufn, gr = ugr, lower = lower, upper = upper,
     method = meth, control = mcontrol, ...),
     silent = TRUE))[1]
     }
     }
     else {
     time <- system.time(ans <- try(optim(par = par,
     fn = ufn, gr = ugr, method = meth, control = mcontrol,
     ...), silent = TRUE))[1]
     }
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$convergence <- NULL
     ans$fevals <- ans$counts[1]
     ans$gevals <- ans$counts[2]
     ans$counts <- NULL
     }
     else {
     ans <- list(fevals = NA)
     ans$convcode <- 9999
     if (ctrl$trace > 0)
     cat("optim function evaluation failure\n")
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$fevals <- NA
     ans$gevals <- NA
     }
     ans$nitns <- NA
     }
     else if (meth == "nlminb") {
     mcontrol$iter.max <- mcontrol$maxit
     mcontrol$maxit <- NULL
     mcontrol$abs.tol <- 0
     if (is.null(mcontrol$trace) || is.na(mcontrol$trace) ||
     mcontrol$trace == 0) {
     mcontrol$trace = 0
     }
     else {
     mcontrol$trace = 1
     }
     time <- system.time(ans <- try(nlminb(start = par,
     objective = ufn, gradient = ugr, lower = lower,
     upper = upper, control = mcontrol, ...), silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$value <- ans$objective
     ans$objective <- NULL
     ans$fevals <- ans$evaluations[1]
     ans$gevals <- ans$evaluations[2]
     ans$evaluations <- NULL
     ans$nitns <- ans$iterations
     ans$iterations <- NULL
     }
     else {
     ans <- list(fevals = NA)
     ans$convcode <- 9999
     if (ctrl$trace > 0)
     cat("nlminb function evaluation failure\n")
     ans$value = ctrl$badval
     ans$objective <- NULL
     ans$par <- rep(NA, npar)
     ans$nitns <- NA
     ans$gevals <- NA
     ans$gevals <- NA
     ans$objective <- NULL
     ans$evaluations <- NULL
     ans$iterations <- NULL
     ans$message <- "nlminb failure"
     }
     ans$convergence <- NULL
     }
     else if (meth == "nlm") {
     if (!is.null(ugr)) {
     tufn <- function(x, ...) {
     res <- ufn(x, ...)
     attr(res, "gradient") <- ugr(x, ...)
     return(res)
     }
     }
     else {
     tufn <- ufn
     }
     if (!is.null(mcontrol$maxit)) {
     iterlim <- mcontrol$maxit
     mcontrol$maxit <- NULL
     }
     else {
     iterlim = 100
     }
     if (is.null(mcontrol$trace)) {
     print.level <- 0
     }
     else {
     print.level <- mcontrol$trace
     mcontrol$trace <- NULL
     }
     time <- system.time(ans <- try(nlm(f = tufn, p = par,
     ..., iterlim = iterlim, print.level = print.level),
     silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     if (ctrl$trace > 1) {
     cat("nlm output ans:\n")
     print(ans)
     }
     ans$convcode <- ans$code
     if (ans$convcode == 1 || ans$convcode == 2 ||
     ans$convcode == 3)
     ans$convcode <- 0
     if (ans$convcode == 4)
     ans$convcode <- 1
     ans$value <- ans$minimum
     ans$par <- ans$estimate
     ans$estimate <- NULL
     ans$minimum <- NULL
     ans$fevals <- NA
     ans$gevals <- NA
     ans$nitns <- ans$iterations
     ans$iterations <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("nlm failed for this problem\n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     else if (meth == "spg") {
     mcontrol$maximize <- NULL
     time <- system.time(ans <- try(BB::spg(par = par,
     fn = ufn, gr = ugr, lower = lower, upper = upper,
     control = mcontrol, ...), silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$fevals <- ans$feval
     ans$feval <- NULL
     ans$gevals <- NA
     ans$nitns <- ans$iter
     ans$iter <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("spg failed for this problem\n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     ans$convergence <- NULL
     }
     else if (meth == "ucminf") {
     if (is.null(ctrl$maxit))
     mcontrol$maxit <- 500
     mcontrol$maxeval <- mcontrol$maxit
     mcontrol$maxit <- NULL
     time <- system.time(ans <- try(ucminf::ucminf(par = par,
     fn = ufn, gr = ugr, control = mcontrol, ...),
     silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     if (ans$convcode == 1 || ans$convcode == 2 ||
     ans$convcode == 4) {
     ans$convcode <- 0
     }
     else {
     ans$convcode <- ans$convergence
     }
     ans$fevals <- ans$info[4]
     ans$gevals <- ans$info[4]
     ans$info <- NULL
     ans$nitns <- NA
     if (ctrl$trace > 0)
     cat("ucminf message:", ans$message, "\n")
     }
     else {
     if (ctrl$trace > 0)
     cat("ucminf failed for this problem\n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     ans$convergence <- NULL
     }
     else if (meth == "Rcgmin") {
     bdmsk <- rep(1, npar)
     mcontrol$trace <- NULL
     if (ctrl$trace > 0)
     mcontrol$trace <- 1
     tugr <- ugr
     if (is.null(ugr)) {
     tugr <- "grfwd"
     if (ctrl$trace > 0)
     cat("Rcgmin using grfwd\n")
     }
     if (have.bounds) {
     time <- system.time(ans <- try(Rcgminb(par = par,
     fn = ufn, gr = tugr, lower = lower, upper = upper,
     bdmsk = bdmsk, control = mcontrol, ...), silent = TRUE))[1]
     }
     else {
     time <- system.time(ans <- try(Rcgminu(par = par,
     fn = ufn, gr = tugr, control = mcontrol, ...),
     silent = TRUE))[1]
     }
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$fevals <- ans$counts[1]
     ans$gevals <- ans$counts[2]
     ans$counts <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("Rcgmin failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$fevals <- NA
     ans$gevals <- NA
     }
     ans$nitns <- NA
     ans$convergence <- NULL
     }
     else if (meth == "Rvmmin") {
     bdmsk <- rep(1, npar)
     mcontrol$trace <- NULL
     if (ctrl$trace > 0)
     mcontrol$trace <- ctrl$trace
     tugr <- ugr
     if (is.null(ugr)) {
     tugr <- "grfwd"
     if (ctrl$trace > 0)
     cat("Rvmmin using grfwd\n")
     }
     if (have.bounds) {
     time <- system.time(ans <- try(Rvmminb(par = par,
     fn = ufn, gr = tugr, lower = lower, upper = upper,
     bdmsk = bdmsk, control = mcontrol, ...), silent = TRUE))[1]
     }
     else {
     time <- system.time(ans <- try(Rvmminu(par = par,
     fn = ufn, gr = tugr, control = mcontrol, ...),
     silent = TRUE))[1]
     }
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$fevals <- ans$counts[1]
     ans$gevals <- ans$counts[2]
     }
     else {
     if (ctrl$trace > 0)
     cat("Rvmmin failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     }
     ans$nitns <- NA
     ans$convergence <- NULL
     }
     else if (meth == "lbfgsb3") {
     mcontrol$maxit <- NULL
     mcontrol$maxfeval <- NULL
     mcontrol$trace <- NULL
     mcontrol$iprint <- -1L
     if (ctrl$trace > 0) {
     mcontrol$trace <- 1
     mcontrol$iprint <- 1
     }
     time <- system.time(ans <- try(lbfgsb3::lbfgsb3(prm = par,
     fn = ufn, gr = ugr, lower = lower, upper = upper,
     control = mcontrol, ...), silent = TRUE))[1]
     if ((class(ans)[1] != "try-error")) {
     ans$convcode <- 0
     ans$fevals <- ans$info$isave[34]
     ans$gevals <- ans$fevals
     ans$value <- ans$f
     ans$par <- ans$prm
     ans$prm <- NULL
     ans$f <- NULL
     ans$info <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("lbfgsb3 failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$fevals <- NA
     }
     ans$nitns <- NA
     ans$convergence <- NULL
     }
     else if (meth == "bobyqa") {
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfun <- mcontrol$maxit
     }
     else {
     mcontrol$maxfun <- 5000 * round(sqrt(npar + 1))
     }
     mcontrol$iprint <- 0
     if (mcontrol$trace)
     mcontrol$iprint <- 1
     mcontrol$trace <- NULL
     time <- system.time(ans <- try(minqa::bobyqa(par = par,
     fn = ufn, lower = lower, upper = upper, control = mcontrol,
     ...), silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- 0
     if (ans$feval > mcontrol$maxfun) {
     ans$convcode <- 1
     }
     ans$fevals <- ans$feval
     ans$gevals <- NA
     ans$value <- ans$fval
     ans$nitns <- NA
     }
     else {
     if (ctrl$trace > 0)
     cat("bobyqa failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     else if (meth == "uobyqa") {
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfun <- mcontrol$maxit
     }
     else {
     mcontrol$maxfun <- 5000 * round(sqrt(npar + 1))
     }
     mcontrol$iprint <- 0
     if (mcontrol$trace)
     mcontrol$iprint <- 1
     mcontrol$trace <- NULL
     time <- system.time(ans <- try(minqa::uobyqa(par = par,
     fn = ufn, control = mcontrol, ...), silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- 0
     if (ans$feval > mcontrol$maxfun) {
     ans$convcode <- 1
     }
     ans$fevals <- ans$feval
     ans$gevals <- NA
     ans$value <- ans$fval
     ans$nitns <- NA
     }
     else {
     if (ctrl$trace > 0)
     cat("uobyqa failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     else if (meth == "newuoa") {
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfun <- mcontrol$maxit
     }
     else {
     mcontrol$maxfun <- 5000 * round(sqrt(npar + 1))
     }
     mcontrol$iprint <- 0
     if (mcontrol$trace)
     mcontrol$iprint <- 1
     mcontrol$trace <- NULL
     time <- system.time(ans <- try(minqa::newuoa(par = par,
     fn = ufn, control = mcontrol, ...), silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- 0
     if (ans$feval > mcontrol$maxfun) {
     ans$convcode <- 1
     }
     ans$fevals <- ans$feval
     ans$gevals <- NA
     ans$value <- ans$fval
     ans$nitns <- NA
     }
     else {
     if (ctrl$trace > 0)
     cat("newuoa failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     else if (meth == "nmkb") {
     if (any(par == lower) || any(par == upper)) {
     if (ctrl$trace > 0)
     cat("nmkb cannot start if on any bound \n")
     warning("nmkb() cannot be started if any parameter on a bound")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$fevals <- NA
     ans$gevals <- NA
     ans$nitns <- NA
     }
     else {
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfeval <- mcontrol$maxit
     }
     else {
     mcontrol$maxfeval <- 5000 * round(sqrt(npar +
     1))
     }
     mcontrol$maxit <- NULL
     if (mcontrol$trace > 0) {
     mcontrol$trace <- TRUE
     }
     else {
     mcontrol$trace <- FALSE
     }
     mcontrol$usenumDeriv <- NULL
     mcontrol$maximize <- NULL
     mcontrol$parscale <- NULL
     mcontrol$fnscale <- NULL
     if (have.bounds) {
     time <- system.time(ans <- try(dfoptim::nmkb(par = par,
     fn = ufn, lower = lower, upper = upper, control = mcontrol,
     ...), silent = TRUE))[1]
     }
     else {
     time <- system.time(ans <- try(dfoptim::nmk(par = par,
     fn = ufn, control = mcontrol, ...), silent = TRUE))[1]
     }
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$convergence <- NULL
     ans$value <- as.numeric(ans$value)
     ans$fevals <- ans$feval
     ans$feval <- NULL
     ans$gevals <- NA
     if (ans$fevals > mcontrol$maxfeval) {
     ans$convcode <- 1
     }
     ans$nitns <- NA
     ans$message <- NULL
     ans$restarts <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("nmkb failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$fevals <- NA
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     }
     else if (meth == "hjkb") {
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfeval <- mcontrol$maxit
     }
     else {
     mcontrol$maxfeval <- 5000 * round(sqrt(npar +
     1))
     }
     mcontrol$info <- FALSE
     if (mcontrol$trace > 0) {
     mcontrol$info <- TRUE
     }
     else {
     mcontrol$info <- FALSE
     }
     mcontrol$trace = NULL
     mcontrol$usenumDeriv <- NULL
     mcontrol$maximize <- NULL
     mcontrol$parscale <- NULL
     mcontrol$fnscale <- NULL
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfeval <- mcontrol$maxit
     }
     else {
     mcontrol$maxfeval <- 5000 * round(sqrt(npar +
     1))
     }
     mcontrol$maxit <- NULL
     if (have.bounds) {
     time <- system.time(ans <- try(dfoptim::hjkb(par = par,
     fn = ufn, lower = lower, upper = upper, control = mcontrol,
     ...), silent = TRUE))[1]
     }
     else {
     time <- system.time(ans <- try(dfoptim::hjk(par = par,
     fn = ufn, control = mcontrol, ...), silent = TRUE))[1]
     }
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     if (ans$convcode == 1)
     ans$convcode = 9999
     ans$convergence <- NULL
     ans$value <- as.numeric(ans$value)
     ans$fevals <- ans$feval
     ans$feval <- NULL
     if (ans$fevals > mcontrol$maxfeval) {
     ans$convcode <- 1
     }
     ans$gevals <- NA
     ans$nitns <- ans$niter
     ans$niter <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("hjkb failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     else {
     errmsg <- paste("UNDEFINED METHOD: ", meth, sep = "")
     stop(errmsg, call. = FALSE)
     }
     if (ctrl$trace > 0) {
     cat("Post processing for method ", meth, "\n")
     }
     if (exists("ans$message")) {
     amsg <- ans$message
     ans$message <- NULL
     }
     else {
     amsg <- "none"
     }
     ngatend <- NA
     nhatend <- NA
     hev <- NA
     if (ctrl$save.failures || (ans$convcode < 1)) {
     if (ctrl$trace && ans$convcode == 0)
     cat("Successful convergence! \n")
     hessOK <- FALSE
     gradOK <- FALSE
     if ((ctrl$kkt || hessian) && (ans$convcode != 9999)) {
     if (ctrl$trace > 0)
     cat("Compute Hessian approximation at finish of ",
     method[i], "\n")
     if (!is.null(uhess)) {
     nhatend <- try(uhess(ans$par, ...), silent = TRUE)
     if (class(nhatend) != "try-error") {
     hessOK <- TRUE
     }
     }
     else {
     if (is.null(ugr)) {
     nhatend <- try(hessian(ufn, ans$par, ...),
     silent = TRUE)
     }
     else {
     nhatend <- try(jacobian(ugr, ans$par, ...),
     silent = TRUE)
     }
     if (class(nhatend) != "try-error") {
     hessOK <- TRUE
     }
     }
     }
     ans$kkt1 <- NA
     ans$kkt2 <- NA
     if ((hessian || ctrl$kkt) && (ans$convcode != 9999)) {
     if (ctrl$trace > 0)
     cat("Compute gradient approximation at finish of ",
     method[i], "\n")
     if (is.null(ugr)) {
     ngatend <- try(grad(ufn, ans$par, ...), silent = TRUE)
     }
     else {
     ngatend <- try(ugr(ans$par, ...), silent = TRUE)
     }
     if (class(ngatend) != "try-error")
     gradOK <- TRUE
     if ((!gradOK) && (ctrl$trace > 0))
     cat("Gradient computation failure!\n")
     if (gradOK) {
     ans$kkt1 <- (max(abs(ngatend)) <= ctrl$kkttol *
     (1 + abs(ans$value)))
     if (hessOK) {
     bset <- sort(unique(c(which(ans$par <= lower),
     which(ans$par >= upper))))
     nbds <- length(bset)
     ngatend[bset] <- 0
     nhatend[bset, ] <- 0
     nhatend[, bset] <- 0
     if (!isSymmetric(nhatend, tol = sqrt(.Machine$double.eps))) {
     asym <- sum(abs(t(nhatend) - nhatend))/sum(abs(nhatend))
     asw <- paste("Hessian is reported non-symmetric with asymmetry ratio ",
     asym, sep = "")
     if (ctrl$trace > 1)
     cat(asw, "\n")
     if (ctrl$dowarn)
     warning(asw)
     if (ctrl$trace > 1)
     cat("Force Hessian symmetric\n")
     if (ctrl$dowarn)
     warning("Hessian forced symmetric", call. = FALSE)
     nhatend <- 0.5 * (t(nhatend) + nhatend)
     }
     hev <- try(eigen(nhatend)$values, silent = TRUE)
     if (ctrl$kkt) {
     if (class(hev) != "try-error") {
     if (any(is.complex(hev))) {
     hessOK <- FALSE
     cat("Complex eigenvalues found for method =",
     meth, "\n")
     cat("coefficients for function value",
     ans$value, " :\n")
     print(ans$par)
     dput(nhatend, file = "badhess.txt")
     warning("Complex eigenvalues found for method =",
     meth)
     }
     if (hessOK) {
     negeig <- (hev[npar] <= (-1) * ctrl$kkt2tol *
     (1 + abs(ans$value)))
     evratio <- hev[npar - nbds]/hev[1]
     ans$kkt2 <- (evratio > ctrl$kkt2tol) &&
     (!negeig)
     }
     }
     else {
     warnstr <- paste("Eigenvalue failure after method ",
     method[i], sep = "")
     if (ctrl$dowarn)
     warning(warnstr)
     if (ctrl$trace > 0) {
     cat("Hessian eigenvalue calculation failure!\n")
     print(nhatend)
     }
     }
     }
     }
     else {
     warnstr <- paste("Hessian not computable after method ",
     method[i], sep = "")
     if (ctrl$dowarn)
     warning(warnstr)
     if (ctrl$trace > 0)
     cat(warnstr, "\n")
     }
     }
     else {
     warnstr <- paste("Gradient not computable after method ",
     method[i], sep = "")
     if (ctrl$dowarn)
     warning(warnstr)
     if (ctrl$trace > 0)
     cat(warnstr, "\n")
     }
     }
     ans$xtimes <- time
     if (ctrl$trace > 0) {
     cat("Save results from method ", meth, "\n")
     print(ans)
     }
     if (ctrl$trace > 0) {
     cat("Assemble the answers\n")
     }
     ans.ret[meth, ] <- c(ans$par, ans$value, ans$fevals,
     ans$gevals, ans$nitns, ans$convcode, ans$kkt1,
     ans$kkt2, ans$xtimes)
     if (!gradOK)
     ngatend <- NA
     if (!hessOK) {
     nhatend <- NA
     hev <- NA
     }
     }
     ans.details <- rbind(ans.details, list(method = meth,
     ngatend = ngatend, nhatend = nhatend, hev = hev,
     message = amsg))
     row.names(ans.details)[[i]] >= meth
     if (ctrl$follow.on) {
     par <- ans$par
     if (i < nmeth && (ctrl$trace > 0))
     cat("FOLLOW ON!\n")
     }
     }
     ansout <- NULL
     if (length(ans$par) > 0) {
     ansout <- data.frame(ans.ret)
     attr(ansout, "details") <- ans.details
     }
     ansout
    }
    <bytecode: 0x49f0740>
    <environment: namespace:optimx>
     --- function search by body ---
    Function optimx.run in namespace optimx has this body.
     ----------- END OF FAILURE REPORT --------------
    Error in if (class(nhatend) != "try-error") { :
     the condition has length > 1
    Calls: optimx -> optimx.run
    Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 2018-7.10
Check: tests
Result: ERROR
     Running 'bdstest.R' [1s/2s]
     Running 'hobbs.R' [8s/9s]
     Running 'jonesrun.R' [4s/4s]
     Running 'maxfn.R' [1s/1s]
     Running 'rosenbrock.R' [5s/6s]
     Running 'run1param.R' [1s/1s]
     Running 'simplefuntst.R' [0s/1s]
     Running 'snsimple.R' [0s/1s]
     Running 'snwood.R' [1s/1s]
     Running 'ssqbtest.R' [2s/3s]
     Running 'tfnchk.R' [0s/1s]
     Running 'tgrchk.R' [0s/1s]
     Running 'tkktc.R' [0s/1s]
     Running 'trig1507.R' [7s/8s]
    Running the tests in 'tests/ssqbtest.R' failed.
    Complete output:
     > require(optimx)
     Loading required package: optimx
     > ssqb.f<-function(x){
     + nn<-length(x)
     + yy <- 1:nn
     + f<-sum((yy-x)^2)
     + f
     + }
     > ssqb.g <- function(x){
     + nn<-length(x)
     + yy<-1:nn
     + gg<- 2*(x - yy)
     + }
     > ssqb.h <- function(x){
     + nn<-length(x)
     + hh<- 2*diag(nn)
     + }
     > xx <- rep(pi, 4)
     > all4b <- opm(xx, ssqb.f, ssqb.g, hess=ssqb.h, method="ALL")
     This problem is unconstrained.
     Small gradient
     Warning message:
     In optimr(par, fn, gr, hess = hess, method = meth, lower = lower, :
     Successful convergence Restarts for stagnation =0
     > summary(all4b, order=value)
     p1 p2 p3 p4 value fevals gevals
     L-BFGS-B 1.0000000 2.000000 3.000000 4.000000 0.000000e+00 4 4
     nlminb 1.0000000 2.000000 3.000000 4.000000 0.000000e+00 4 3
     snewton 1.0000000 2.000000 3.000000 4.000000 0.000000e+00 2 2
     snewtonm 1.0000000 2.000000 3.000000 4.000000 0.000000e+00 5 5
     spg 1.0000000 2.000000 3.000000 4.000000 0.000000e+00 3 2
     lbfgs 1.0000000 2.000000 3.000000 4.000000 0.000000e+00 NA NA
     nlm 1.0000000 2.000000 3.000000 4.000000 1.972152e-31 NA 1
     lbfgsb3 1.0000000 2.000000 3.000000 4.000000 6.409495e-31 3 3
     subplex 1.0000000 2.000000 3.000000 4.000000 7.888609e-31 765 NA
     Rvmmin 1.0000000 2.000000 3.000000 4.000000 1.774937e-30 4 3
     ucminf 1.0000000 2.000000 3.000000 4.000000 2.415887e-30 4 4
     Rcgmin 1.0000000 2.000000 3.000000 4.000000 2.761013e-30 4 2
     BFGS 1.0000000 2.000000 3.000000 4.000000 3.451266e-30 6 3
     Rtnmin 1.0000000 2.000000 3.000000 4.000000 9.171569e-20 2 2
     hjn 1.0000000 2.000000 3.000000 4.000000 2.462186e-15 371 NA
     bobyqa 0.9999999 2.000000 3.000000 4.000000 2.118904e-14 71 NA
     newuoa 1.0000001 2.000000 3.000000 4.000000 7.432020e-14 53 NA
     CG 1.0000005 2.000000 3.000000 4.000000 3.229863e-13 15 8
     hjkb 0.9999987 1.999999 2.999999 3.999999 6.548641e-12 324 NA
     Nelder-Mead 1.0001164 1.999886 3.000012 3.999906 3.548762e-08 157 NA
     nmkb 1.0003126 2.000353 3.000301 4.000037 3.144460e-07 130 NA
     convergence kkt1 kkt2 xtime
     L-BFGS-B 0 TRUE TRUE 0.001
     nlminb 0 TRUE TRUE 0.001
     snewton 0 TRUE TRUE 0.002
     snewtonm 0 TRUE TRUE 0.000
     spg 0 TRUE TRUE 0.013
     lbfgs 0 TRUE TRUE 0.008
     nlm 0 TRUE TRUE 0.007
     lbfgsb3 0 TRUE TRUE 0.007
     subplex 0 TRUE TRUE 0.012
     Rvmmin 2 TRUE TRUE 0.005
     ucminf 0 TRUE TRUE 0.006
     Rcgmin 0 TRUE TRUE 0.002
     BFGS 0 TRUE TRUE 0.049
     Rtnmin 0 TRUE TRUE 0.004
     hjn 0 TRUE TRUE 0.007
     bobyqa 0 TRUE TRUE 0.003
     newuoa 0 TRUE TRUE 0.160
     CG 0 TRUE TRUE 0.001
     hjkb 0 TRUE TRUE 0.007
     Nelder-Mead 0 TRUE TRUE 0.002
     nmkb 0 TRUE TRUE 0.028
     >
     > all4bx <- optimx(xx, ssqb.f, ssqb.g, control=list(all.methods=TRUE))
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     optimx
     --- call from context ---
     optimx.run(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower,
     upper, optcfg$method, itnmax, hessian, optcfg$ctrl, ...)
     --- call from argument ---
     if (class(nhatend) != "try-error") {
     hessOK <- TRUE
     }
     --- R stacktrace ---
     where 1: optimx.run(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower,
     upper, optcfg$method, itnmax, hessian, optcfg$ctrl, ...)
     where 2: optimx(xx, ssqb.f, ssqb.g, control = list(all.methods = TRUE))
    
     --- value of length: 2 type: logical ---
     [1] TRUE TRUE
     --- function from context ---
     function (par, ufn, ugr = NULL, uhess = NULL, lower = -Inf, upper = Inf,
     method = c("Nelder-Mead", "BFGS"), itnmax = NULL, hessian = FALSE,
     ctrl, ...)
     {
     have.bounds <- ctrl$have.bounds
     ctrl$have.bounds <- NULL
     npar <- length(par)
     if (length(lower) == 1 && is.finite(lower))
     lower <- rep(lower, npar)
     if (length(upper) == 1 && is.finite(upper))
     upper <- rep(upper, npar)
     nmeth <- length(method)
     pstring <- names(par)
     if (is.null(pstring)) {
     pstring <- NULL
     for (j in 1:npar) {
     pstring[[j]] <- paste("p", j, sep = "")
     }
     }
     cnames <- c(pstring, "value", "fevals", "gevals", "niter",
     "convcode", "kkt1", "kkt2", "xtime")
     ans.ret <- matrix(NA, nrow = nmeth, ncol = npar + 8)
     colnames(ans.ret) <- cnames
     row.names(ans.ret) <- method
     ans.details <- list()
     ansout <- NULL
     for (i in 1:nmeth) {
     meth <- method[i]
     conv <- -1
     if (!is.null(itnmax)) {
     if (length(itnmax) == 1) {
     ctrl$maxit <- itnmax
     }
     else {
     if (length(itnmax) != nmeth) {
     stop("Length of itnmax =", length(itnmax),
     " but should be ", nmeth)
     }
     else {
     ctrl$maxit <- itnmax[i]
     }
     }
     if (ctrl$follow.on && (ctrl$trace > 0))
     cat("Do ", ctrl$maxit, " steps of ")
     }
     if (ctrl$trace > 0)
     cat("Method: ", meth, "\n")
     mcontrol <- ctrl
     mcontrol$follow.on <- NULL
     mcontrol$usenumDeriv <- NULL
     mcontrol$save.failures <- NULL
     mcontrol$kkt <- NULL
     mcontrol$starttests <- NULL
     mcontrol$all.methods <- NULL
     mcontrol$dowarn <- NULL
     mcontrol$kkttol <- NULL
     mcontrol$kkt2tol <- NULL
     mcontrol$maximize <- NULL
     mcontrol$badval <- NULL
     mcontrol$scaletol <- NULL
     ans.ret[i, "value"] <- .Machine$double.xmax
     if (meth == "Nelder-Mead" || meth == "BFGS" || meth ==
     "L-BFGS-B" || meth == "CG" || meth == "SANN") {
     if (have.bounds) {
     if (meth != "L-BFGS-B")
     stop("Bounds constraints for optim() require L-BFGS-B")
     else {
     time <- system.time(ans <- try(optim(par = par,
     fn = ufn, gr = ugr, lower = lower, upper = upper,
     method = meth, control = mcontrol, ...),
     silent = TRUE))[1]
     }
     }
     else {
     time <- system.time(ans <- try(optim(par = par,
     fn = ufn, gr = ugr, method = meth, control = mcontrol,
     ...), silent = TRUE))[1]
     }
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$convergence <- NULL
     ans$fevals <- ans$counts[1]
     ans$gevals <- ans$counts[2]
     ans$counts <- NULL
     }
     else {
     ans <- list(fevals = NA)
     ans$convcode <- 9999
     if (ctrl$trace > 0)
     cat("optim function evaluation failure\n")
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$fevals <- NA
     ans$gevals <- NA
     }
     ans$nitns <- NA
     }
     else if (meth == "nlminb") {
     mcontrol$iter.max <- mcontrol$maxit
     mcontrol$maxit <- NULL
     mcontrol$abs.tol <- 0
     if (is.null(mcontrol$trace) || is.na(mcontrol$trace) ||
     mcontrol$trace == 0) {
     mcontrol$trace = 0
     }
     else {
     mcontrol$trace = 1
     }
     time <- system.time(ans <- try(nlminb(start = par,
     objective = ufn, gradient = ugr, lower = lower,
     upper = upper, control = mcontrol, ...), silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$value <- ans$objective
     ans$objective <- NULL
     ans$fevals <- ans$evaluations[1]
     ans$gevals <- ans$evaluations[2]
     ans$evaluations <- NULL
     ans$nitns <- ans$iterations
     ans$iterations <- NULL
     }
     else {
     ans <- list(fevals = NA)
     ans$convcode <- 9999
     if (ctrl$trace > 0)
     cat("nlminb function evaluation failure\n")
     ans$value = ctrl$badval
     ans$objective <- NULL
     ans$par <- rep(NA, npar)
     ans$nitns <- NA
     ans$gevals <- NA
     ans$gevals <- NA
     ans$objective <- NULL
     ans$evaluations <- NULL
     ans$iterations <- NULL
     ans$message <- "nlminb failure"
     }
     ans$convergence <- NULL
     }
     else if (meth == "nlm") {
     if (!is.null(ugr)) {
     tufn <- function(x, ...) {
     res <- ufn(x, ...)
     attr(res, "gradient") <- ugr(x, ...)
     return(res)
     }
     }
     else {
     tufn <- ufn
     }
     if (!is.null(mcontrol$maxit)) {
     iterlim <- mcontrol$maxit
     mcontrol$maxit <- NULL
     }
     else {
     iterlim = 100
     }
     if (is.null(mcontrol$trace)) {
     print.level <- 0
     }
     else {
     print.level <- mcontrol$trace
     mcontrol$trace <- NULL
     }
     time <- system.time(ans <- try(nlm(f = tufn, p = par,
     ..., iterlim = iterlim, print.level = print.level),
     silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     if (ctrl$trace > 1) {
     cat("nlm output ans:\n")
     print(ans)
     }
     ans$convcode <- ans$code
     if (ans$convcode == 1 || ans$convcode == 2 ||
     ans$convcode == 3)
     ans$convcode <- 0
     if (ans$convcode == 4)
     ans$convcode <- 1
     ans$value <- ans$minimum
     ans$par <- ans$estimate
     ans$estimate <- NULL
     ans$minimum <- NULL
     ans$fevals <- NA
     ans$gevals <- NA
     ans$nitns <- ans$iterations
     ans$iterations <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("nlm failed for this problem\n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     else if (meth == "spg") {
     mcontrol$maximize <- NULL
     time <- system.time(ans <- try(BB::spg(par = par,
     fn = ufn, gr = ugr, lower = lower, upper = upper,
     control = mcontrol, ...), silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$fevals <- ans$feval
     ans$feval <- NULL
     ans$gevals <- NA
     ans$nitns <- ans$iter
     ans$iter <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("spg failed for this problem\n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     ans$convergence <- NULL
     }
     else if (meth == "ucminf") {
     if (is.null(ctrl$maxit))
     mcontrol$maxit <- 500
     mcontrol$maxeval <- mcontrol$maxit
     mcontrol$maxit <- NULL
     time <- system.time(ans <- try(ucminf::ucminf(par = par,
     fn = ufn, gr = ugr, control = mcontrol, ...),
     silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     if (ans$convcode == 1 || ans$convcode == 2 ||
     ans$convcode == 4) {
     ans$convcode <- 0
     }
     else {
     ans$convcode <- ans$convergence
     }
     ans$fevals <- ans$info[4]
     ans$gevals <- ans$info[4]
     ans$info <- NULL
     ans$nitns <- NA
     if (ctrl$trace > 0)
     cat("ucminf message:", ans$message, "\n")
     }
     else {
     if (ctrl$trace > 0)
     cat("ucminf failed for this problem\n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     ans$convergence <- NULL
     }
     else if (meth == "Rcgmin") {
     bdmsk <- rep(1, npar)
     mcontrol$trace <- NULL
     if (ctrl$trace > 0)
     mcontrol$trace <- 1
     tugr <- ugr
     if (is.null(ugr)) {
     tugr <- "grfwd"
     if (ctrl$trace > 0)
     cat("Rcgmin using grfwd\n")
     }
     if (have.bounds) {
     time <- system.time(ans <- try(Rcgminb(par = par,
     fn = ufn, gr = tugr, lower = lower, upper = upper,
     bdmsk = bdmsk, control = mcontrol, ...), silent = TRUE))[1]
     }
     else {
     time <- system.time(ans <- try(Rcgminu(par = par,
     fn = ufn, gr = tugr, control = mcontrol, ...),
     silent = TRUE))[1]
     }
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$fevals <- ans$counts[1]
     ans$gevals <- ans$counts[2]
     ans$counts <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("Rcgmin failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$fevals <- NA
     ans$gevals <- NA
     }
     ans$nitns <- NA
     ans$convergence <- NULL
     }
     else if (meth == "Rvmmin") {
     bdmsk <- rep(1, npar)
     mcontrol$trace <- NULL
     if (ctrl$trace > 0)
     mcontrol$trace <- ctrl$trace
     tugr <- ugr
     if (is.null(ugr)) {
     tugr <- "grfwd"
     if (ctrl$trace > 0)
     cat("Rvmmin using grfwd\n")
     }
     if (have.bounds) {
     time <- system.time(ans <- try(Rvmminb(par = par,
     fn = ufn, gr = tugr, lower = lower, upper = upper,
     bdmsk = bdmsk, control = mcontrol, ...), silent = TRUE))[1]
     }
     else {
     time <- system.time(ans <- try(Rvmminu(par = par,
     fn = ufn, gr = tugr, control = mcontrol, ...),
     silent = TRUE))[1]
     }
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$fevals <- ans$counts[1]
     ans$gevals <- ans$counts[2]
     }
     else {
     if (ctrl$trace > 0)
     cat("Rvmmin failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     }
     ans$nitns <- NA
     ans$convergence <- NULL
     }
     else if (meth == "lbfgsb3") {
     mcontrol$maxit <- NULL
     mcontrol$maxfeval <- NULL
     mcontrol$trace <- NULL
     mcontrol$iprint <- -1L
     if (ctrl$trace > 0) {
     mcontrol$trace <- 1
     mcontrol$iprint <- 1
     }
     time <- system.time(ans <- try(lbfgsb3::lbfgsb3(prm = par,
     fn = ufn, gr = ugr, lower = lower, upper = upper,
     control = mcontrol, ...), silent = TRUE))[1]
     if ((class(ans)[1] != "try-error")) {
     ans$convcode <- 0
     ans$fevals <- ans$info$isave[34]
     ans$gevals <- ans$fevals
     ans$value <- ans$f
     ans$par <- ans$prm
     ans$prm <- NULL
     ans$f <- NULL
     ans$info <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("lbfgsb3 failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$fevals <- NA
     }
     ans$nitns <- NA
     ans$convergence <- NULL
     }
     else if (meth == "bobyqa") {
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfun <- mcontrol$maxit
     }
     else {
     mcontrol$maxfun <- 5000 * round(sqrt(npar + 1))
     }
     mcontrol$iprint <- 0
     if (mcontrol$trace)
     mcontrol$iprint <- 1
     mcontrol$trace <- NULL
     time <- system.time(ans <- try(minqa::bobyqa(par = par,
     fn = ufn, lower = lower, upper = upper, control = mcontrol,
     ...), silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- 0
     if (ans$feval > mcontrol$maxfun) {
     ans$convcode <- 1
     }
     ans$fevals <- ans$feval
     ans$gevals <- NA
     ans$value <- ans$fval
     ans$nitns <- NA
     }
     else {
     if (ctrl$trace > 0)
     cat("bobyqa failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     else if (meth == "uobyqa") {
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfun <- mcontrol$maxit
     }
     else {
     mcontrol$maxfun <- 5000 * round(sqrt(npar + 1))
     }
     mcontrol$iprint <- 0
     if (mcontrol$trace)
     mcontrol$iprint <- 1
     mcontrol$trace <- NULL
     time <- system.time(ans <- try(minqa::uobyqa(par = par,
     fn = ufn, control = mcontrol, ...), silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- 0
     if (ans$feval > mcontrol$maxfun) {
     ans$convcode <- 1
     }
     ans$fevals <- ans$feval
     ans$gevals <- NA
     ans$value <- ans$fval
     ans$nitns <- NA
     }
     else {
     if (ctrl$trace > 0)
     cat("uobyqa failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     else if (meth == "newuoa") {
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfun <- mcontrol$maxit
     }
     else {
     mcontrol$maxfun <- 5000 * round(sqrt(npar + 1))
     }
     mcontrol$iprint <- 0
     if (mcontrol$trace)
     mcontrol$iprint <- 1
     mcontrol$trace <- NULL
     time <- system.time(ans <- try(minqa::newuoa(par = par,
     fn = ufn, control = mcontrol, ...), silent = TRUE))[1]
     if (class(ans)[1] != "try-error") {
     ans$convcode <- 0
     if (ans$feval > mcontrol$maxfun) {
     ans$convcode <- 1
     }
     ans$fevals <- ans$feval
     ans$gevals <- NA
     ans$value <- ans$fval
     ans$nitns <- NA
     }
     else {
     if (ctrl$trace > 0)
     cat("newuoa failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     else if (meth == "nmkb") {
     if (any(par == lower) || any(par == upper)) {
     if (ctrl$trace > 0)
     cat("nmkb cannot start if on any bound \n")
     warning("nmkb() cannot be started if any parameter on a bound")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$fevals <- NA
     ans$gevals <- NA
     ans$nitns <- NA
     }
     else {
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfeval <- mcontrol$maxit
     }
     else {
     mcontrol$maxfeval <- 5000 * round(sqrt(npar +
     1))
     }
     mcontrol$maxit <- NULL
     if (mcontrol$trace > 0) {
     mcontrol$trace <- TRUE
     }
     else {
     mcontrol$trace <- FALSE
     }
     mcontrol$usenumDeriv <- NULL
     mcontrol$maximize <- NULL
     mcontrol$parscale <- NULL
     mcontrol$fnscale <- NULL
     if (have.bounds) {
     time <- system.time(ans <- try(dfoptim::nmkb(par = par,
     fn = ufn, lower = lower, upper = upper, control = mcontrol,
     ...), silent = TRUE))[1]
     }
     else {
     time <- system.time(ans <- try(dfoptim::nmk(par = par,
     fn = ufn, control = mcontrol, ...), silent = TRUE))[1]
     }
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     ans$convergence <- NULL
     ans$value <- as.numeric(ans$value)
     ans$fevals <- ans$feval
     ans$feval <- NULL
     ans$gevals <- NA
     if (ans$fevals > mcontrol$maxfeval) {
     ans$convcode <- 1
     }
     ans$nitns <- NA
     ans$message <- NULL
     ans$restarts <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("nmkb failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$fevals <- NA
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     }
     else if (meth == "hjkb") {
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfeval <- mcontrol$maxit
     }
     else {
     mcontrol$maxfeval <- 5000 * round(sqrt(npar +
     1))
     }
     mcontrol$info <- FALSE
     if (mcontrol$trace > 0) {
     mcontrol$info <- TRUE
     }
     else {
     mcontrol$info <- FALSE
     }
     mcontrol$trace = NULL
     mcontrol$usenumDeriv <- NULL
     mcontrol$maximize <- NULL
     mcontrol$parscale <- NULL
     mcontrol$fnscale <- NULL
     if (!is.null(mcontrol$maxit)) {
     mcontrol$maxfeval <- mcontrol$maxit
     }
     else {
     mcontrol$maxfeval <- 5000 * round(sqrt(npar +
     1))
     }
     mcontrol$maxit <- NULL
     if (have.bounds) {
     time <- system.time(ans <- try(dfoptim::hjkb(par = par,
     fn = ufn, lower = lower, upper = upper, control = mcontrol,
     ...), silent = TRUE))[1]
     }
     else {
     time <- system.time(ans <- try(dfoptim::hjk(par = par,
     fn = ufn, control = mcontrol, ...), silent = TRUE))[1]
     }
     if (class(ans)[1] != "try-error") {
     ans$convcode <- ans$convergence
     if (ans$convcode == 1)
     ans$convcode = 9999
     ans$convergence <- NULL
     ans$value <- as.numeric(ans$value)
     ans$fevals <- ans$feval
     ans$feval <- NULL
     if (ans$fevals > mcontrol$maxfeval) {
     ans$convcode <- 1
     }
     ans$gevals <- NA
     ans$nitns <- ans$niter
     ans$niter <- NULL
     }
     else {
     if (ctrl$trace > 0)
     cat("hjkb failed for current problem \n")
     ans <- list(fevals = NA)
     ans$value = ctrl$badval
     ans$par <- rep(NA, npar)
     ans$convcode <- 9999
     ans$gevals <- NA
     ans$nitns <- NA
     }
     }
     else {
     errmsg <- paste("UNDEFINED METHOD: ", meth, sep = "")
     stop(errmsg, call. = FALSE)
     }
     if (ctrl$trace > 0) {
     cat("Post processing for method ", meth, "\n")
     }
     if (exists("ans$message")) {
     amsg <- ans$message
     ans$message <- NULL
     }
     else {
     amsg <- "none"
     }
     ngatend <- NA
     nhatend <- NA
     hev <- NA
     if (ctrl$save.failures || (ans$convcode < 1)) {
     if (ctrl$trace && ans$convcode == 0)
     cat("Successful convergence! \n")
     hessOK <- FALSE
     gradOK <- FALSE
     if ((ctrl$kkt || hessian) && (ans$convcode != 9999)) {
     if (ctrl$trace > 0)
     cat("Compute Hessian approximation at finish of ",
     method[i], "\n")
     if (!is.null(uhess)) {
     nhatend <- try(uhess(ans$par, ...), silent = TRUE)
     if (class(nhatend) != "try-error") {
     hessOK <- TRUE
     }
     }
     else {
     if (is.null(ugr)) {
     nhatend <- try(hessian(ufn, ans$par, ...),
     silent = TRUE)
     }
     else {
     nhatend <- try(jacobian(ugr, ans$par, ...),
     silent = TRUE)
     }
     if (class(nhatend) != "try-error") {
     hessOK <- TRUE
     }
     }
     }
     ans$kkt1 <- NA
     ans$kkt2 <- NA
     if ((hessian || ctrl$kkt) && (ans$convcode != 9999)) {
     if (ctrl$trace > 0)
     cat("Compute gradient approximation at finish of ",
     method[i], "\n")
     if (is.null(ugr)) {
     ngatend <- try(grad(ufn, ans$par, ...), silent = TRUE)
     }
     else {
     ngatend <- try(ugr(ans$par, ...), silent = TRUE)
     }
     if (class(ngatend) != "try-error")
     gradOK <- TRUE
     if ((!gradOK) && (ctrl$trace > 0))
     cat("Gradient computation failure!\n")
     if (gradOK) {
     ans$kkt1 <- (max(abs(ngatend)) <= ctrl$kkttol *
     (1 + abs(ans$value)))
     if (hessOK) {
     bset <- sort(unique(c(which(ans$par <= lower),
     which(ans$par >= upper))))
     nbds <- length(bset)
     ngatend[bset] <- 0
     nhatend[bset, ] <- 0
     nhatend[, bset] <- 0
     if (!isSymmetric(nhatend, tol = sqrt(.Machine$double.eps))) {
     asym <- sum(abs(t(nhatend) - nhatend))/sum(abs(nhatend))
     asw <- paste("Hessian is reported non-symmetric with asymmetry ratio ",
     asym, sep = "")
     if (ctrl$trace > 1)
     cat(asw, "\n")
     if (ctrl$dowarn)
     warning(asw)
     if (ctrl$trace > 1)
     cat("Force Hessian symmetric\n")
     if (ctrl$dowarn)
     warning("Hessian forced symmetric", call. = FALSE)
     nhatend <- 0.5 * (t(nhatend) + nhatend)
     }
     hev <- try(eigen(nhatend)$values, silent = TRUE)
     if (ctrl$kkt) {
     if (class(hev) != "try-error") {
     if (any(is.complex(hev))) {
     hessOK <- FALSE
     cat("Complex eigenvalues found for method =",
     meth, "\n")
     cat("coefficients for function value",
     ans$value, " :\n")
     print(ans$par)
     dput(nhatend, file = "badhess.txt")
     warning("Complex eigenvalues found for method =",
     meth)
     }
     if (hessOK) {
     negeig <- (hev[npar] <= (-1) * ctrl$kkt2tol *
     (1 + abs(ans$value)))
     evratio <- hev[npar - nbds]/hev[1]
     ans$kkt2 <- (evratio > ctrl$kkt2tol) &&
     (!negeig)
     }
     }
     else {
     warnstr <- paste("Eigenvalue failure after method ",
     method[i], sep = "")
     if (ctrl$dowarn)
     warning(warnstr)
     if (ctrl$trace > 0) {
     cat("Hessian eigenvalue calculation failure!\n")
     print(nhatend)
     }
     }
     }
     }
     else {
     warnstr <- paste("Hessian not computable after method ",
     method[i], sep = "")
     if (ctrl$dowarn)
     warning(warnstr)
     if (ctrl$trace > 0)
     cat(warnstr, "\n")
     }
     }
     else {
     warnstr <- paste("Gradient not computable after method ",
     method[i], sep = "")
     if (ctrl$dowarn)
     warning(warnstr)
     if (ctrl$trace > 0)
     cat(warnstr, "\n")
     }
     }
     ans$xtimes <- time
     if (ctrl$trace > 0) {
     cat("Save results from method ", meth, "\n")
     print(ans)
     }
     if (ctrl$trace > 0) {
     cat("Assemble the answers\n")
     }
     ans.ret[meth, ] <- c(ans$par, ans$value, ans$fevals,
     ans$gevals, ans$nitns, ans$convcode, ans$kkt1,
     ans$kkt2, ans$xtimes)
     if (!gradOK)
     ngatend <- NA
     if (!hessOK) {
     nhatend <- NA
     hev <- NA
     }
     }
     ans.details <- rbind(ans.details, list(method = meth,
     ngatend = ngatend, nhatend = nhatend, hev = hev,
     message = amsg))
     row.names(ans.details)[[i]] >= meth
     if (ctrl$follow.on) {
     par <- ans$par
     if (i < nmeth && (ctrl$trace > 0))
     cat("FOLLOW ON!\n")
     }
     }
     ansout <- NULL
     if (length(ans$par) > 0) {
     ansout <- data.frame(ans.ret)
     attr(ansout, "details") <- ans.details
     }
     ansout
     }
     <bytecode: 0x4778178>
     <environment: namespace:optimx>
     --- function search by body ---
     Function optimx.run in namespace optimx has this body.
     ----------- END OF FAILURE REPORT --------------
     Error in if (class(nhatend) != "try-error") { :
     the condition has length > 1
     Calls: optimx -> optimx.run
     Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 2018-7.10
Check: tests
Result: ERROR
     Running ‘bdstest.R’
     Running ‘hobbs.R’ [8s/17s]
     Running ‘jonesrun.R’
     Running ‘maxfn.R’
     Running ‘rosenbrock.R’ [10s/13s]
     Running ‘run1param.R’
     Running ‘simplefuntst.R’
     Running ‘snsimple.R’
     Running ‘snwood.R’
     Running ‘ssqbtest.R’
     Running ‘tfnchk.R’
     Running ‘tgrchk.R’
     Running ‘tkktc.R’
     Running ‘trig1507.R’ [12s/16s]
    Running the tests in ‘tests/hobbs.R’ failed.
    Complete output:
     > rm(list=ls())
     > require(optimx)
     Loading required package: optimx
     > ## Optimization test function HOBBS
     > ## ?? refs (put in .doc??)
     > ## Nash and Walker-Smith (1987, 1989) ...
     >
     >
     > hobbs.f<- function(x){ # # Hobbs weeds problem -- function
     + if (abs(12*x[3]) > 500) { # check computability
     + fbad<-.Machine$double.xmax
     + return(fbad)
     + }
     + res<-hobbs.res(x)
     + f<-sum(res*res)
     + }
     >
     >
     > hobbs.res<-function(x){ # Hobbs weeds problem -- residual
     + # This variant uses looping
     + if(length(x) != 3) stop("hobbs.res -- parameter vector n!=3")
     + y<-c(5.308, 7.24, 9.638, 12.866, 17.069, 23.192, 31.443, 38.558, 50.156, 62.948,
     + 75.995, 91.972)
     + t<-1:12
     + if(abs(12*x[3])>50) {
     + res<-rep(Inf,12)
     + } else {
     + res<-x[1]/(1+x[2]*exp(-x[3]*t)) - y
     + }
     + }
     >
     > hobbs.jac<-function(x){ # Jacobian of Hobbs weeds problem
     + jj<-matrix(0.0, 12, 3)
     + t<-1:12
     + yy<-exp(-x[3]*t)
     + zz<-1.0/(1+x[2]*yy)
     + jj[t,1] <- zz
     + jj[t,2] <- -x[1]*zz*zz*yy
     + jj[t,3] <- x[1]*zz*zz*yy*x[2]*t
     + return(jj)
     + }
     >
     > hobbs.g<-function(x){ # gradient of Hobbs weeds problem
     + # NOT EFFICIENT TO CALL AGAIN
     + jj<-hobbs.jac(x)
     + res<-hobbs.res(x)
     + gg<-as.vector(2.*t(jj) %*% res)
     + return(gg)
     + }
     >
     >
     > hobbs.rsd<-function(x) { # Jacobian second derivative
     + rsd<-array(0.0, c(12,3,3))
     + t<-1:12
     + yy<-exp(-x[3]*t)
     + zz<-1.0/(1+x[2]*yy)
     + rsd[t,1,1]<- 0.0
     + rsd[t,2,1]<- -yy*zz*zz
     + rsd[t,1,2]<- -yy*zz*zz
     + rsd[t,2,2]<- 2.0*x[1]*yy*yy*zz*zz*zz
     + rsd[t,3,1]<- t*x[2]*yy*zz*zz
     + rsd[t,1,3]<- t*x[2]*yy*zz*zz
     + rsd[t,3,2]<- t*x[1]*yy*zz*zz*(1-2*x[2]*yy*zz)
     + rsd[t,2,3]<- t*x[1]*yy*zz*zz*(1-2*x[2]*yy*zz)
     + ## rsd[t,3,3]<- 2*t*t*x[1]*x[2]*x[2]*yy*yy*zz*zz*zz
     + rsd[t,3,3]<- -t*t*x[1]*x[2]*yy*zz*zz*(1-2*yy*zz*x[2])
     + return(rsd)
     + }
     >
     >
     > hobbs.h <- function(x) { ## compute Hessian
     + # cat("Hessian not yet available\n")
     + # return(NULL)
     + H<-matrix(0,3,3)
     + res<-hobbs.res(x)
     + jj<-hobbs.jac(x)
     + rsd<-hobbs.rsd(x)
     + ## H<-2.0*(t(res) %*% rsd + t(jj) %*% jj)
     + for (j in 1:3) {
     + for (k in 1:3) {
     + for (i in 1:12) {
     + H[j,k]<-H[j,k]+res[i]*rsd[i,j,k]
     + }
     + }
     + }
     + H<-2*(H + t(jj) %*% jj)
     + return(H)
     + }
     >
     >
     >
     > x0 <- c(200, 50, .3)
     > # This start seems to be OK for all methods
     > cat("Start for Hobbs:")
     Start for Hobbs:> print(x0)
     [1] 200.0 50.0 0.3
     > cat("Initial value of hobbs.f = ",hobbs.f(x0),"\n")
     Initial value of hobbs.f = 158.2324
     > ahobb0 <- opm(x0, hobbs.f, hobbs.g, hess=hobbs.h, method="ALL")
     This problem is unconstrained.
     Error in if (delfb > -armtst/n) { : missing value where TRUE/FALSE needed
     In addition: Warning messages:
     1: In Rcgminu(par = spar, fn = efn, gr = egr, control = mcontrol, ...) :
     Rcgmin - undefined function
     2: In Rcgminu(par = spar, fn = efn, gr = egr, control = mcontrol, ...) :
     Rcgmin - undefined function
     3: In Rcgminu(par = spar, fn = efn, gr = egr, control = mcontrol, ...) :
     Rcgmin - undefined function
     4: In Rcgminu(par = spar, fn = efn, gr = egr, control = mcontrol, ...) :
     Rcgmin - undefined function
     5: In Rcgminu(par = spar, fn = efn, gr = egr, control = mcontrol, ...) :
     Rcgmin - undefined function
     Warning message:
     In dfoptim::hjk(par = spar, fn = efn, control = mcontrol, ...) :
     Function evaluation limit exceeded -- may not converge.
     > print(summary(ahobb0, order=value))
     p1 p2 p3 value fevals gevals convergence
     ucminf 196.1863 49.09164 0.3135697 2.587277e+00 22 22 0
     subplex 196.1863 49.09164 0.3135697 2.587277e+00 823 NA 0
     Rvmmin 196.1863 49.09164 0.3135697 2.587277e+00 35 17 0
     snewtonm 196.1863 49.09164 0.3135697 2.587277e+00 13 9 0
     nlminb 196.1863 49.09164 0.3135697 2.587277e+00 8 7 0
     nlm 196.1863 49.09164 0.3135697 2.587277e+00 NA 6 0
     snewton 196.1863 49.09164 0.3135697 2.587277e+00 10 10 92
     lbfgs 196.1863 49.09166 0.3135697 2.587277e+00 NA NA 0
     BFGS 196.1856 49.09156 0.3135701 2.587277e+00 74 25 0
     Rcgmin 196.1888 49.09191 0.3135683 2.587277e+00 2005 272 1
     Nelder-Mead 196.1782 49.09055 0.3135750 2.587279e+00 162 NA 0
     newuoa 196.5159 49.12861 0.3133856 2.587519e+00 4938 NA 0
     spg 199.6503 49.47564 0.3116572 2.612872e+00 974 419 0
     CG 199.9263 49.48658 0.3114687 2.617055e+00 4924 1001 1
     L-BFGS-B 200.0162 49.51389 0.3114545 2.618411e+00 25 25 0
     lbfgsb3 200.0162 49.51389 0.3114545 2.618411e+00 25 25 0
     bobyqa 200.4891 49.98062 0.3120166 2.662018e+00 38 NA 0
     hjkb 203.7921 49.90674 0.3093994 2.704449e+00 10006 NA 1
     Rtnmin 203.8197 50.04305 0.3096444 2.707066e+00 8 8 3
     hjn 221.3600 51.79258 0.3008320 3.639897e+00 10000 NA 1
     nmkb NA NA NA 8.988466e+307 NA NA 9999
     kkt1 kkt2 xtime
     ucminf TRUE FALSE 0.012
     subplex TRUE FALSE 0.023
     Rvmmin TRUE FALSE 0.013
     snewtonm TRUE FALSE 0.006
     nlminb TRUE FALSE 0.005
     nlm TRUE FALSE 0.133
     snewton TRUE FALSE 0.007
     lbfgs TRUE FALSE 0.016
     BFGS TRUE FALSE 0.157
     Rcgmin TRUE FALSE 0.071
     Nelder-Mead FALSE FALSE 0.004
     newuoa FALSE FALSE 0.442
     spg FALSE FALSE 0.129
     CG FALSE FALSE 0.155
     L-BFGS-B FALSE FALSE 0.003
     lbfgsb3 FALSE FALSE 0.045
     bobyqa FALSE FALSE 0.003
     hjkb FALSE FALSE 0.308
     Rtnmin FALSE FALSE 0.016
     hjn FALSE FALSE 0.281
     nmkb NA NA 0.012
     >
     >
     > x1 <- c(1, 1, 1)
     > # Several methods fail because f or g becomes Inf.
     > cat("Start for Hobbs:")
     Start for Hobbs:> print(x1)
     [1] 1 1 1
     > cat("Initial value of hobbs.f = ",hobbs.f(x1),"\n")
     Initial value of hobbs.f = 23520.58
     > ahobb1 <- opm(x1, hobbs.f, hobbs.g, hess=hobbs.h, method="ALL")
     Error in optim(par = par, fn = efn, gr = egr, method = method, hessian = FALSE, :
     L-BFGS-B needs finite values of 'fn'
     In addition: Warning message:
     In kktchk(ans$par, fn, wgr, hess = NULL, upper = NULL, lower = NULL, :
     Eigenvalue failure for projected Hessian
     This problem is unconstrained.
     Error in lbfgsb3::lbfgsb3(prm = spar, fn = efn, gr = egr, control = mcontrol, :
     NA/NaN/Inf in foreign function call (arg 7)
     In addition: Warning messages:
     1: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     2: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     3: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     4: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     terminate called after throwing an instance of 'std::range_error'
     what(): non-finite x values not allowed in calfun
Flavor: r-patched-solaris-x86

Version: 2018-7.10
Check: tests
Result: ERROR
     Running ‘bdstest.R’ [2s/4s]
     Running ‘hobbs.R’ [5s/14s]
    Running the tests in ‘tests/hobbs.R’ failed.
    Last 13 lines of output:
     In kktchk(ans$par, fn, wgr, hess = NULL, upper = NULL, lower = NULL, :
     Eigenvalue failure for projected Hessian
     This problem is unconstrained.
     Error in lbfgsb3::lbfgsb3(prm = spar, fn = efn, gr = egr, control = mcontrol, :
     NA/NaN/Inf in foreign function call (arg 7)
     In addition: Warning messages:
     1: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     2: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     3: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     4: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     libc++abi.dylib: terminating with uncaught exception of type std::range_error: non-finite x values not allowed in calfun
Flavor: r-release-osx-x86_64

Version: 2018-7.10
Check: tests
Result: ERROR
     Running ‘bdstest.R’ [1s/1s]
     Running ‘hobbs.R’ [4s/5s]
    Running the tests in ‘tests/hobbs.R’ failed.
    Last 13 lines of output:
     In kktchk(ans$par, fn, wgr, hess = NULL, upper = NULL, lower = NULL, :
     Eigenvalue failure for projected Hessian
     This problem is unconstrained.
     Error in lbfgsb3::lbfgsb3(prm = spar, fn = efn, gr = egr, control = mcontrol, :
     NA/NaN/Inf in foreign function call (arg 7)
     In addition: Warning messages:
     1: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     2: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     3: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     4: In nlm(f = nlmfn, p = spar, iterlim = iterlim, print.level = print.level, :
     NA/Inf replaced by maximum positive value
     libc++abi.dylib: terminating with uncaught exception of type std::range_error: non-finite x values not allowed in calfun
Flavor: r-oldrel-osx-x86_64