* using log directory ‘/data/gannet/ripley/R/packages/tests-ATLAS/MOSAlloc.Rcheck’ * using R Under development (unstable) (2026-01-29 r89350) * using platform: x86_64-pc-linux-gnu * R was compiled by gcc (GCC) 15.1.1 20250521 (Red Hat 15.1.1-2) GNU Fortran (GCC) 15.1.1 20250521 (Red Hat 15.1.1-2) * running under: Fedora Linux 42 (Workstation Edition) * using session charset: UTF-8 * using option ‘--no-stop-on-test-error’ * checking for file ‘MOSAlloc/DESCRIPTION’ ... OK * this is package ‘MOSAlloc’ version ‘1.2.3’ * package encoding: UTF-8 * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘MOSAlloc’ can be installed ... [8s/15s] OK * checking package directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking code files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [15s/35s] OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking examples ... ERROR Running examples in ‘MOSAlloc-Ex.R’ failed The error most likely occurred in: > ### Name: mosalloc > ### Title: Multiobjective sample allocation for constraint multivariate and > ### multidomain optimal allocation in survey sampling > ### Aliases: mosalloc > > ### ** Examples > > # Artificial population of 50 568 business establishments and 5 business > # sectors (data from Valliant, R., Dever, J. A., & Kreuter, F. (2013). > # Practical tools for designing and weighting survey samples. Springer. > # https://doi.org/10.1007/978-1-4614-6449-5, Example 5.2 pages 133-9) > > # See also > # file: Code 5.3 constrOptim.example.R > > Nh <- c(6221, 11738, 4333, 22809, 5467) # stratum sizes > ch <- c(120, 80, 80, 90, 150) # stratum-specific cost of surveying > > # Revenues > mh.rev <- c(85, 11, 23, 17, 126) # mean revenue > Sh.rev <- c(170.0, 8.8, 23.0, 25.5, 315.0) # standard deviation revenue > > # Employees > mh.emp <- c(511, 21, 70, 32, 157) # mean number of employees > Sh.emp <- c(255.50, 5.25, 35.00, 32.00, 471.00) # std. dev. employees > > # Proportion of estabs claiming research credit > ph.rsch <- c(0.8, 0.2, 0.5, 0.3, 0.9) > > # Proportion of estabs with offshore affiliates > ph.offsh <- c(0.06, 0.03, 0.03, 0.21, 0.77) > > budget <- 300000 # overall available budget > n.min <- 100 # minimum stratum-specific sample size > > # Examples > #---------------------------------------------------------------------------- > # Example 1: Minimization of the variation of estimates for revenue subject > # to cost restrictions and precision restrictions to the coefficient of > # variation of estimates for the proportion of businesses with offshore > # affiliates. > > l <- rep(n.min, 5) # minimum sample size per stratum > u <- Nh # maximum sample size per stratum > C <- rbind(ch, + ch * c(-1, -1, -1, 0, 0)) > c <- c(budget, # Maximum overall survey budget + - 0.5 * budget) # Minimum overall budget for strata 1-3 > > # We require at maximum 5 % relative standard error for estimates of > # proportion of businesses with offshore affiliates > A <- matrix(ph.offsh * (1 - ph.offsh) * Nh**3/(Nh - 1)/sum(Nh * ph.offsh)**2, + nrow = 1) > a <- sum(ph.offsh * (1 - ph.offsh) * Nh**2/(Nh - 1) + )/sum(Nh * ph.offsh)**2 + 0.05**2 > > D <- matrix(Sh.rev**2 * Nh**2, nrow = 1) # objective variance components > d <- sum(Sh.rev**2 * Nh) # finite population correction > > opts = list(sense = "max_precision", + f = NULL, df = NULL, Hf = NULL, + init_w = 1, + mc_cores = 1L, pm_tol = 1e-05, + max_iters = 100L, print_pm = FALSE) > > sol <- mosalloc(D = D, d = d, A = A, a = a, C = C, c = c, l = l, u = u, + opts = opts) > > # Check solution statement of the internal solver to verify feasibility > sol$Ecosolver$Ecoinfostring # [1] "Optimal solution found" [1] "Optimal solution found" > > # Check constraints > c(C[1, ] %*% sol$n) # [1] 3e+05 [1] 3e+05 > c(C[2, ] %*% sol$n) # [1] -150000 [1] -150000 > c(sqrt(A %*% (1 / sol$n) - A %*% (1 / Nh))) # 5 % rel. std. err. [1] 0.05 > > #---------------------------------------------------------------------------- > # Example 2: Minimization of the maximum relative variation of estimates for > # the total revenue, the number of employee, the number of businesses claimed > # research credit, and the number of businesses with offshore affiliates > # subject to cost restrictions > > l <- rep(n.min, 5) # minimum sample size ber stratum > u <- Nh # maximum sample size per stratum > C <- rbind(ch, ch * c(-1, -1, -1, 0, 0)) > c <- c(budget, - 0.5 * budget) > A <- NULL # no precision constraint > a <- NULL # no precision constraint > > # Precision components (Variance / Totals^2) for multidimensional objective > D <- rbind(Sh.rev**2 * Nh**2/sum(Nh * mh.rev)**2, + Sh.emp**2 * Nh**2/sum(Nh * mh.emp)**2, + ph.rsch * (1 - ph.rsch) * Nh**3/(Nh - 1)/sum(Nh * ph.rsch)**2, + ph.offsh * (1 - ph.offsh) * Nh**3/(Nh - 1)/sum(Nh * ph.offsh)**2) > > d <- as.vector(D %*% (1 / Nh)) # finite population correction > > opts = list(sense = "max_precision", + f = NULL, df = NULL, Hf = NULL, + init_w = 1, + mc_cores = 1L, pm_tol = 1e-05, + max_iters = 100L, print_pm = FALSE) > > sol <- mosalloc(D = D, d = d, C = C, c = c, l = l, u = u, opts = opts) > > # Obtain optimal objective value > sol$J # [1] 0.0017058896 0.0004396972 0.0006428475 0.0017058896 [1] 0.0017058896 0.0004396972 0.0006428475 0.0017058896 > > # Obtain corresponding normal vector > sol$Normal # [1] 6.983113e-01 1.337310e-11 1.596167e-11 3.016887e-01 [1] 6.983113e-01 1.337310e-11 1.596167e-11 3.016887e-01 > > # => Revenue and offshore affiliates are dominating the solution with a > # ratio of approximately 2:1 (sol$Normal[1] / sol$Normal[4]) > > #---------------------------------------------------------------------------- > # Example 3: Example 2 with preference weighting > > w <- c(1, 3.85, 3.8, 1.3) # preference weighting > l <- rep(n.min, 5) # minimum sample size ber stratum > u <- Nh # maximum sample size per stratum > C <- rbind(ch, ch * c(-1, -1, -1, 0, 0)) > c <- c(budget, - 0.5 * budget) > A <- NULL # no precision constraint > a <- NULL # no precision constraint > > D <- rbind(Sh.rev**2 * Nh**2/sum(Nh * mh.rev)**2, + Sh.emp**2 * Nh**2/sum(Nh * mh.emp)**2, + ph.rsch * (1 - ph.rsch) * Nh**3/(Nh - 1)/sum(Nh * ph.rsch)**2, + ph.offsh * (1 - ph.offsh) * Nh**3/(Nh - 1)/sum(Nh * ph.offsh)**2) > > d <- as.vector(D %*% (1 / Nh)) > > opts = list(sense = "max_precision", + f = NULL, df = NULL, Hf = NULL, + init_w = w, + mc_cores = 1L, pm_tol = 1e-05, + max_iters = 100L, print_pm = FALSE) > > mosalloc(D = D, d = d, C = C, c = c, l = l, u = u, opts = opts) $w [1] 1.00 3.85 3.80 1.30 $n [1] 755.8117 499.7609 241.5215 691.6864 584.9882 $J [1] 0.0018907289 0.0004917598 0.0004982304 0.0014563656 $Objective NULL $Utiopian NULL $Normal [1] 2.363540e-08 2.237152e+00 1.186254e+00 1.387742e-01 $dfJ NULL $Sensitivity $Sensitivity$D [1] 2.363540e-08 5.810784e-01 3.121722e-01 1.067494e-01 $Sensitivity$A numeric(0) $Sensitivity$C [1] 1.050676e-08 -7.307475e-09 $Sensitivity$lbox [1] 9.092316e-17 1.546804e-16 4.497307e-16 1.019839e-16 1.252933e-16 $Sensitivity$ubox [1] 1.128929e-17 5.616330e-18 1.502808e-17 2.806816e-18 1.251829e-17 $Qbounds [1] 1 1 1 1 1 $Dbounds [1] 0.001890729 0.001893275 0.001893275 0.001893275 $Scalingfactor [1] 0.0016654338 0.0020770702 0.0022015450 0.0002711488 0.0005464200 $Ecosolver $Ecosolver$Ecoinfostring [1] "Optimal solution found" $Ecosolver$Ecoredcodes exitFlag iter mi_iter numerr 0 12 -1 0 $Ecosolver$Ecosummary pcost dcost pres dres pinf dinf 1.069071e+00 1.069071e+00 1.176382e-12 4.976283e-12 0.000000e+00 0.000000e+00 pinfres dinfres gap relgap r0 7.107497e-02 NaN 2.309227e-09 2.160032e-09 1.000000e-10 $Timing TotalTime InnerTime ECOS_runtime ECOS_tsetup ECOS_tsolve [1,] 0.02 0.006 0.000431542 9.7511e-05 0.000334031 $Iteration NULL > > #---------------------------------------------------------------------------- > # Example 4: Example 2 with multiple preference weightings for simultaneous > # evaluation > > w <- matrix(c(1.0, 1.0, 1.0, 1.0, # matrix of preference weightings + 1.0, 3.9, 3.9, 1.3, + 0.8, 4.2, 4.8, 1.5, + 1.2, 3.5, 4.8, 2.0, + 2.0, 1.0, 1.0, 2.0), 5, 4, byrow = TRUE) > w <- w / w[,1] # rescale w (ensure the first weighting to be one) > l <- rep(n.min, 5) # minimum sample size ber stratum > u <- Nh # maximum sample size per stratum > C <- rbind(ch, ch * c(-1, -1, -1, 0, 0)) > c <- c(budget, - 0.5 * budget) > A <- NULL # no precision constraint > a <- NULL # no precision constraint > > D <- rbind(Sh.rev**2 * Nh**2/sum(Nh * mh.rev)**2, + Sh.emp**2 * Nh**2/sum(Nh * mh.emp)**2, + ph.rsch * (1 - ph.rsch) * Nh**3/(Nh - 1)/sum(Nh * ph.rsch)**2, + ph.offsh * (1 - ph.offsh) * Nh**3/(Nh - 1)/sum(Nh * ph.offsh)**2) > > d <- as.vector(D %*% (1 / Nh)) > > opts = list(sense = "max_precision", + f = NULL, df = NULL, Hf = NULL, + init_w = w, + mc_cores = 1L, pm_tol = 1e-05, + max_iters = 100L, print_pm = FALSE) > > sols <- mosalloc(D = D, d = d, C = C, c = c, l = l, u = u, opts = opts) > lapply(sols, function(sol){sol$Qbounds}) [[1]] [1] 1 1 1 1 1 [[2]] [1] 1 1 1 1 1 [[3]] [1] 1 1 1 1 1 [[4]] [1] 1 1 1 1 1 [[5]] [1] 1 1 1 1 1 > > #---------------------------------------------------------------------------- > # Example 5: Example 2 where a weighted sum scalarization of the objective > # components is minimized > > l <- rep(n.min, 5) # minimum sample size ber stratum > u <- Nh # maximum sample size per stratum > C <- matrix(ch, nrow = 1) > c <- budget > A <- NULL # no precision constraint > a <- NULL # no precision constraint > > # Objective variance components > D <- rbind(Sh.rev**2 * Nh**2/sum(Nh * mh.rev)**2, + Sh.emp**2 * Nh**2/sum(Nh * mh.emp)**2, + ph.rsch * (1 - ph.rsch) * Nh**3/(Nh - 1)/sum(Nh * ph.rsch)**2, + ph.offsh * (1 - ph.offsh) * Nh**3/(Nh - 1)/sum(Nh * ph.offsh)**2) > > d <- as.vector(D %*% (1 / Nh)) # finite population correction > > # Simple weighted sum as decision functional > wss <- c(1, 1, 0.5, 0.5) # preference weighting (weighted sum scalarization) > > Dw <- wss %*% D > dw <- as.vector(wss %*% d) > > opts = list(sense = "max_precision", + f = NULL, df = NULL, Hf = NULL, + init_w = 1, + mc_cores = 1L, pm_tol = 1e-05, + max_iters = 1000L, print_pm = FALSE) > > # Solve weighted sum scalarization (WSS) via mosalloc > sol_wss <- mosalloc(D = Dw, d = dw, C = C, c = c, l = l, u = u, opts = opts) Error in mosalloc(D = Dw, d = dw, C = C, c = c, l = l, u = u, opts = opts) : d is not an utopian vector! d is too large. Execution halted * checking for unstated dependencies in ‘tests’ ... OK * checking tests ... Running ‘testthat.R’ ERROR Running the tests in ‘tests/testthat.R’ failed. Complete output: > # This file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional test configuration? > # Learn more about the roles of various files in: > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview > # * https://testthat.r-lib.org/articles/special-files.html > > library(testthat) > library(MOSAlloc) > > test_check("MOSAlloc") ---------------------------------------------------------- mosalloc running... TotalTime InnerTime ECOS_runtime ECOS_tsetup ECOS_tsolve 0.015 0.011 0.000636826 9.1833e-05 0.000544993 -> ECOSolveR statement: Optimal solution found! ---------------------------------------------------------- Saving _problems/test-mosallocSTRS-41.R ---------------------------------------------------------- mosalloc running... TotalTime InnerTime ECOS_runtime ECOS_tsetup ECOS_tsolve 0.025 0.016 0.000661579 0.000112999 0.00054858 -> ECOSolveR statement: Optimal solution found! ---------------------------------------------------------- ---------------------------------------------------------- mosalloc running... -> ECOSolveR statement: Optimal solution found! ---------------------------------------------------------- ---------------------------------------------------------- mosalloc running... TotalTime InnerTime ECOS_runtime ECOS_tsetup ECOS_tsolve 0.008 0.003 0.000734282 0.000111645 0.000622637 -> ECOSolveR statement: Optimal solution found! ---------------------------------------------------------- ---------------------------------------------------------- ---------------------------------------------------------- mosalloc running... TotalTime InnerTime ECOS_runtime ECOS_tsetup ECOS_tsolve 0.012 0.005 0.000601773 0.000132747 0.000469026 -> ECOSolveR statement: Optimal solution found! ---------------------------------------------------------- [ FAIL 1 | WARN 0 | SKIP 0 | PASS 86 ] ══ Failed tests ════════════════════════════════════════════════════════════════ ── Failure ('test-mosallocSTRS.R:40:3'): mosallocSTRS() works as expected for a simple univariate problem ── Expected `resWSS$objectives[[1]] == ...` to be identical to TRUE. Differences: `actual`: FALSE `expected`: TRUE [ FAIL 1 | WARN 0 | SKIP 0 | PASS 86 ] Error: ! Test failures. Execution halted * checking PDF version of manual ... [8s/12s] OK * checking HTML version of manual ... OK * checking for non-standard things in the check directory ... OK * checking for detritus in the temp directory ... OK * DONE Status: 2 ERRORs See ‘/data/gannet/ripley/R/packages/tests-ATLAS/MOSAlloc.Rcheck/00check.log’ for details. Command exited with non-zero status 1 Time 2:11.57, 57.45 + 7.16