Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Nov 7, 2024
2 parents d8117b0 + c9d4ee1 commit 8c17383
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/OptimizerAsyncDesignPoints.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ OptimizerAsyncDesignPoints = R6Class("OptimizerAsyncDesignPoints",
id = "design_points",
param_set = param_set,
param_classes = c("ParamLgl", "ParamInt", "ParamDbl", "ParamFct", "ParamUty"),
properties = c("dependencies", "single-crit", "multi-crit"),
properties = c("dependencies", "single-crit", "multi-crit", "async"),
packages = "rush",
label = "Asynchronous Design Points",
man = "bbotk::mlr_optimizers_async_design_points"
Expand Down
2 changes: 1 addition & 1 deletion R/OptimizerAsyncGridSearch.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ OptimizerAsyncGridSearch = R6Class("OptimizerAsyncGridSearch",
id = "async_grid_search",
param_set = param_set,
param_classes = c("ParamLgl", "ParamInt", "ParamDbl", "ParamFct"),
properties = c("dependencies", "single-crit", "multi-crit"),
properties = c("dependencies", "single-crit", "multi-crit", "async"),
packages = "rush",
label = "Asynchronous Grid Search",
man = "bbotk::mlr_optimizers_async_grid_search"
Expand Down
2 changes: 1 addition & 1 deletion R/OptimizerAsyncRandomSearch.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OptimizerAsyncRandomSearch = R6Class("OptimizerAsyncRandomSearch",
id = "async_random_search",
param_set = ps(),
param_classes = c("ParamLgl", "ParamInt", "ParamDbl", "ParamFct"),
properties = c("dependencies", "single-crit", "multi-crit"),
properties = c("dependencies", "single-crit", "multi-crit", "async"),
packages = "rush",
label = "Asynchronous Random Search",
man = "bbotk::mlr_optimizers_random_search"
Expand Down
2 changes: 1 addition & 1 deletion R/bbotk_reflections.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bbotk_reflections = new.env(parent = emptyenv())

### optimizer_properties
bbotk_reflections$optimizer_properties = c(
"dependencies", "single-crit", "multi-crit"
"dependencies", "single-crit", "multi-crit", "async"
)

### objective_properties
Expand Down
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)

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

0 comments on commit 8c17383

Please sign in to comment.