CRAN Package Check Results for Package optimx

Last updated on 2025-12-05 19:49:53 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 2025-4.9 10.99 95.40 106.39 OK
r-devel-linux-x86_64-debian-gcc 2025-4.9 7.81 60.88 68.69 ERROR
r-devel-linux-x86_64-fedora-clang 2025-4.9 27.00 138.96 165.96 OK
r-devel-linux-x86_64-fedora-gcc 2025-4.9 24.00 146.38 170.38 OK
r-devel-windows-x86_64 2025-4.9 13.00 114.00 127.00 OK
r-patched-linux-x86_64 2025-4.9 11.41 85.44 96.85 OK
r-release-linux-x86_64 2025-4.9 9.14 91.04 100.18 OK
r-release-macos-arm64 2025-4.9 OK
r-release-macos-x86_64 2025-4.9 8.00 186.00 194.00 OK
r-release-windows-x86_64 2025-4.9 11.00 110.00 121.00 OK
r-oldrel-macos-arm64 2025-4.9 OK
r-oldrel-macos-x86_64 2025-4.9 9.00 215.00 224.00 OK
r-oldrel-windows-x86_64 2025-4.9 18.00 148.00 166.00 OK

Check Details

Version: 2025-4.9
Check: tests
Result: ERROR Running ‘argclash.R’ [1s/1s] Running ‘bdstest.R’ [0s/0s] Running ‘exrosen.R’ [0s/0s] Running ‘maxfn.R’ [0s/0s] Running ‘maxtest.R’ [3s/3s] Running ‘run1param.R’ [2s/2s] Running ‘tfnchk.R’ [0s/0s] Running ‘tgrchk.R’ [0s/0s] Running ‘tkktc.R’ [0s/0s] Running the tests in ‘tests/bdstest.R’ failed. Complete output: > # rm(list=ls()) > ## author: John C. Nash > # fname<-paste(format(Sys.time(), "%Y%m%d%H%M"),"-btnvm.out",sep='') > # sink(fname, append=TRUE, split=TRUE) > require("optimx") Loading required package: optimx > # Following is used when starting from opx21 directory > # source("optimx/tests/simplefun.R") > # Following is for use in package testing > # Simple Test Function 1: > simfun.f = function(x) { + fun <- sum(x^2 ) + # print(c(x = x, fun = fun)) + fun + } > simfun.g = function(x) { + grad<-2.0*x + grad + } > simfun.h = function(x) { + n<-length(x) + t<-rep(2.0,n) + hess<-diag(t) + } > sessionInfo() R Under development (unstable) (2025-12-04 r89100) Platform: x86_64-pc-linux-gnu Running under: Debian GNU/Linux forky/sid Matrix products: default BLAS: /home/hornik/tmp/R.check/r-devel-gcc/Work/build/lib/libRblas.so LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.1; LAPACK version 3.12.0 locale: [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 [4] LC_COLLATE=C LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C time zone: Europe/Vienna tzcode source: system (glibc) attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] optimx_2025-4.9 loaded via a namespace (and not attached): [1] compiler_4.6.0 nloptr_2.2.1 numDeriv_2016.8-1.1 [4] pracma_2.4.6 > ##################### > > # This test script illustrates the use of bounds in optimr() with the > # optimizers nvm and L-BFGS-B, as well as a Kuhn Karush Tucker check > # on the final parameters from the second optimization. > # Masks are tested at the very end for the two methods for which they are > # available. Note that they must be called via the opm() function. > > > n<-4 > lower<-rep(0,n) > upper<-lower # to get arrays set > bdmsk<-rep(1,n) > # bdmsk[(trunc(n/2)+1)]<-0 > for (i in 1:n) { + lower[i]<-1.0*(i-1)*(n-1)/n + upper[i]<-1.0*i*(n+1)/n + } > xx<-0.5*(lower+upper) > > cat("lower bounds:") lower bounds:> print(lower) [1] 0.00 0.75 1.50 2.25 > cat("start: ") start: > print(xx) [1] 0.625 1.625 2.625 3.625 > cat("upper bounds:") upper bounds:> print(upper) [1] 1.25 2.50 3.75 5.00 > > cat("nvm\n") # changed from Rvmmin 2023-10-22 nvm > > abtrvm <- optimr(xx, simfun.f, simfun.g, lower=lower, upper=upper, + method="nvm", control=list(trace=0)) > # Note: use lower=lower etc. because there is a missing hess= argument > proptimr(abtrvm) Result abtrvm ( nvm -> (no_name) ) calc. min. = 7.875 at 0 L 0.75 L 1.5 L 2.25 L NA NA After 8 fn evals, and 8 gr evals and 0 hessian evals Termination code is 2 : NA ------------------------------------------------- > > cat("Axial search") Axial search> axabtrvm <- axsearch(abtrvm$par, fn=simfun.f, fmin=abtrvm$value, lower, upper, bdmsk=NULL) > print(axabtrvm) $bestfn [1] 7.875 attr(,"fname") [1] "(no_name)" attr(,"method") [1] "nvm" attr(,"ptype") [1] "C" $par [1] 0.00 0.75 1.50 2.25 attr(,"status") [1] "L" "L" "L" "L" $details par0 fback rep.fmin..npar. ffwd parstep tilt roc 1 0.00 NA 7.875 7.875000 3.666853e-07 90 NaN 2 0.75 NA 7.875 7.875682 4.545258e-04 90 NaN 3 1.50 NA 7.875 7.877727 9.086849e-04 90 NaN 4 2.25 NA 7.875 7.881135 1.362844e-03 90 NaN > > cat("Now force an early stop\n") Now force an early stop > abtrvm1 <- optimr(xx, simfun.f, simfun.g, lower=lower, upper=upper, method="nvm", + control=list(maxit=1, trace=0)) Warning message: In nvm(par = spar, fn = efn, gr = egr, bds = bdmsk, control = mcontrol) : Too many gradient evaluations > print(abtrvm1) $par [1] 0.625 1.625 2.625 3.625 attr(,"status") [1] " " " " " " " " $value [1] 8.884958 attr(,"fname") [1] "(no_name)" attr(,"method") [1] "nvm" attr(,"ptype") [1] "C" $counts function gradient 2 2 $convergence [1] 1 $message [1] NA $scounts [1] 2 2 0 attr(,"maximize") [1] FALSE > cat("Axial search") Axial search> axabtrvm1 <- axsearch(abtrvm1$par, fn=simfun.f, fmin=abtrvm1$value, lower, upper, bdmsk=NULL) > print(axabtrvm1) $bestfn [1] 8.884958 attr(,"fname") [1] "(no_name)" attr(,"method") [1] "nvm" attr(,"ptype") [1] "C" $par [1] 0.625 1.625 2.625 3.625 attr(,"status") [1] " " " " " " " " $details par0 fback rep.fmin..npar. ffwd parstep tilt roc 1 0.625 23.06203 8.884958 23.06297 0.0003788326 -51.34019 4.152308e-08 2 1.625 23.05930 8.884958 23.06570 0.0009843780 -72.89727 2.687203e-06 3 2.625 23.05416 8.884958 23.07085 0.0015899235 -79.21570 2.721735e-05 4 3.625 23.04659 8.884958 23.07842 0.0021954689 -82.14669 1.332738e-04 > > > cat("Maximization test\n") Maximization test > mabtrvm <- optimr(xx, simfun.f, simfun.g, lower=lower, upper=upper, method="nvm", + control=list(trace=1, maximize=TRUE)) admissible = TRUE maskadded = FALSE parchanged = FALSE Parameter scaling:[1] 1 1 1 1 nvm -- J C Nash 2009-2015 - an R implementation of Alg 21 Problem of size n= 4 Initial fn= -23.0625 ig= 1 gnorm= 9.604686 1 1 -23.0625 ig= 2 gnorm= 8.689381 2 2 -43.87634 No acceptable point Reset to gradient search 2 2 -43.87634 ig= 3 gnorm= 4.974424 3 3 -45.24872 No acceptable point Reset to gradient search 3 3 -45.24872 ig= 4 gnorm= 1.923077 4 4 -46.23706 No acceptable point Reset to gradient search 4 4 -46.23706 ig= 5 gnorm= 0 Seem to be done nvm admissible = TRUE maskadded = FALSE parchanged = FALSE At least one parameter is on a bound existing parameter status:[1] "?" "?" "?" "?" > # Note: use lower=lower etc. because there is a missing hess= argument > print(mabtrvm) $par [1] 1.25 2.50 3.75 5.00 attr(,"status") [1] "U" "U" "U" "U" $value [1] 46.875 attr(,"fname") [1] "(no_name)" attr(,"method") [1] "nvm" attr(,"ptype") [1] "C" $counts function gradient 5 5 $convergence [1] 2 $message [1] NA $scounts [1] 5 5 0 attr(,"maximize") [1] TRUE > cat("Do NOT try axsearch() with maximize\n") Do NOT try axsearch() with maximize > cat("KKT condition check\n") KKT condition check > akktm <- kktchk(mabtrvm$par, simfun.f, simfun.g, hess=NULL, upper=upper, lower=lower, + maximize=TRUE, control=list(trace=0)) Warning message: In kktchk(mabtrvm$par, simfun.f, simfun.g, hess = NULL, upper = upper, : All parameters are constrained > print(akktm) $gmax [1] 0 $evratio [1] NA $kkt1 [1] TRUE $kkt2 [1] TRUE $hev [1] 0 0 0 0 $ngatend [1] 2.5 5.0 7.5 10.0 attr(,"status") [1] "U" "U" "U" "U" $nhatend [,1] [,2] [,3] [,4] [1,] -2 0 0 0 [2,] 0 -2 0 0 [3,] 0 0 -2 0 [4,] 0 0 0 -2 > > alb<-optimr(xx,simfun.f, simfun.g, lower=lower, upper=upper, method="L-BFGS-B", + control=list(trace=0)) > print(alb) $par [1] 0.00 0.75 1.50 2.25 attr(,"status") [1] "L" "L" "L" "L" $value [1] 7.875 attr(,"fname") [1] "(no_name)" attr(,"method") [1] "L-BFGS-B" attr(,"ptype") [1] "C" $counts function gradient 2 2 $convergence [1] 0 $message [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" $scounts [1] 2 2 0 attr(,"maximize") [1] FALSE > > cat("KKT condition check\n") KKT condition check > alkkt <- kktchk(alb$par, simfun.f, simfun.g, hess=NULL, upper=upper, lower=lower, maximize=FALSE, control=list(trace=0)) Warning message: In kktchk(alb$par, simfun.f, simfun.g, hess = NULL, upper = upper, : All parameters are constrained > print(alkkt) $gmax [1] 0 $evratio [1] NA $kkt1 [1] TRUE $kkt2 [1] TRUE $hev [1] 0 0 0 0 $ngatend [1] 0.0 1.5 3.0 4.5 attr(,"status") [1] "L" "L" "L" "L" $nhatend [,1] [,2] [,3] [,4] [1,] 2 0 0 0 [2,] 0 2 0 0 [3,] 0 0 2 0 [4,] 0 0 0 2 > > alhn<-optimr(xx, simfun.f, lower=lower, upper=upper, method="hjn", + control=list(trace=0)) > print(alhn) $par [1] 0.00 0.75 1.50 2.25 attr(,"status") [1] "L" "L" "L" "L" $value [1] 7.875 attr(,"fname") [1] "(no_name)" attr(,"method") [1] "hjn" attr(,"ptype") [1] "C" $counts [1] 70 NA $convergence [1] 0 $message [1] "hjn success" $scounts [1] 70 0 0 attr(,"maximize") [1] FALSE > > #sink() > cat("All bounded methods attempt with opm\n") # ?? should give errors All bounded methods attempt with opm > allbds <- opm(xx, simfun.f, simfun.g, lower=lower, upper=upper, method="MOST", control=list(trace=0)) Non-bounds methods requested:[1] "Nelder-Mead" "nlm" "ucminf" "subplex" "mla" [6] "pracmanm" Error in loadNamespace(x) : there is no package called 'lbfgsb3c' In addition: Warning messages: 1: In opm(xx, simfun.f, simfun.g, lower = lower, upper = upper, method = "MOST", : A method requested does not handle bounds 2: In opm(xx, simfun.f, simfun.g, lower = lower, upper = upper, method = "MOST", : 'snewtm' removed from 'method' -- no hess() 3: In checksolver(method, control$allmeth, control$allpkg) : Package lbfgsb3c for method lbfgsb3c( is not available Error in ans$convergence : $ operator is invalid for atomic vectors Calls: opm -> system.time -> optimr Timing stopped at: 0.001 0 0.001 Execution halted Flavor: r-devel-linux-x86_64-debian-gcc