Skip to content

Commit

Permalink
fix: workaround for internal tuned values (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc authored Jul 24, 2024
1 parent b9521e9 commit 9b0af8d
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Encoding: UTF-8
Language: en-US
NeedsCompilation: no
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Collate:
'Archive.R'
'ArchiveAsync.R'
Expand Down
6 changes: 4 additions & 2 deletions R/OptimInstanceAsyncMultiCrit.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ OptimInstanceAsyncMultiCrit = R6Class("OptimInstanceAsyncMultiCrit",
#' For internal use.
#'
#' @param ydt (`numeric(1)`)\cr
#' Optimal outcomes, e.g. the Pareto front.
assign_result = function(xdt, ydt) {
#' Optimal outcomes, e.g. the Pareto front.
#' @param ... (`any`)\cr
#' ignored.
assign_result = function(xdt, ydt, ...) {
# FIXME: We could have one way that just lets us put a 1xn DT as result directly.
assert_data_table(xdt)
assert_names(names(xdt), must.include = self$search_space$ids())
Expand Down
4 changes: 3 additions & 1 deletion R/OptimInstanceAsyncSingleCrit.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ OptimInstanceAsyncSingleCrit = R6Class("OptimInstanceAsyncSingleCrit",
#'
#' @param y (`numeric(1)`)\cr
#' Optimal outcome.
assign_result = function(xdt, y) {
#' @param ... (`any`)\cr
#' ignored.
assign_result = function(xdt, y, ...) {
# FIXME: We could have one way that just lets us put a 1xn DT as result directly.
assert_data_table(xdt)
assert_names(names(xdt), must.include = self$search_space$ids())
Expand Down
4 changes: 3 additions & 1 deletion R/OptimInstanceBatchMultiCrit.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ OptimInstanceBatchMultiCrit = R6Class("OptimInstanceBatchMultiCrit",
#' The [Optimizer] object writes the best found points
#' and estimated performance values here (probably the Pareto set / front).
#' For internal use.
assign_result = function(xdt, ydt) {
#' @param ... (`any`)\cr
#' ignored.
assign_result = function(xdt, ydt, ...) {
# FIXME: We could have one way that just lets us put a 1xn DT as result directly.
assert_data_table(xdt)
assert_names(names(xdt), must.include = self$search_space$ids())
Expand Down
4 changes: 3 additions & 1 deletion R/OptimInstanceBatchSingleCrit.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ OptimInstanceBatchSingleCrit = R6Class("OptimInstanceBatchSingleCrit",
#'
#' @param y (`numeric(1)`)\cr
#' Optimal outcome.
assign_result = function(xdt, y) {
#' @param ... (`any`)\cr
#' ignored.
assign_result = function(xdt, y, ...) {
# FIXME: We could have one way that just lets us put a 1xn DT as result directly.
assert_data_table(xdt)
assert_names(names(xdt), must.include = self$search_space$ids())
Expand Down
4 changes: 3 additions & 1 deletion R/Optimizer.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,11 @@ Optimizer = R6Class("Optimizer",
#' @export
assign_result_default = function(inst) {
assert_r6(inst, "OptimInstance")

res = inst$archive$best()
ids = inst$search_space$ids()
if ("keys" %in% names(res)) ids = c(ids, "keys")
# workaround until ... works
if ("internal_tuned_values" %in% names(res)) ids = c(ids, "internal_tuned_values")
xdt = res[, ids, with = FALSE]

if (inherits(inst, "OptimInstanceBatchMultiCrit") || inherits(inst, "OptimInstanceAsyncMultiCrit")) {
Expand Down
5 changes: 4 additions & 1 deletion man/OptimInstanceAsyncMultiCrit.Rd

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

5 changes: 4 additions & 1 deletion man/OptimInstanceAsyncSingleCrit.Rd

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

5 changes: 4 additions & 1 deletion man/OptimInstanceBatchMultiCrit.Rd

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

5 changes: 4 additions & 1 deletion man/OptimInstanceBatchSingleCrit.Rd

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

0 comments on commit 9b0af8d

Please sign in to comment.