File tree Expand file tree Collapse file tree 3 files changed +26
-6
lines changed
Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ addIterations <- function(
7474
7575 # Set up for iterations
7676 FUN <- optObj $ FUN
77- boundsDT <- boundsToDT(optObj $ bounds )
77+ boundsDT <- boundsToDT(bounds )
7878 scoreSummary <- optObj $ scoreSummary
7979 Epoch <- max(scoreSummary $ Epoch )
8080 `%op%` <- ParMethod(parallel )
@@ -141,6 +141,7 @@ addIterations <- function(
141141 tm <- system.time(
142142 LocalOptims <- getLocalOptimums(
143143 optObj
144+ , bounds = bounds
144145 , parallel = parallel
145146 , verbose = verbose
146147 )
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ test_that(
77 skip_on_cran()
88
99 set.seed(1991 )
10- sf <- function (x ) 100 - x ^ 2
10+ sf <- function (x ) 100 - x ^ 2 / 5
1111 FUN <- function (x ) {
1212 return (list (Score = sf(x )))
1313 }
@@ -32,18 +32,20 @@ test_that(
3232 , gsPoints = 10
3333 )
3434
35- # Test adding iterations with higher iters.k
35+ # Test adding iterations with higher iters.k and different bounds
36+ newBounds <- list (x = c(- 2 ,8 ))
3637 optObj <- addIterations(
3738 optObj
38- , iters.n = 4
39+ , bounds = newBounds
40+ , iters.n = 6
3941 , iters.k = 2
4042 , verbose = 0
4143 , gsPoints = 10
4244 )
4345
4446 print(optObj )
4547
46- expect_equal(nrow(optObj $ scoreSummary ) , 12 )
48+ expect_equal(nrow(optObj $ scoreSummary ) , 14 )
4749
4850 }
4951
Original file line number Diff line number Diff line change @@ -45,6 +45,23 @@ testthat::test_that(
4545 , gsPoints = 10
4646 )
4747
48- expect_true(nrow(optObj $ scoreSummary ) == 10 )
48+
49+ # Piggy back off of this test. Check new bounds.
50+ newBounds <- list (
51+ x = c(- 5 ,20 )
52+ , y = c(- 30 ,110 )
53+ )
54+
55+ optObj <- addIterations(
56+ optObj
57+ , bounds = newBounds
58+ , iters.n = 2
59+ , iters.k = 2
60+ , verbose = 0
61+ , gsPoints = 10
62+ )
63+
64+ expect_true(nrow(optObj $ scoreSummary ) == 12 )
65+
4966 }
5067)
You can’t perform that action at this time.
0 commit comments