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
Archive -> 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
ArchiveAsyncFrozen$new()
Creates a new instance of this R6 class.
Usage
ArchiveAsyncFrozen$new(archive)Arguments
archive(ArchiveAsync)
The archive to freeze.
ArchiveAsyncFrozen$push_failed_point()
Push a single failed point to the archive.
Arguments
xs(named
list())
Named list of point values.xs_extra(
named list()|NULL)
Named list of additional information.condition(
any|NULL)
Condition of the failed point. IfNULL, a generic error message is used.
ArchiveAsyncFrozen$finish_points()
Save the results of multiple running points and move them to the finished points.
Arguments
keys(
character())
Keys of the points.yss(list of named
list())
List of named lists of results.x_domains(
list())
List of named lists of transformed point values.yss_extra(list of named
list()|NULL)
List of named lists of additional information.
ArchiveAsyncFrozen$finish_point()
Save the results of a running point and move it to the finished points.
ArchiveAsyncFrozen$fail_points()
Move multiple running points to the failed points.
Arguments
keys(
character())
Keys of the points.conditions(
list()|NULL)
Conditions of the failed points.
ArchiveAsyncFrozen$push_result()
Deprecated.
Use $finish_point() instead.
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.
ArchiveAsyncFrozen$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 = "mirai")
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
#> <char> <num> <num> <num> <POSc>
#> 1: finished -6.21358293 0.2769503 -68.201348 2026-09-18 09:11:53
#> 2: finished -2.62264757 4.2779729 -64.337761 2026-09-18 09:11:53
#> 3: finished 6.84682656 3.2309502 -52.316468 2026-09-18 09:11:53
#> 4: finished -1.96786549 -3.4438612 -5.940969 2026-09-18 09:11:53
#> 5: finished -9.86571338 2.5243351 -161.313432 2026-09-18 09:11:53
#> 6: finished 0.01208465 3.1304511 -31.534238 2026-09-18 09:11:53
#> 7: finished -4.77998488 1.4299587 -55.592729 2026-09-18 09:11:53
#> 8: finished 7.57503606 1.3830058 -40.291767 2026-09-18 09:11:53
#> 9: finished 8.01326577 -2.8537699 -26.180748 2026-09-18 09:11:53
#> 10: finished 5.39871055 2.9134685 -36.520343 2026-09-18 09:11:53
#> 11: finished 4.82894640 -0.2106949 -5.783161 2026-09-18 09:11:53
#> 12: finished 2.92831418 -0.4491262 2.631276 2026-09-18 09:11:53
#> 13: finished -2.48881904 1.6091926 -31.394153 2026-09-18 09:11:53
#> 14: finished 2.11332211 1.0427817 -6.356925 2026-09-18 09:11:54
#> 15: finished 0.87403046 4.3072392 -44.663553 2026-09-18 09:11:54
#> 16: finished -5.88500581 -0.9916228 -56.206896 2026-09-18 09:11:54
#> 17: finished 4.08136954 3.9785972 -43.032918 2026-09-18 09:11:54
#> 18: finished -7.80489880 -3.6260806 -86.528017 2026-09-18 09:11:54
#> 19: finished -9.37102033 -3.4632716 -119.514724 2026-09-18 09:11:54
#> 20: finished 5.22167868 0.7561287 -14.487716 2026-09-18 09:11:54
#> state x1 x2 y timestamp_xs
#> <char> <num> <num> <num> <POSc>
#> worker_id timestamp_ys
#> <char> <POSc>
#> 1: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 2: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 3: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 4: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 5: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 6: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 7: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 8: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 9: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 10: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 11: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 12: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 13: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:53
#> 14: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:54
#> 15: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:54
#> 16: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:54
#> 17: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:54
#> 18: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:54
#> 19: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:54
#> 20: artsycraftsy_easteuropeanshepherd_2eef17fe 2026-09-18 09:11:54
#> worker_id timestamp_ys
#> <char> <POSc>
#> keys x_domain_x1 x_domain_x2
#> <char> <num> <num>
#> 1: c46af07b-8d16-4456-b4a5-9f6c7f64a5d8 -6.21358293 0.2769503
#> 2: 5d5e1765-180b-42a8-b2b4-4ff9a16499d2 -2.62264757 4.2779729
#> 3: f1ab21be-270c-404c-a5d5-4e1983ca6167 6.84682656 3.2309502
#> 4: 4433c190-0b14-4b24-8756-468cb4c8ff9a -1.96786549 -3.4438612
#> 5: 0abac91b-9c84-43d3-912c-bcc9125d5857 -9.86571338 2.5243351
#> 6: e2a5e53d-301d-4ec6-badb-36a3ac659890 0.01208465 3.1304511
#> 7: 9270b242-269c-4a6b-a923-b59dcbc8662d -4.77998488 1.4299587
#> 8: e37f26f4-d716-4422-b022-2068f5cde30f 7.57503606 1.3830058
#> 9: 8f069197-6187-4df5-9f6f-75a57b2e3e06 8.01326577 -2.8537699
#> 10: 5da987a1-0218-44ad-9c67-4782419658c0 5.39871055 2.9134685
#> 11: 62fef3b5-4e41-4edd-8a6b-8675d2632deb 4.82894640 -0.2106949
#> 12: 4119f126-204f-4e28-b888-3ebe3eae1af7 2.92831418 -0.4491262
#> 13: 516b755b-77ab-4a07-a497-0889cb7d8499 -2.48881904 1.6091926
#> 14: 5430fef6-693e-417e-aeb3-11f06c66457e 2.11332211 1.0427817
#> 15: d5be22d5-8fb7-45eb-b0f8-57249a03c125 0.87403046 4.3072392
#> 16: f1327382-ae7b-4720-ac22-3b176e6ce82f -5.88500581 -0.9916228
#> 17: bdb62a3a-22ba-4ebb-b96c-88c57dcdc922 4.08136954 3.9785972
#> 18: b00d0fc9-b1f3-4b21-980f-0a91e7a02951 -7.80489880 -3.6260806
#> 19: 28bb6928-2411-436d-8e3d-b4e4e0af6307 -9.37102033 -3.4632716
#> 20: f53ed578-527e-46f1-a5b4-5beff9b4edab 5.22167868 0.7561287
#> keys x_domain_x1 x_domain_x2
#> <char> <num> <num>