From a5f4947713888255fe62cbba4bc365e209ddb948 Mon Sep 17 00:00:00 2001 From: mb706 Date: Sun, 14 Jan 2024 18:28:52 +0100 Subject: [PATCH] new paradox --- R/helper.R | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/R/helper.R b/R/helper.R index cb87618c..6684e822 100644 --- a/R/helper.R +++ b/R/helper.R @@ -1,9 +1,19 @@ task_to_domain = function(task) { - ParamSet$new(map(task$feature_names, function(s) ParamLgl$new(id = s))) + params = rep(list(p_lgl()), length(task$feature_names)) + names(params) = task$feature_names + do.call(ps, params) } measures_to_codomain = function(measures) { - Codomain$new(map(as_measures(measures), function(s) { - ParamDbl$new(id = s$id, tags = ifelse(s$minimize, "minimize", "maximize")) - })) + measures = as_measures(measures) + domains = map(measures, function(s) { + if ("set_id" %in% names(ps())) { + # old paradox + get("ParamDbl")$new(id = s$id, tags = ifelse(s$minimize, "minimize", "maximize")) + } else { + p_dbl(tags = ifelse(s$minimize, "minimize", "maximize")) + } + }) + names(domains) = ids(measures) + Codomain$new(domains) }