Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workaround for internal tuned values #240

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading