Skip to content

Commit

Permalink
fix: optimizer irace failed with logical parameters and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Jan 31, 2024
1 parent ae1b895 commit c15f18a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# bbotk (development version)

* fix: `OptimizerIrace` failed with logical parameters and dependencies.
* refactor: Optimize the runtime of `archive$best()` method with partial sorting.

# bbotk 0.7.3
Expand Down
6 changes: 4 additions & 2 deletions R/OptimizerIrace.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ target_runner_default = function(experiment, exec.target.runner, scenario, targe
# add configuration and instance id to archive
set(configuration, j = "configuration", value = e$id.configuration)
set(configuration, j = "instance", value = e$id.instance)
# fix logicals
configuration[, map(.SD, function(x) ifelse(x %in% c("TRUE", "FALSE"), as.logical(x), x))]
configuration
})
# fix logicals
lgl_params = as.data.table(optim_instance$search_space)[class == "ParamLgl", id]
if (length(lgl_params)) xdt[, (lgl_params) := lapply(.SD, as.logical), .SDcols = lgl_params]

# provide experiment instances to objective
optim_instance$objective$constants$values$instances = map(experiment, function(e) e$instance)
Expand Down

0 comments on commit c15f18a

Please sign in to comment.