Skip to content

Commit

Permalink
Fix #71: Ensure .ID. is the first column in checkTargetFiles().
Browse files Browse the repository at this point in the history
  • Loading branch information
MLopez-Ibanez committed Oct 14, 2024
1 parent 1fdbba6 commit 2152829
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions tests/testthat/test-bug71.R
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 2152829

Please sign in to comment.