@@ -11,36 +11,36 @@ test_that("adaptive infill crit works with all termination criteria", {
1111 design.max $ y = apply(design.max , 1 , f.max )
1212
1313 terminations = list (
14- list (iters = 4L ),
15- list (time.budget = 2 ),
16- list (exec.time.budget = 1.5 , iters = 13 , use.for.adaptive.infill = " exec.time.budget" ),
17- list (target.fun.value = min(design $ y )/ 3 , iters = 13 , use.for.adaptive.infill = " target.fun.value" ),
18- list (target.fun.value = max(design.max $ y )/ 3 , iters = 13 , use.for.adaptive.infill = " target.fun.value" ),
19- list (max.evals = nrow(design ) + 4L )
14+ iters = list (iters = 4L ),
15+ time.budget = list (time.budget = 2 ),
16+ exec.time.budget = list (exec.time.budget = 1.5 , iters = 13 , use.for.adaptive.infill = " exec.time.budget" ),
17+ target.fun.value = list (target.fun.value = min(design $ y )/ 3 , iters = 13 , use.for.adaptive.infill = " target.fun.value" ),
18+ target.fun.value.max = list (target.fun.value = max(design.max $ y )/ 3 , iters = 13 , use.for.adaptive.infill = " target.fun.value" ),
19+ max.evals = list (max.evals = nrow(design ) + 4L )
2020 )
2121
2222 ctrl = makeMBOControl()
2323 ctrl = setMBOControlInfill(ctrl , crit = makeMBOInfillCritAdaCB())
2424
25- for (i in seq_along (terminations )) {
25+ for (i in names (terminations )) {
2626 ctrl2 = do.call(setMBOControlTermination , c(list (control = ctrl ), terminations [[i ]]))
27- if (i %in% 2 : 3 ) {
27+ if (i == " exec.time.budget " ) {
2828 fun = f.slow
2929 des = design
30- } else if (i == 5 ) {
30+ } else if (i == " target.fun.value.max " ) {
3131 fun = f.max
3232 des = design.max
3333 } else {
3434 fun = f
3535 des = design
3636 }
3737 or = mbo(fun , des , control = ctrl2 )
38- expect_number(or $ y )
38+ expect_number(or $ y , info = i )
3939 df = as.data.frame(or $ opt.path )
40- expect_true(any(df $ lambda > 1 ))
41- expect_true(length(unique(df $ lambda ))> 2 )
42- expect_true(all(diff(df $ lambda [! is.na(df $ lambda )])< = 0 ))
43- expect_true(all(df $ prop.type %in% c(" infill_adacb" , " initdesign" )))
44- expect_numeric(df $ adacb )
40+ expect_true(any(df $ lambda > 1 ), info = i )
41+ expect_true(length(unique(df $ lambda )) > = 2 , info = i )
42+ expect_true(all(diff(df $ lambda [! is.na(df $ lambda )])< = 0 ), info = i )
43+ expect_true(all(df $ prop.type %in% c(" infill_adacb" , " initdesign" )), info = i )
44+ expect_numeric(df $ adacb , info = i )
4545 }
4646})
0 commit comments