-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathtest-bayesOpt2D.R
More file actions
67 lines (51 loc) · 1.04 KB
/
test-bayesOpt2D.R
File metadata and controls
67 lines (51 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
test_that(
"2 Dimension"
, {
skip_on_cran()
set.seed(1991)
sf <- function(x,y) 1000 - (x-5)^2 - (y + 10)^2
FUN <- function(x,y) {
return(list(Score = sf(x,y)))
}
bounds = list(
x = c(0,15)
, y = c(-20,100)
)
optObj <- bayesOpt(
FUN
, bounds
, initPoints = 4
, iters.n = 2
, verbose = 0
)
expect_true(optObj$stopStatus == "OK")
expect_true(nrow(optObj$scoreSummary) == 6)
optObj <- addIterations(
optObj
, iters.n = 2
, verbose = 0
, gsPoints = 10
)
optObj <- addIterations(
optObj
, iters.n = 2
, iters.k = 2
, verbose = 0
, gsPoints = 10
)
# Piggy back off of this test. Check new bounds.
newBounds <- list(
x = c(-5,20)
, y = c(-30,110)
)
optObj <- addIterations(
optObj
, bounds = newBounds
, iters.n = 2
, iters.k = 2
, verbose = 0
, gsPoints = 10
)
expect_true(nrow(optObj$scoreSummary) == 12)
}
)