Skip to content

Commit

Permalink
Merge pull request #244 from mlr-org/callback_on_optimization_end_batch
Browse files Browse the repository at this point in the history
fix: optimizer batch on_optimzation_end callback
  • Loading branch information
sumny authored Aug 12, 2024
2 parents 2564535 + ec5d045 commit 6b693ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions R/OptimizerBatch.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ optimize_batch_default = function(instance, optimizer) {
lg$info("Result:")
lg$info(capture.output(print(
instance$result, lass = FALSE, row.names = FALSE, print.keys = FALSE)))
call_back("on_optimization_end", instance$objective$callbacks, instance$objective$context)
return(instance$result)
}

2 changes: 1 addition & 1 deletion tests/testthat/test_Callback.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test_that("on_optimization_end works", {
optimizer = opt("random_search")
optimizer$optimize(instance)
expect_class(instance$objective$context, "ContextBatch")
expect_equal(instance$terminator$param_set$values$n_evals, 10)
expect_equal(instance$terminator$param_set$values$n_evals, 20)
})

test_that("on_result in OptimInstanceBatchSingleCrit works", {
Expand Down

0 comments on commit 6b693ae

Please sign in to comment.