Skip to content

Commit 75b6b30

Browse files
committed
archive design
1 parent e3be42c commit 75b6b30

File tree

9 files changed

+60
-30
lines changed

9 files changed

+60
-30
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ Collate:
9393
'AcqFunctionStochasticEI.R'
9494
'AcqOptimizer.R'
9595
'aaa.R'
96-
'OptimizerAsyncMbo.R'
9796
'OptimizerADBO.R'
97+
'OptimizerAsyncMbo.R'
9898
'OptimizerMbo.R'
9999
'mlr_result_assigners.R'
100100
'ResultAssigner.R'
@@ -104,8 +104,8 @@ Collate:
104104
'SurrogateLearner.R'
105105
'SurrogateLearnerAsync.R'
106106
'SurrogateLearnerCollection.R'
107-
'TunerAsyncMbo.R'
108107
'TunerADBO.R'
108+
'TunerAsyncMbo.R'
109109
'TunerMbo.R'
110110
'mlr_loop_functions.R'
111111
'bayesopt_ego.R'

NAMESPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export(AcqFunctionSmsEgo)
1919
export(AcqFunctionStochasticCB)
2020
export(AcqFunctionStochasticEI)
2121
export(AcqOptimizer)
22-
export(OptimizerAsyncMbo)
2322
export(OptimizerADBO)
23+
export(OptimizerAsyncMbo)
2424
export(OptimizerMbo)
2525
export(ResultAssigner)
2626
export(ResultAssignerArchive)
@@ -29,8 +29,8 @@ export(Surrogate)
2929
export(SurrogateLearner)
3030
export(SurrogateLearnerAsync)
3131
export(SurrogateLearnerCollection)
32-
export(TunerAsyncMbo)
3332
export(TunerADBO)
33+
export(TunerAsyncMbo)
3434
export(TunerMbo)
3535
export(acqf)
3636
export(acqfs)

R/OptimizerAsyncMbo.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ OptimizerAsyncMbo = R6Class("OptimizerAsyncMbo",
102102
pv = self$param_set$values
103103

104104
# initial design
105-
design = if (is.null(pv$initial_design)) {
105+
design = if (inst$archive$n_evals) {
106+
lg$debug("Using archive with %s evaluations as initial design", inst$archive$n_evals)
107+
NULL
108+
} else if (is.null(pv$initial_design)) {
106109
# generate initial design
107110
generate_design = switch(pv$design_function,
108111
"random" = generate_design_random,

man/mlr_optimizers_adbo.Rd

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/mlr_optimizers_async_mbo.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/mlr_tuners_adbo.Rd

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

tests/testthat/test_OptimizerAsyncMbo.R

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,30 @@ test_that("async optimizer works in defaults", {
1818
expect_rush_reset(instance$rush)
1919
})
2020

21+
test_that("async optimizer works with evaluations in archive", {
22+
skip_on_cran()
23+
skip_if_not_installed("rush")
24+
flush_redis()
25+
26+
rush::rush_plan(n_workers = 2)
27+
instance = oi_async(
28+
objective = OBJ_2D,
29+
search_space = PS_2D,
30+
terminator = trm("evals", n_evals = 10),
31+
)
32+
33+
optimizer = opt("async_random_search")
34+
optimizer$optimize(instance)
35+
36+
37+
instance$terminator$param_set$values$n_evals = 30
38+
39+
optimizer = opt("async_mbo")
40+
optimizer$optimize(instance)
41+
42+
instance$archive
43+
expect_data_table(instance$archive$data[is.na(get("acq_cb"))], min.rows = 10)
44+
expect_data_table(instance$archive$data[!is.na(get("acq_cb"))], min.rows = 20)
45+
46+
expect_rush_reset(instance$rush)
47+
})

0 commit comments

Comments
 (0)