Skip to contents

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. The x_domain column is unnested to separate columns.

See also

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

Inherited methods


ArchiveAsyncFrozen$new()

Creates a new instance of this R6 class.

Usage

ArchiveAsyncFrozen$new(archive)

Arguments

archive

(ArchiveAsync)
The archive to freeze.


ArchiveAsyncFrozen$push_points()

Push queued points to the archive.

Usage

ArchiveAsyncFrozen$push_points(xss, xss_extra = NULL, profile = NULL)

Arguments

xss

(list of named list())
List of named lists of point values.

xss_extra

(list of named list() | NULL)
List of named lists of additional information.

profile

(character(1) | NULL)
Name of the mirai compute profile the points are queued for.


ArchiveAsyncFrozen$push_point()

Push a single queued point to the archive.

Usage

ArchiveAsyncFrozen$push_point(xs, xs_extra = NULL, profile = NULL)

Arguments

xs

(named list())
Named list of point values.

xs_extra

(named list() | NULL)
Named list of additional information.

profile

(character(1) | NULL)
Name of the mirai compute profile the point is queued for.


ArchiveAsyncFrozen$push_running_points()

Push running points to the archive.

Usage

ArchiveAsyncFrozen$push_running_points(xss, xss_extra = NULL)

Arguments

xss

(list of named list())
List of named lists of point values.

xss_extra

(list of named list() | NULL)
List of named lists of additional information.


ArchiveAsyncFrozen$push_running_point()

Push running point to the archive.

Usage

ArchiveAsyncFrozen$push_running_point(xs, xs_extra = NULL)

Arguments

xs

(named list())
Named list of point values.

xs_extra

(named list() | NULL)
Named list of additional information.


ArchiveAsyncFrozen$push_finished_points()

Push finished points to the archive.

Usage

ArchiveAsyncFrozen$push_finished_points(
  xss,
  yss,
  xss_extra = NULL,
  yss_extra = NULL
)

Arguments

xss

(list of named list())
List of named lists of point values.

yss

(list of named list())
List of named lists of results.

xss_extra

(list of named list() | NULL)
List of named lists of additional information.

yss_extra

(list of named list() | NULL)
List of named lists of additional information.


ArchiveAsyncFrozen$push_finished_point()

Push a single finished point to the archive.

Usage

ArchiveAsyncFrozen$push_finished_point(
  xs,
  ys,
  xs_extra = NULL,
  ys_extra = NULL
)

Arguments

xs

(named list())
Named list of point values.

ys

(named list())
Named list of results.

xs_extra

(named list() | NULL)
Named list of additional information.

ys_extra

(named list() | NULL)
Named list of additional information.


ArchiveAsyncFrozen$push_failed_points()

Push failed points to the archive.

Usage

ArchiveAsyncFrozen$push_failed_points(xss, xss_extra = NULL, conditions = NULL)

Arguments

xss

(list of named list())
List of named lists of point values.

xss_extra

(list of named list() | NULL)
List of named lists of additional information.

conditions

(list | NULL)
List of conditions for each failed point. If NULL, a generic error message is used.


ArchiveAsyncFrozen$push_failed_point()

Push a single failed point to the archive.

Usage

ArchiveAsyncFrozen$push_failed_point(xs, xs_extra = NULL, condition = NULL)

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. If NULL, a generic error message is used.


ArchiveAsyncFrozen$pop_point()

Pop a point from the queue.

Usage

ArchiveAsyncFrozen$pop_point()


ArchiveAsyncFrozen$finish_points()

Save the results of multiple running points and move them to the finished points.

Usage

ArchiveAsyncFrozen$finish_points(keys, yss, x_domains, yss_extra = NULL)

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.

Usage

ArchiveAsyncFrozen$finish_point(key, ys, x_domain, ys_extra = NULL)

Arguments

key

(character(1))
Key of the point.

ys

(named list())
Named list of results.

x_domain

(named list())
Named list of transformed point values.

ys_extra

(named list() | NULL)
Named list of additional information.


ArchiveAsyncFrozen$fail_points()

Move multiple running points to the failed points.

Usage

ArchiveAsyncFrozen$fail_points(keys, conditions = NULL)

Arguments

keys

(character())
Keys of the points.

conditions

(list() | NULL)
Conditions of the failed points.


ArchiveAsyncFrozen$fail_point()

Move a running point to the failed points.

Usage

ArchiveAsyncFrozen$fail_point(key, condition = NULL)

Arguments

key

(character(1))
Key of the point.

condition

(any | NULL)
Condition of the failed point.


ArchiveAsyncFrozen$push_result()

Deprecated. Use $finish_point() instead.

Usage

ArchiveAsyncFrozen$push_result(key, ys, x_domain, extra = NULL)

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.

Usage

ArchiveAsyncFrozen$data_with_state(
  fields = c("xs", "ys", "xs_extra", "worker_extra", "ys_extra", "condition"),
  states = c("queued", "running", "finished", "failed"),
  reset_cache = FALSE
)

Arguments

fields

(character())
Fields to fetch. Defaults to c("xs", "ys", "xs_extra", "worker_extra", "ys_extra").

states

(character())
States of the tasks to be fetched. Defaults to c("queued", "running", "finished", "failed").

reset_cache

(logical(1))
Whether to reset the cache of the finished points.


ArchiveAsyncFrozen$clear()

Clear all evaluation results from archive.

Usage

ArchiveAsyncFrozen$clear()


ArchiveAsyncFrozen$clone()

The objects of this class are cloneable with this method.

Usage

ArchiveAsyncFrozen$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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-03 10:50:13
#>  2: finished -2.62264757  4.2779729  -64.337761 2026-09-03 10:50:14
#>  3: finished  6.84682656  3.2309502  -52.316468 2026-09-03 10:50:14
#>  4: finished -1.96786549 -3.4438612   -5.940969 2026-09-03 10:50:14
#>  5: finished -9.86571338  2.5243351 -161.313432 2026-09-03 10:50:14
#>  6: finished  0.01208465  3.1304511  -31.534238 2026-09-03 10:50:14
#>  7: finished -4.77998488  1.4299587  -55.592729 2026-09-03 10:50:14
#>  8: finished  7.57503606  1.3830058  -40.291767 2026-09-03 10:50:14
#>  9: finished  8.01326577 -2.8537699  -26.180748 2026-09-03 10:50:14
#> 10: finished  5.39871055  2.9134685  -36.520343 2026-09-03 10:50:14
#> 11: finished  4.82894640 -0.2106949   -5.783161 2026-09-03 10:50:14
#> 12: finished  2.92831418 -0.4491262    2.631276 2026-09-03 10:50:14
#> 13: finished -2.48881904  1.6091926  -31.394153 2026-09-03 10:50:14
#> 14: finished  2.11332211  1.0427817   -6.356925 2026-09-03 10:50:14
#> 15: finished  0.87403046  4.3072392  -44.663553 2026-09-03 10:50:14
#> 16: finished -5.88500581 -0.9916228  -56.206896 2026-09-03 10:50:14
#> 17: finished  4.08136954  3.9785972  -43.032918 2026-09-03 10:50:14
#> 18: finished -7.80489880 -3.6260806  -86.528017 2026-09-03 10:50:14
#> 19: finished -9.37102033 -3.4632716 -119.514724 2026-09-03 10:50:14
#> 20: finished  5.22167868  0.7561287  -14.487716 2026-09-03 10:50:14
#>        state          x1         x2           y        timestamp_xs
#>       <char>       <num>      <num>       <num>              <POSc>
#>                                      worker_id        timestamp_ys
#>                                         <char>              <POSc>
#>  1: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:13
#>  2: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#>  3: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#>  4: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#>  5: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#>  6: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#>  7: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#>  8: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#>  9: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 10: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 11: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 12: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 13: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 14: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 15: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 16: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 17: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 18: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 19: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#> 20: artsycraftsy_easteuropeanshepherd_e76ea3c1 2026-09-03 10:50:14
#>                                      worker_id        timestamp_ys
#>                                         <char>              <POSc>
#>                                     keys x_domain_x1 x_domain_x2
#>                                   <char>       <num>       <num>
#>  1: 49159c25-7ea9-4007-88a2-e34555be30f5 -6.21358293   0.2769503
#>  2: 561bfce1-89f6-4aa2-bcde-d669e5176638 -2.62264757   4.2779729
#>  3: 469b6409-7e96-49d6-8478-61eb863493d6  6.84682656   3.2309502
#>  4: cc36bae6-de84-4c88-a9ea-f56a1f64dc43 -1.96786549  -3.4438612
#>  5: 57c40887-235f-41d0-99f6-6edd214d49e1 -9.86571338   2.5243351
#>  6: f59f5837-c2fa-4546-8d9a-2495bf8b85d6  0.01208465   3.1304511
#>  7: 20520004-cb0a-439e-a15f-36022284d472 -4.77998488   1.4299587
#>  8: 240c4d4a-749a-485f-b644-33c94bd0959c  7.57503606   1.3830058
#>  9: 85f274a7-71f1-48d8-b738-e4d5c153151f  8.01326577  -2.8537699
#> 10: 85c59a03-8442-4fe7-8bf9-52ae1a7dd473  5.39871055   2.9134685
#> 11: dfb31a2a-6134-4a73-9165-c56b9799c1b7  4.82894640  -0.2106949
#> 12: 435185e8-fb82-491b-acb5-71bfa40c2c0a  2.92831418  -0.4491262
#> 13: f01fee8f-4172-4dac-84b0-9c1438f93f99 -2.48881904   1.6091926
#> 14: 3cb0f2a5-cac4-4b8e-bc69-39db55ce4a56  2.11332211   1.0427817
#> 15: 83af7e00-0400-4d42-9fd5-3f3ad724cfbc  0.87403046   4.3072392
#> 16: 10555af3-c486-4578-9ca8-f5db5f827de9 -5.88500581  -0.9916228
#> 17: b78787d5-f647-411a-877d-ac58c922c031  4.08136954   3.9785972
#> 18: 36e244b3-6363-4878-b433-a157f5718bab -7.80489880  -3.6260806
#> 19: 143a0ae0-499a-452c-b3ff-68c9bcfd8822 -9.37102033  -3.4632716
#> 20: ca5afb3d-da19-46fd-ae10-c85eda6c1b46  5.22167868   0.7561287
#>                                     keys x_domain_x1 x_domain_x2
#>                                   <char>       <num>       <num>