Skip to content

Commit

Permalink
Merge branch 'main' into mirai
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Dec 18, 2024
2 parents 315cc14 + a46dd21 commit d9d3f57
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: bbotk
Title: Black-Box Optimization Toolkit
Version: 1.4.1.9000
Version: 1.5.0.9000
Authors@R: c(
person("Marc", "Becker", , "[email protected]", role = c("cre", "aut"),
comment = c(ORCID = "0000-0002-8115-0400")),
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# bbotk (development version)

# bbotk 1.5.0

* compatibility: irace 4.1.0
* compatibility: rush 0.2.0
* refactor: Replace `Codomain$maximization_to_minimization` with `$direction` field.
* feat: Save `ArchiveAsync` to a `data.table` with `ArchiveAsyncFrozen`.

# bbotk 1.4.1

* compatibility: irace 4.0.0
Expand Down
6 changes: 3 additions & 3 deletions R/OptimInstanceBatch.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,16 @@ OptimInstanceBatch = R6Class("OptimInstanceBatch",
)
)

objective_function = function(x, inst, maximization_to_minimization) {
objective_function = function(x, inst, direction) {
xs = set_names(as.list(x), inst$search_space$ids())
inst$search_space$assert(xs)
xdt = as.data.table(xs)
res = inst$eval_batch(xdt)
y = as.numeric(res[, inst$objective$codomain$target_ids, with = FALSE])
y * maximization_to_minimization
y * direction
}

objective_error = function(x, inst, maximization_to_minimization) {
objective_error = function(x, inst, direction) {
stop("$objective_function can only be called if search_space only
contains numeric values")
}
Expand Down
4 changes: 3 additions & 1 deletion R/OptimizerBatchIrace.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
#'
#' @export
#' @examples
#' # runtime of the example is too long
#' \donttest{
#'
#' library(data.table)
#'
#' search_space = domain = ps(
Expand Down Expand Up @@ -94,7 +96,7 @@
#' instance = OptimInstanceBatchSingleCrit$new(
#' objective = objective,
#' search_space = search_space,
#' terminator = trm("evals", n_evals = 1000))
#' terminator = trm("evals", n_evals = 96))
#'
#' # create instances of branin function
#' instances = rnorm(10, mean = 0, sd = 0.1)
Expand Down
4 changes: 3 additions & 1 deletion man/mlr_optimizers_irace.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test_OptimizerIrace.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test_that("OptimizerBatchIrace minimize works", {
instance = OptimInstanceBatchSingleCrit$new(
objective = objective,
search_space = search_space,
terminator = trm("evals", n_evals = 1000))
terminator = trm("evals", n_evals = 96))


optimizer = opt("irace", instances = rnorm(10, mean = 0, sd = 0.1))
Expand Down Expand Up @@ -56,7 +56,7 @@ test_that("OptimizerBatchIrace maximize works", {
instance = OptimInstanceBatchSingleCrit$new(
objective = objective,
search_space = search_space,
terminator = trm("evals", n_evals = 1000))
terminator = trm("evals", n_evals = 96))

optimizer = opt("irace", instances = rnorm(10, mean = 0, sd = 0.1))

Expand Down

0 comments on commit d9d3f57

Please sign in to comment.