-
- Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
require(data.table) require(mlr3mbo) require(bbotk) callback_plot = callback_optimization("plot", on_optimizer_after_eval = function(callback, context) { } ) obfun = ObjectiveRFun$new( fun = function(xs) 2 * xs$x * sin(14 * xs$x), domain = ps(x = p_dbl(lower = 0, upper = 1)), codomain = ps(y = p_dbl(tags = "minimize"))) instance = OptimInstanceSingleCrit$new( objective = obfun, terminator = trm("evals", n_evals = 20), callbacks = callback_plot) initial_design = data.table(x = c(0, 0.5, 1)) instance$eval_batch(initial_design) ``` gives me ````R Error in call_back("on_optimizer_before_eval", self$callbacks, private$.context) : Assertion on 'context' failed: Must inherit from class 'Context', but has class 'NULL'. Calls: <Anonymous> ... call_back -> assert_class -> makeAssertion -> mstop Execution haltedNote that the callback specified is on_optimizer_after_eval and the error comes from on_optimizer_before_eval (the same error would probably come from the specified callback as well though).