Freezes the Redis data base of an ArchiveAsync to a data.table::data.table().
No further points can be added to the archive but the data can be accessed and analyzed.
Useful when the Redis data base is not permanently available.
Use the callback bbotk.async_freeze_archive to freeze the archive after the optimization has finished.
S3 Methods
as.data.table(archive)
ArchiveAsync ->data.table::data.table()
Returns a tabular view of all performed function calls of the Objective. Thex_domaincolumn is unnested to separate columns.
Super classes
bbotk::Archive -> bbotk::ArchiveAsync -> ArchiveAsyncFrozen
Active bindings
data(data.table::data.table)
Data table with all finished points.queued_data(data.table::data.table)
Data table with all queued points.running_data(data.table::data.table)
Data table with all running points.finished_data(data.table::data.table)
Data table with all finished points.failed_data(data.table::data.table)
Data table with all failed points.n_queued(
integer(1))
Number of queued points.n_running(
integer(1))
Number of running points.n_finished(
integer(1))
Number of finished points.n_failed(
integer(1))
Number of failed points.n_evals(
integer(1))
Number of evaluations stored in the archive.
Methods
Method new()
Creates a new instance of this R6 class.
Usage
ArchiveAsyncFrozen$new(archive)Arguments
archive(ArchiveAsync)
The archive to freeze.
Method push_points()
Push queued points to the archive.
Arguments
xss(list of named
list())
List of named lists of point values.
Method push_running_point()
Push running point to the archive.
Arguments
xs(named
list)
Named list of point values.extra(
list())
Named list of additional information.
Method push_result()
Push result to the archive.
Arguments
key(
character())
Key of the point.ys(
list())
Named list of results.x_domain(
list())
Named list of transformed point values.extra(
list())
Named list of additional information.
Method push_failed_point()
Push failed point to the archive.
Arguments
key(
character())
Key of the point.message(
character())
Error message.
Method data_with_state()
Fetch points with a specific state.
Arguments
fields(
character())
Fields to fetch. Defaults toc("xs", "ys", "xs_extra", "worker_extra", "ys_extra").states(
character())
States of the tasks to be fetched. Defaults toc("queued", "running", "finished", "failed").reset_cache(
logical(1))
Whether to reset the cache of the finished points.
Examples
# example only runs if a Redis server is available
if (mlr3misc::require_namespaces(c("rush", "redux", "mirai"), quietly = TRUE) &&
redux::redis_available()) {
# define the objective function
fun = function(xs) {
list(y = - (xs[[1]] - 2)^2 - (xs[[2]] + 3)^2 + 10)
}
# set domain
domain = ps(
x1 = p_dbl(-10, 10),
x2 = p_dbl(-5, 5)
)
# set codomain
codomain = ps(
y = p_dbl(tags = "maximize")
)
# create objective
objective = ObjectiveRFun$new(
fun = fun,
domain = domain,
codomain = codomain,
properties = "deterministic"
)
# start workers
rush::rush_plan(worker_type = "remote")
mirai::daemons(1)
# initialize instance
instance = oi_async(
objective = objective,
terminator = trm("evals", n_evals = 20),
callback = clbk("bbotk.async_freeze_archive")
)
# load optimizer
optimizer = opt("async_random_search")
# trigger optimization
optimizer$optimize(instance)
# frozen archive
instance$archive
# best performing configuration
instance$archive$best()
# covert to data.table
as.data.table(instance$archive)
}
#> state x1 x2 y timestamp_xs pid
#> <char> <num> <num> <num> <POSc> <int>
#> 1: finished 0.79964108 4.44173718 -46.820314 2026-03-09 09:06:52 16086
#> 2: finished 1.97171934 0.98977706 -5.919121 2026-03-09 09:06:52 16086
#> 3: finished -8.74678495 2.85974125 -139.829954 2026-03-09 09:06:52 16086
#> 4: finished -8.86620125 -0.52683197 -114.190890 2026-03-09 09:06:52 16086
#> 5: finished 0.07174052 2.66149936 -25.770760 2026-03-09 09:06:52 16086
#> 6: finished -7.51773958 -3.62287586 -80.975341 2026-03-09 09:06:52 16086
#> 7: finished 5.70333065 -4.08089324 -4.882988 2026-03-09 09:06:52 16086
#> 8: finished -6.10767685 3.07812258 -92.677998 2026-03-09 09:06:52 16086
#> 9: finished 9.84218962 4.26953198 -104.346033 2026-03-09 09:06:52 16086
#> 10: finished -9.43527839 3.90120726 -168.392253 2026-03-09 09:06:52 16086
#> 11: finished 7.50436097 -0.05695712 -28.959491 2026-03-09 09:06:52 16086
#> 12: finished -0.84870267 -1.03129050 -1.990924 2026-03-09 09:06:52 16086
#> 13: finished -0.03656525 0.22023930 -4.517539 2026-03-09 09:06:52 16086
#> 14: finished -8.26350117 0.25491344 -105.933918 2026-03-09 09:06:52 16086
#> 15: finished -2.40412588 -0.01124492 -18.328982 2026-03-09 09:06:52 16086
#> 16: finished 2.25513226 4.70309719 -49.402799 2026-03-09 09:06:52 16086
#> 17: finished -6.33460185 -3.98131188 -60.428561 2026-03-09 09:06:52 16086
#> 18: finished -7.94145157 -0.13848943 -97.020702 2026-03-09 09:06:52 16086
#> 19: finished -9.00099977 2.14240782 -137.466354 2026-03-09 09:06:53 16086
#> 20: finished -5.83602346 -2.01183452 -52.379735 2026-03-09 09:06:53 16086
#> state x1 x2 y timestamp_xs pid
#> <char> <num> <num> <num> <POSc> <int>
#> worker_id timestamp_ys
#> <char> <POSc>
#> 1: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 2: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 3: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 4: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 5: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 6: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 7: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 8: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 9: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 10: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 11: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 12: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 13: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 14: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 15: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 16: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 17: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 18: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:52
#> 19: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:53
#> 20: artsycraftsy_easteuropeanshepherd 2026-03-09 09:06:53
#> worker_id timestamp_ys
#> <char> <POSc>
#> keys x_domain_x1 x_domain_x2
#> <char> <num> <num>
#> 1: 0770f180-f52a-4bd8-93e6-331c01f4c26f 0.79964108 4.44173718
#> 2: 981b0903-520a-44fb-8999-6f9e52f78192 1.97171934 0.98977706
#> 3: b14d6c9c-574b-4c9c-a48d-97d91d4e1c83 -8.74678495 2.85974125
#> 4: beebf12e-9d7c-425e-8cbb-41cc8a5a2ed5 -8.86620125 -0.52683197
#> 5: 0569598f-d9ed-4f4d-a81d-6277ea1c0fa8 0.07174052 2.66149936
#> 6: 5c84c571-0d28-4d7f-8637-3030ba0cde7b -7.51773958 -3.62287586
#> 7: 4116e809-5e1c-48ae-acbe-cb44ab133ffc 5.70333065 -4.08089324
#> 8: 24129e90-075b-4259-9e8c-5eae40f6d5d3 -6.10767685 3.07812258
#> 9: 7ecf1318-aa2f-4ba5-8de4-182eaaa8546c 9.84218962 4.26953198
#> 10: 8a7e3a3c-a3f8-4459-802e-2b87ebb65b9a -9.43527839 3.90120726
#> 11: 44f2cd51-0d67-4bca-bb5a-a028eb01b87f 7.50436097 -0.05695712
#> 12: fa72acdc-9b6c-4921-83f5-8c68358dfebf -0.84870267 -1.03129050
#> 13: 976a01a6-2f1e-4054-8f54-29f35df9d375 -0.03656525 0.22023930
#> 14: 9b8472d7-10a8-41cd-adba-f9c1cd98b772 -8.26350117 0.25491344
#> 15: fb09f648-2445-4a12-9a79-0a2bda396248 -2.40412588 -0.01124492
#> 16: b8c2e1ef-e3b1-4426-9f82-322cbd9503e7 2.25513226 4.70309719
#> 17: f2f145c8-c432-4f96-b708-f86a134e1347 -6.33460185 -3.98131188
#> 18: cee3e770-0f65-4928-a347-36ef2e9428c9 -7.94145157 -0.13848943
#> 19: 2dd38e32-06ab-4791-b4d9-7e1efbb7398f -9.00099977 2.14240782
#> 20: 21484570-3be4-4326-906f-318e6eb33b6e -5.83602346 -2.01183452
#> keys x_domain_x1 x_domain_x2
#> <char> <num> <num>