Skip to content

Commit

Permalink
* R/generation.R: Use set instead of :=
Browse files Browse the repository at this point in the history
  • Loading branch information
MLopez-Ibanez committed Jan 20, 2025
1 parent a6b28ea commit 4e7d422
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/generation.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ get_dependent_domain <- function(param, configuration)
deps <- all.vars(domain)
# FIXME: This function should not be called if the parent is disabled.
# If it depends on a parameter that is disabled, then this is disabled.
if (anyNA(configuration[deps])) return(NA)
if (anyNA(configuration[deps]))
return(NA)

irace_assert(is.expression(domain))
domain <- sapply(domain, eval, configuration, USE.NAMES=FALSE)
irace_assert(all(is.finite(domain)))
# Value gets truncated (defined from robotics initial requirements)
if (param[["type"]] == "i") domain <- as.integer(domain)
if (param[["type"]] == "i")
domain <- as.integer(domain)
if (domain[[1L]] > domain[[2L]]) {
# FIXME: Add test for this error.
irace_error ("Invalid domain (", paste0(domain, collapse=", "),
Expand Down Expand Up @@ -259,7 +261,7 @@ sample_from_model <- function(parameters, eliteConfigurations, model,
c(pname) := list(sample_model(param, .N, this_model[[ .BY[[1L]] ]])),
by = .PARENT.]
}
newConfigurations[, .PARENT. := as.integer(.PARENT.)]
set(newConfigurations, j = ".PARENT.", value = as.integer(newConfigurations[[".PARENT."]]))
repairConfigurations(newConfigurations, parameters, repair)
newConfigurations
}
Expand Down

0 comments on commit 4e7d422

Please sign in to comment.