Skip to content

Commit 8c2635c

Browse files
committed
fix setMBOControlTermination argument check (Fixes #245)
1 parent bd2f463 commit 8c2635c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

R/setMBOControlTermination.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ setMBOControlTermination = function(control,
6161

6262
stop.conds = more.stop.conds
6363

64-
if (is.null(iters) && is.null(time.budget) && is.null(exec.time.budget) && length(stop.conds) == 0L) {
64+
if (is.null(iters) && is.null(time.budget) && is.null(exec.time.budget) && is.null(max.evals) && length(stop.conds) == 0L) {
6565
stopf("You need to specify a maximal number of iteration, a time budget or at least
6666
one custom stopping condition, but you provided neither.")
6767
}

tests/testthat/test_stopping_criteria.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test_that("stopping criteria works", {
1414

1515
# time budget
1616
ctrl = makeMBOControl()
17-
ctrl = setMBOControlTermination(ctrl, iters = iters, time.budget = time.budget)
17+
ctrl = setMBOControlTermination(ctrl, time.budget = time.budget)
1818
or = mbo(f, design = design, learner = learner, control = ctrl)
1919

2020
expect_equal(or$final.state, "term.time")
@@ -25,11 +25,11 @@ test_that("stopping criteria works", {
2525
or = mbo(f, design = design, learner = learner, control = ctrl)
2626

2727
expect_equal(or$final.state, "term.yval")
28-
expect_less_than(or$y, target.fun.value)
28+
expect_lt(or$y, target.fun.value)
2929

3030
# maximal number of target function evaluations
3131
ctrl = makeMBOControl()
32-
ctrl = setMBOControlTermination(ctrl, iters = iters, max.evals = max.evals)
32+
ctrl = setMBOControlTermination(ctrl, max.evals = max.evals)
3333
or = mbo(f, design = design, learner = learner, control = ctrl)
3434

3535
expect_equal(or$final.state, "term.feval")

0 commit comments

Comments
 (0)