diff --git a/NAMESPACE b/NAMESPACE index 3328f5c5..7ea851ab 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -80,7 +80,6 @@ export(callback_async) export(callback_batch) export(clbk) export(clbks) -export(evaluate_queue_default) export(is_dominated) export(mlr_callbacks) export(mlr_optimizers) diff --git a/R/CallbackAsync.R b/R/CallbackAsync.R index 05a39694..efa04570 100644 --- a/R/CallbackAsync.R +++ b/R/CallbackAsync.R @@ -13,18 +13,28 @@ CallbackAsync = R6Class("CallbackAsync", public = list( #' @field on_optimization_begin (`function()`)\cr - #' Stage called at the beginning of the optimization in the main process. - #' Called in `Optimizer$optimize()`. + #' Stage called at the beginning of the optimization in the main process. + #' Called in `Optimizer$optimize()`. on_optimization_begin = NULL, #' @field on_worker_begin (`function()`)\cr - #' Stage called at the beginning of the optimization on the worker. - #' Called in the worker loop. + #' Stage called at the beginning of the optimization on the worker. + #' Called in the worker loop. on_worker_begin = NULL, + #' @field on_optimizer_before_eval (`function()`)\cr + #' Stage called after the optimizer proposes points. + #' Called in `OptimInstance$.eval_point()`. + on_optimizer_before_eval = NULL, + + #' @field on_optimizer_after_eval (`function()`)\cr + #' Stage called after points are evaluated. + #' Called in `OptimInstance$.eval_point()`. + on_optimizer_after_eval = NULL, + #' @field on_worker_end (`function()`)\cr - #' Stage called at the end of the optimization on the worker. - #' Called in the worker loop. + #' Stage called at the end of the optimization on the worker. + #' Called in the worker loop. on_worker_end = NULL, #' @field on_result (`function()`)\cr @@ -52,6 +62,10 @@ CallbackAsync = R6Class("CallbackAsync", #' - on_optimization_begin #' Start Worker #' - on_worker_begin +#' Start Optimization on Worker +#' - on_optimizer_before_eval +#' - on_optimizer_after_eval +#' End Optimization on Worker #' - on_worker_end #' End Worker #' - on_result @@ -81,6 +95,14 @@ CallbackAsync = R6Class("CallbackAsync", #' Stage called at the beginning of the optimization on the worker. #' Called in the worker loop. #' The functions must have two arguments named `callback` and `context`. +#' @param on_optimizer_before_eval (`function()`)\cr +#' Stage called after the optimizer proposes points. +#' Called in `OptimInstance$eval_point()`. +#' The functions must have two arguments named `callback` and `context`. +#' @param on_optimizer_after_eval (`function()`)\cr +#' Stage called after points are evaluated. +#' Called in `OptimInstance$eval_point()`. +#' The functions must have two arguments named `callback` and `context`. #' @param on_worker_end (`function()`)\cr #' Stage called at the end of the optimization on the worker. #' Called in the worker loop. @@ -101,6 +123,8 @@ callback_async = function( man = NA_character_, on_optimization_begin = NULL, on_worker_begin = NULL, + on_optimizer_before_eval = NULL, + on_optimizer_after_eval = NULL, on_worker_end = NULL, on_result = NULL, on_optimization_end = NULL @@ -108,11 +132,15 @@ callback_async = function( stages = discard(set_names(list( on_optimization_begin, on_worker_begin, + on_optimizer_before_eval, + on_optimizer_after_eval, on_worker_end, on_result, on_optimization_end), c("on_optimization_begin", "on_worker_begin", + "on_optimizer_before_eval", + "on_optimizer_after_eval", "on_worker_end", "on_result", "on_optimization_end")), is.null) diff --git a/R/ContextAsync.R b/R/ContextAsync.R index 814cca35..a3df69de 100644 --- a/R/ContextAsync.R +++ b/R/ContextAsync.R @@ -33,13 +33,53 @@ ContextAsync = R6Class("ContextAsync", active = list( #' @field result ([data.table::data.table])\cr - #' The result of the optimization. + #' The result of the optimization. result = function(rhs) { if (missing(rhs)) { get_private(self$instance)$.result } else { get_private(self$instance, ".result") = rhs } + }, + + #' @field xs (list())\cr + #' The point to be evaluated. + xs = function(rhs) { + if (missing(rhs)) { + get_private(self$instance)$.xs + } else { + get_private(self$instance, ".xs") = rhs + } + }, + + #' @field xs_trafoed (list())\cr + #' The transformed point to be evaluated. + xs_trafoed = function(rhs) { + if (missing(rhs)) { + get_private(self$instance)$.xs_trafoed + } else { + get_private(self$instance, ".xs_trafoed") = rhs + } + }, + + #' @field extra (list())\cr + #' Additional information. + extra = function(rhs) { + if (missing(rhs)) { + get_private(self$instance)$.extra + } else { + get_private(self$instance, ".extra") = rhs + } + }, + + #' @field ys (list())\cr + #' The result of the evaluation. + ys = function(rhs) { + if (missing(rhs)) { + get_private(self$instance)$.ys + } else { + get_private(self$instance, ".ys") = rhs + } } ) ) diff --git a/R/OptimInstanceAsync.R b/R/OptimInstanceAsync.R index 9e9f328c..343cbcc8 100644 --- a/R/OptimInstanceAsync.R +++ b/R/OptimInstanceAsync.R @@ -86,6 +86,50 @@ OptimInstanceAsync = R6Class("OptimInstanceAsync", ), private = list( + .xs = NULL, + .xs_trafoed = NULL, + .extra = NULL, + .ys = NULL, + + .eval_point = function(xs) { + # transpose point + private$.xs = xs[self$archive$cols_x] + private$.xs_trafoed = trafo_xs(private$.xs, self$search_space) + private$.extra = xs[names(xs) %nin% c(self$archive$cols_x, "x_domain")] + + call_back("on_optimizer_before_eval", self$objective$callbacks, self$objective$context) + + # eval + key = self$archive$push_running_point(private$.xs) + private$.ys = self$objective$eval(private$.xs_trafoed) + + call_back("on_optimizer_after_eval", self$objective$callbacks, self$objective$context) + + # push result + self$archive$push_result(key, private$.ys, x_domain = private$.xs_trafoed, extra = private$.extra) + + return(invisible(private$.ys)) + }, + + .eval_queue = function() { + while (!self$is_terminated && self$archive$n_queued) { + task = self$archive$pop_point() + if (!is.null(task)) { + private$.xs = task$xs + + # transpose point + private$.xs_trafoed = trafo_xs(private$.xs, self$search_space) + + # eval + call_back("on_optimizer_before_eval", self$objective$callbacks, self$objective$context) + private$.ys = self$objective$eval(private$.xs_trafoed) + + # push reuslt + call_back("on_optimizer_after_eval", self$objective$callbacks, self$objective$context) + self$archive$push_result(task$key, private$.ys, x_domain = private$.xs_trafoed) + } + } + }, # initialize context for optimization .initialize_context = function(optimizer) { @@ -94,4 +138,3 @@ OptimInstanceAsync = R6Class("OptimInstanceAsync", } ) ) - diff --git a/R/OptimizerAsync.R b/R/OptimizerAsync.R index f7e991dd..6b9d9eff 100644 --- a/R/OptimizerAsync.R +++ b/R/OptimizerAsync.R @@ -31,6 +31,11 @@ OptimizerAsync = R6Class("OptimizerAsync", optimize = function(inst) { optimize_async_default(inst, self) } + ), + + private = list( + .xdt = NULL, + .ys = NULL ) ) @@ -65,7 +70,13 @@ optimize_async_default = function(instance, optimizer, design = NULL, n_workers rush = rush::RushWorker$new(instance$rush$network_id, remote = FALSE) instance$rush = rush instance$archive$rush = rush + + call_back("on_worker_begin", instance$objective$callbacks, instance$objective$context) + + # run optimizer loop get_private(optimizer)$.optimize(instance) + + call_back("on_worker_end", instance$objective$callbacks, instance$objective$context) } else { # run .optimize() on workers rush = instance$rush @@ -135,23 +146,3 @@ optimize_async_default = function(instance, optimizer, design = NULL, n_workers call_back("on_optimization_end", instance$objective$callbacks, instance$objective$context) return(instance$result) } - -#' @title Default Evaluation of the Queue -#' -#' @description -#' Used internally in `$.optimize()` of [OptimizerAsync] classes to evaluate a queue of points e.g. in [OptimizerAsyncGridSearch]. -#' -#' @param instance [OptimInstanceAsync]. -#' -#' @keywords internal -#' @export -evaluate_queue_default = function(instance) { - while (!instance$is_terminated && instance$archive$n_queued) { - task = instance$archive$pop_point() # FIXME: Add fields argument? - if (!is.null(task)) { - xs_trafoed = trafo_xs(task$xs, instance$search_space) - ys = instance$objective$eval(xs_trafoed) - instance$archive$push_result(task$key, ys, x_domain = xs_trafoed) - } - } -} diff --git a/R/OptimizerAsyncDesignPoints.R b/R/OptimizerAsyncDesignPoints.R index 4a0ca4ff..eb5f1b76 100644 --- a/R/OptimizerAsyncDesignPoints.R +++ b/R/OptimizerAsyncDesignPoints.R @@ -45,7 +45,6 @@ OptimizerAsyncDesignPoints = R6Class("OptimizerAsyncDesignPoints", #' @param inst ([OptimInstance]). #' @return [data.table::data.table]. optimize = function(inst) { - # generate grid and send to workers design = inst$search_space$assert_dt(self$param_set$values$design) @@ -55,10 +54,8 @@ OptimizerAsyncDesignPoints = R6Class("OptimizerAsyncDesignPoints", private = list( .optimize = function(inst) { - archive = inst$archive - # evaluate design of points - evaluate_queue_default(inst) + get_private(inst)$.eval_queue() } ) ) diff --git a/R/OptimizerAsyncGridSearch.R b/R/OptimizerAsyncGridSearch.R index 49524dc3..b3a771f0 100644 --- a/R/OptimizerAsyncGridSearch.R +++ b/R/OptimizerAsyncGridSearch.R @@ -53,7 +53,6 @@ OptimizerAsyncGridSearch = R6Class("OptimizerAsyncGridSearch", #' @param inst ([OptimInstance]). #' @return [data.table::data.table]. optimize = function(inst) { - # generate grid pv = self$param_set$values design = generate_design_grid(inst$search_space, resolution = pv$resolution, param_resolutions = pv$param_resolutions)$data @@ -64,10 +63,8 @@ OptimizerAsyncGridSearch = R6Class("OptimizerAsyncGridSearch", private = list( .optimize = function(inst) { - archive = inst$archive - # evaluate grid points - evaluate_queue_default(inst) + get_private(inst)$.eval_queue() } ) ) diff --git a/R/OptimizerAsyncRandomSearch.R b/R/OptimizerAsyncRandomSearch.R index ab0e4bad..266c2066 100644 --- a/R/OptimizerAsyncRandomSearch.R +++ b/R/OptimizerAsyncRandomSearch.R @@ -38,22 +38,16 @@ OptimizerAsyncRandomSearch = R6Class("OptimizerAsyncRandomSearch", search_space = inst$search_space # usually the queue is empty but callbacks might have added points - evaluate_queue_default(inst) + get_private(inst)$.eval_queue() while(!inst$is_terminated) { # sample new points sampler = SamplerUnif$new(search_space) xdt = sampler$sample(1)$data - xss = transpose_list(xdt) - xs = xss[[1]][inst$archive$cols_x] - xs_trafoed = trafo_xs(xs, search_space) - key = inst$archive$push_running_point(xs) + xs = transpose_list(xdt)[[1]] - # eval - ys = inst$objective$eval(xs_trafoed) - - # push result - inst$archive$push_result(key, ys = ys, x_domain = xs_trafoed) + # evaluate + get_private(inst)$.eval_point(xs) } } ) diff --git a/man/CallbackAsync.Rd b/man/CallbackAsync.Rd index 32b261f5..e1c29934 100644 --- a/man/CallbackAsync.Rd +++ b/man/CallbackAsync.Rd @@ -24,6 +24,14 @@ Called in \code{Optimizer$optimize()}.} Stage called at the beginning of the optimization on the worker. Called in the worker loop.} +\item{\code{on_optimizer_before_eval}}{(\verb{function()})\cr +Stage called after the optimizer proposes points. +Called in \code{OptimInstance$.eval_point()}.} + +\item{\code{on_optimizer_after_eval}}{(\verb{function()})\cr +Stage called after points are evaluated. +Called in \code{OptimInstance$.eval_point()}.} + \item{\code{on_worker_end}}{(\verb{function()})\cr Stage called at the end of the optimization on the worker. Called in the worker loop.} diff --git a/man/ContextAsync.Rd b/man/ContextAsync.Rd index 66497e9e..e51ae802 100644 --- a/man/ContextAsync.Rd +++ b/man/ContextAsync.Rd @@ -28,6 +28,18 @@ Changes to \verb{$instance} and \verb{$optimizer} in the stages executed on the \describe{ \item{\code{result}}{(\link[data.table:data.table]{data.table::data.table})\cr The result of the optimization.} + +\item{\code{xs}}{(list())\cr +The point to be evaluated.} + +\item{\code{xs_trafoed}}{(list())\cr +The transformed point to be evaluated.} + +\item{\code{extra}}{(list())\cr +Additional information.} + +\item{\code{ys}}{(list())\cr +The result of the evaluation.} } \if{html}{\out{}} } diff --git a/man/callback_async.Rd b/man/callback_async.Rd index 676979ce..308b5989 100644 --- a/man/callback_async.Rd +++ b/man/callback_async.Rd @@ -10,6 +10,8 @@ callback_async( man = NA_character_, on_optimization_begin = NULL, on_worker_begin = NULL, + on_optimizer_before_eval = NULL, + on_optimizer_after_eval = NULL, on_worker_end = NULL, on_result = NULL, on_optimization_end = NULL @@ -36,6 +38,16 @@ Stage called at the beginning of the optimization on the worker. Called in the worker loop. The functions must have two arguments named \code{callback} and \code{context}.} +\item{on_optimizer_before_eval}{(\verb{function()})\cr +Stage called after the optimizer proposes points. +Called in \code{OptimInstance$eval_point()}. +The functions must have two arguments named \code{callback} and \code{context}.} + +\item{on_optimizer_after_eval}{(\verb{function()})\cr +Stage called after points are evaluated. +Called in \code{OptimInstance$eval_point()}. +The functions must have two arguments named \code{callback} and \code{context}.} + \item{on_worker_end}{(\verb{function()})\cr Stage called at the end of the optimization on the worker. Called in the worker loop. @@ -61,6 +73,10 @@ The stages are prefixed with \verb{on_*}. - on_optimization_begin Start Worker - on_worker_begin + Start Optimization on Worker + - on_optimizer_before_eval + - on_optimizer_after_eval + End Optimization on Worker - on_worker_end End Worker - on_result diff --git a/man/evaluate_queue_default.Rd b/man/evaluate_queue_default.Rd deleted file mode 100644 index 59e95c07..00000000 --- a/man/evaluate_queue_default.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/OptimizerAsync.R -\name{evaluate_queue_default} -\alias{evaluate_queue_default} -\title{Default Evaluation of the Queue} -\usage{ -evaluate_queue_default(instance) -} -\arguments{ -\item{instance}{\link{OptimInstanceAsync}.} -} -\description{ -Used internally in \verb{$.optimize()} of \link{OptimizerAsync} classes to evaluate a queue of points e.g. in \link{OptimizerAsyncGridSearch}. -} -\keyword{internal} diff --git a/tests/testthat/_snaps/Objective.md b/tests/testthat/_snaps/Objective.md index 7be5a41d..48915577 100644 --- a/tests/testthat/_snaps/Objective.md +++ b/tests/testthat/_snaps/Objective.md @@ -8,13 +8,13 @@ id class lower upper nlevels default value - 1: x1 ParamDbl -1 1 Inf - 2: x2 ParamDbl -1 1 Inf + 1: x1 ParamDbl -1 1 Inf [NULL] + 2: x2 ParamDbl -1 1 Inf [NULL] Codomain: id class lower upper nlevels default value - 1: y ParamDbl -Inf Inf Inf + 1: y ParamDbl -Inf Inf Inf [NULL] --- @@ -26,11 +26,11 @@ id class lower upper nlevels default value - 1: x1 ParamDbl -1 1 Inf - 2: x2 ParamDbl -1 1 Inf + 1: x1 ParamDbl -1 1 Inf [NULL] + 2: x2 ParamDbl -1 1 Inf [NULL] Codomain: id class lower upper nlevels default value - 1: y ParamDbl -Inf Inf Inf + 1: y ParamDbl -Inf Inf Inf [NULL] diff --git a/tests/testthat/_snaps/OptimizerLocalSearch.md b/tests/testthat/_snaps/OptimizerLocalSearch.md new file mode 100644 index 00000000..34b8af83 --- /dev/null +++ b/tests/testthat/_snaps/OptimizerLocalSearch.md @@ -0,0 +1,36 @@ +# OptimizerBatchLocalSearch + + Code + z$optimizer + Output + : Local Search + * Parameters: n_initial_points=3, initial_random_sample_size=100, + neighbors_per_point=10, mutation_sd=0.1 + * Parameter classes: ParamLgl, ParamInt, ParamDbl, ParamFct + * Properties: dependencies, single-crit + * Packages: bbotk + +# OptimizerBatchLocalSearch mixed hierarchical search space + + Code + optimizer + Output + : Local Search + * Parameters: n_initial_points=3, initial_random_sample_size=100, + neighbors_per_point=10, mutation_sd=0.1 + * Parameter classes: ParamLgl, ParamInt, ParamDbl, ParamFct + * Properties: dependencies, single-crit + * Packages: bbotk + +# OptimizerBatchLocalSearch trafo + + Code + optimizer + Output + : Local Search + * Parameters: n_initial_points=3, initial_random_sample_size=100, + neighbors_per_point=10, mutation_sd=0.1 + * Parameter classes: ParamLgl, ParamInt, ParamDbl, ParamFct + * Properties: dependencies, single-crit + * Packages: bbotk + diff --git a/tests/testthat/test_CallbackAsync.R b/tests/testthat/test_CallbackAsync.R new file mode 100644 index 00000000..3978201d --- /dev/null +++ b/tests/testthat/test_CallbackAsync.R @@ -0,0 +1,157 @@ +test_that("on_optimization_begin works", { + skip_on_cran() + skip_if_not_installed("rush") + flush_redis() + + callback = callback_async(id = "test", + on_optimization_begin = function(callback, context) { + context$instance$terminator$param_set$values$n_evals = 20 + } + ) + + rush::rush_plan(n_workers = 2) + instance = oi_async( + objective = OBJ_1D, + search_space = PS_1D, + terminator = trm("evals", n_evals = 10), + callbacks = list(callback) + ) + + optimizer = opt("async_random_search") + optimizer$optimize(instance) + expect_class(instance$objective$context, "ContextAsync") + expect_equal(instance$terminator$param_set$values$n_evals, 20) +}) + +test_that("on_worker_begin works", { + skip_on_cran() + skip_if_not_installed("rush") + flush_redis() + + callback = callback_async(id = "test", + on_worker_begin = function(callback, context) { + instance = context$instance + mlr3misc::get_private(instance)$.eval_point(list(x = 1)) + } + ) + + rush::rush_plan(n_workers = 2) + instance = oi_async( + objective = OBJ_1D, + search_space = PS_1D, + terminator = trm("evals", n_evals = 10), + callbacks = list(callback) + ) + + optimizer = opt("async_random_search") + optimizer$optimize(instance) + + expect_subset(1, instance$archive$data$x) +}) + +test_that("on_worker_end works", { + skip_on_cran() + skip_if_not_installed("rush") + flush_redis() + + callback = callback_async(id = "test", + on_worker_end = function(callback, context) { + instance = context$instance + mlr3misc::get_private(instance)$.eval_point(list(x = 1)) + } + ) + + rush::rush_plan(n_workers = 2) + instance = oi_async( + objective = OBJ_1D, + search_space = PS_1D, + terminator = trm("evals", n_evals = 10), + callbacks = list(callback) + ) + + optimizer = opt("async_random_search") + optimizer$optimize(instance) + + expect_subset(1, instance$archive$data$x) +}) + +test_that("on_optimizer_before_eval and on_optimizer_after_eval works", { + skip_on_cran() + skip_if_not_installed("rush") + flush_redis() + + callback = callback_async(id = "test", + on_optimizer_before_eval = function(callback, context) { + context$xs = list(x = 1) + context$xs_trafoed = list(x = 0) + }, + + on_optimizer_after_eval = function(callback, context) { + context$ys = list(y = 0) + } + ) + + rush::rush_plan(n_workers = 2) + instance = oi_async( + objective = OBJ_1D, + search_space = PS_1D, + terminator = trm("evals", n_evals = 10), + callbacks = list(callback) + ) + + optimizer = opt("async_random_search") + optimizer$optimize(instance) + + expect_equal(unique(instance$archive$data$x), 1) + expect_equal(unique(instance$archive$data$y), 0) + expect_equal(unique(unlist(instance$archive$data$x_domain)), 0) +}) + +test_that("on_result works", { + skip_on_cran() + skip_if_not_installed("rush") + flush_redis() + + callback = callback_async(id = "test", + on_result = function(callback, context) { + context$result = 2 + } + ) + + rush::rush_plan(n_workers = 2) + instance = oi_async( + objective = OBJ_1D, + search_space = PS_1D, + terminator = trm("evals", n_evals = 10), + callbacks = list(callback) + ) + + optimizer = opt("async_random_search") + optimizer$optimize(instance) + + expect_equal(instance$result, 2) +}) + +test_that("on_optimization_end works", { + skip_on_cran() + skip_if_not_installed("rush") + flush_redis() + + callback = callback_async(id = "test", + on_optimization_end = function(callback, context) { + context$instance$terminator$param_set$values$n_evals = 200 + } + ) + + rush::rush_plan(n_workers = 2) + instance = oi_async( + objective = OBJ_1D, + search_space = PS_1D, + terminator = trm("evals", n_evals = 10), + callbacks = list(callback) + ) + + optimizer = opt("async_random_search") + optimizer$optimize(instance) + expect_equal(instance$terminator$param_set$values$n_evals, 200) +}) diff --git a/tests/testthat/test_Callback.R b/tests/testthat/test_CallbackBatch.R similarity index 100% rename from tests/testthat/test_Callback.R rename to tests/testthat/test_CallbackBatch.R diff --git a/tests/testthat/test_OptimInstanceAsyncSingleCrit.R b/tests/testthat/test_OptimInstanceAsyncSingleCrit.R index c9a038d2..ac8aee1d 100644 --- a/tests/testthat/test_OptimInstanceAsyncSingleCrit.R +++ b/tests/testthat/test_OptimInstanceAsyncSingleCrit.R @@ -1,6 +1,5 @@ test_that("initializing OptimInstanceAsyncSingleCrit works", { skip_on_cran() - # skip_on_cran() skip_if_not_installed("rush") flush_redis() @@ -24,7 +23,6 @@ test_that("initializing OptimInstanceAsyncSingleCrit works", { test_that("rush controller can be passed to OptimInstanceAsyncSingleCrit", { skip_on_cran() - # skip_on_cran() skip_if_not_installed("rush") flush_redis() @@ -43,7 +41,6 @@ test_that("rush controller can be passed to OptimInstanceAsyncSingleCrit", { test_that("context is initialized correctly", { skip_on_cran() - # skip_on_cran() skip_if_not_installed("rush") flush_redis() @@ -51,7 +48,7 @@ test_that("context is initialized correctly", { instance = oi_async( objective = OBJ_2D, search_space = PS_2D, - terminator = trm("evals", n_evals = 5L), + terminator = trm("evals", n_evals = 5L) ) optimizer = opt("async_random_search") @@ -59,3 +56,20 @@ test_that("context is initialized correctly", { expect_r6(instance$objective$context, "ContextAsync") }) + +test_that("point evaluation works", { + skip_on_cran() + skip_if_not_installed("rush") + flush_redis() + + # evaluation takes place on the workers + rush = RushWorker$new("test", remote = FALSE) + instance = oi_async( + objective = OBJ_2D, + search_space = PS_2D, + terminator = trm("evals", n_evals = 5L), + rush = rush + ) + + expect_equal(get_private(instance)$.eval_point(list(x1 = 1, x2 = 0)), list(y = 1)) +}) diff --git a/tests/testthat/test_OptimizerAsynDesignPoints.R b/tests/testthat/test_OptimizerAsynDesignPoints.R index 91f7aa28..6f6f27e5 100644 --- a/tests/testthat/test_OptimizerAsynDesignPoints.R +++ b/tests/testthat/test_OptimizerAsynDesignPoints.R @@ -1,6 +1,5 @@ test_that("OptimizerAsyncRandomSearch works", { skip_on_cran() - # skip_on_cran() skip_if_not_installed("rush") flush_redis() @@ -12,7 +11,7 @@ test_that("OptimizerAsyncRandomSearch works", { instance = oi_async( objective = OBJ_2D, search_space = PS_2D, - terminator = trm("none"), + terminator = trm("none") ) expect_data_table(optimizer$optimize(instance), nrows = 1) diff --git a/tests/testthat/test_OptimizerAsyncRandomSearch.R b/tests/testthat/test_OptimizerAsyncRandomSearch.R index c207c941..536a380a 100644 --- a/tests/testthat/test_OptimizerAsyncRandomSearch.R +++ b/tests/testthat/test_OptimizerAsyncRandomSearch.R @@ -1,6 +1,5 @@ test_that("OptimizerAsyncRandomSearch works", { skip_on_cran() - # skip_on_cran() skip_if_not_installed("rush") flush_redis()