Skip to content

Commit d167503

Browse files
committed
rebase and small stuff
1 parent e8f4876 commit d167503

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

R/infillOptFocus.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ infillOptFocus = function(infill.crit, models, control, par.set, opt.path, desig
8989
}
9090
} else if (isDiscrete(par)) {
9191
# randomly drop a level, which is not val
92-
if (length(par$values) <= 1L) {
92+
if (length(par$values) == 1L) {
9393
return(par)
9494
}
9595
# need to do some magic to handle discrete vectors
9696
if (par$type %nin% c("discretevector", "logicalvector")) {
9797
val.names = names(par$values)
9898
# remove current val from delete options, should work also for NA
99-
val.names = val.names[!sapply(par$values, identical, y=val)] # remember, 'val' can be any type
99+
val.names = val.names[!vlapply(par$values, identical, y=val)] # remember, 'val' can be any type
100100
to.del = sample(val.names, 1)
101101
par$values[[to.del]] = NULL
102102
} else {

tests/testthat/test_infill_opt_focus.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ test_that("complex param space, dependencies, focusing, restarts", {
6464
if(x$disc2 == 'a') tmp3 = log(x$realA) + x$intA^4 + ifelse(x$discA == 'm', 5, 0)
6565
if(x$disc2 == 'b') tmp3 = exp(x$realB) + ifelse(x$discB == 'R', sin(x$realBR), sin(x$realBNR))
6666
if(x$disc2 == "c") tmp3 = 500
67-
assert(is.list(x$discVec))
68-
assert(x$discVec[[1]] %in% c("a", "b", "c"))
69-
assert(x$discScal %in% c("x", "y", "z"))
67+
expect_list(x$discVec)
68+
expect_subset(x$discVec[[1]], c("a", "b", "c"))
69+
expect_subset(x$discScal, c("x", "y", "z"))
7070
tmp1 + tmp2 + tmp3
7171
},
7272
par.set = makeParamSet(

0 commit comments

Comments
 (0)