diff --git a/NEWS.md b/NEWS.md index d7f3dad2..2d8dbedf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -214,6 +214,8 @@ * `readConfigurationsFile()` now handles parameters with dependent domains. + * Fix #71: Ensure `".ID."` is the first column in `checkTargetFiles()` (Manuel López-Ibáñez, reported by @ivan1arriola) + # irace 3.5 diff --git a/R/main.R b/R/main.R index 9d32c9b3..ba28748c 100644 --- a/R/main.R +++ b/R/main.R @@ -395,6 +395,7 @@ checkTargetFiles <- function(scenario) configurations <- sampleUniform(scenario$parameters, 2L, repair = scenario$repairConfiguration) set(configurations, j = ".ID.", value = seq_nrow(configurations)) + setcolorder(configurations, ".ID.", before = 1L) # Read initial configurations provided by the user. initConfigurations <- allConfigurationsInit(scenario) diff --git a/tests/testthat/test-bug71.R b/tests/testthat/test-bug71.R new file mode 100644 index 00000000..6326ad29 --- /dev/null +++ b/tests/testthat/test-bug71.R @@ -0,0 +1,19 @@ +withr::with_output_sink("test-bug71.Rout", { + +test_that("bug71.evaluator", { + + target.runner <- function(experiment, scenario) + list(cost = runif(1), call = toString(experiment)) + + parameters <- readParameters(text = ' +algorithm "--" c (as,mmas,eas,ras,acs) +') + scenario <- checkScenario(list( + targetRunner = target.runner, + maxExperiments = 200, instances = runif(10), + initConfigurations = data.frame(algorithm="as"), + parameters = parameters)) + expect_true(irace:::checkTargetFiles(scenario = scenario)) +}) + +}) # withr::with_output_sink()