Skip to content

Commit

Permalink
tests: restarting the optimization works
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Nov 7, 2024
1 parent 25a7b5c commit 827dea4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/testthat/test_OptimizerAsync.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,32 @@ test_that("OptimizerAsync throws an error when all workers are lost", {

expect_rush_reset(instance$rush)
})

test_that("restarting the optimization works", {
skip_on_cran()
skip_if_not_installed("rush")
flush_redis()
library(rush)

rush_plan(n_workers = 2)

instance = oi_async(
objective = OBJ_2D,
search_space = PS_2D,
terminator = trm("evals", n_evals = 5L),
)

optimizer = opt("async_random_search")
optimizer$optimize(instance)

expect_data_table(instance$archive$data, min.rows = 5L)

Sys.sleep(1)

instance$terminator$param_set$values$n_evals = 30L

optimizer = opt("async_random_search")
optimizer$optimize(instance)

instance$archive
})

0 comments on commit 827dea4

Please sign in to comment.