Skip to content

Commit

Permalink
Move parameters within scenario.
Browse files Browse the repository at this point in the history
  • Loading branch information
MLopez-Ibanez committed Mar 13, 2024
1 parent 449af16 commit 4ad34be
Show file tree
Hide file tree
Showing 46 changed files with 438 additions and 575 deletions.
10 changes: 8 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
* The scenario option `digits` has been removed and will give an error if
present. The number of `digits` for real-valued parameters is now specified
in the parameter space description. See the example in `readParameters()`.


* The `scenario` object now includes the `parameters` object. Thus
functions such as `irace()`, which previously took as arguments both
`scenario` and `parameters`, now only take `scenario`. This also means that
the log file `irace.Rdata` does not contain a separate `parameters` element
since this element can now be found within `scenario`.

* The default value of the scenario option `softRestartThreshold` is now
0.0001 and does not depend on `digits`.

Expand Down Expand Up @@ -74,7 +80,7 @@

* Initial configurations are sampled using Sobol low-discrepancy sequences using `spacefillr::generate_sobol_set()`. This should provide a better initial distribution of parameter values.

* Parameter spaces can be constructed programmatically using `parametersNew()`.
* Parameter spaces can be constructed programmatically using `parametersNew()`. See the documentation for details.

* Ablation will report configurations that produced the same results, which
indicates parameter values that have the same effect on the target algorithm,
Expand Down
6 changes: 2 additions & 4 deletions R/ablation.R
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ ablation <- function(iraceResults, src = 1L, target = NULL,
configurations = all_configurations,
experiments = results,
instances = .irace$instancesList,
parameters = parameters,
scenario = scenario,
trajectory = trajectory,
best = best_configuration,
Expand All @@ -307,7 +306,6 @@ ablation <- function(iraceResults, src = 1L, target = NULL,
if (is.null(iraceResults$state$completed) || iraceResults$state$completed == "Incomplete") {
stop("This logfile seems to belong to an incomplete run of irace.")
}
parameters <- iraceResults$parameters
scenario <- iraceResults$scenario
scenario_args <- list(...)
if (length(scenario_args) > 0L) {
Expand Down Expand Up @@ -339,6 +337,7 @@ ablation <- function(iraceResults, src = 1L, target = NULL,
target_configuration <- iraceResults$allConfigurations[target, , drop = FALSE]
configurations_print(target_configuration)

parameters <- scenario$parameters
# Select the parameters used for ablation
if (is.null(ab_params)) {
ab_params <- parameters$names
Expand Down Expand Up @@ -389,7 +388,7 @@ ablation <- function(iraceResults, src = 1L, target = NULL,
while (length(param_names) > 1L) {
# Generate ablation configurations
cat("# Generating configurations (row number is ID):", param_names,"\n")
ab_aux <- generateAblation(best_configuration, target_configuration, parameters,
ab_aux <- generateAblation(best_configuration, target_configuration, parameters,
param_names)
aconfigurations <- ab_aux$configurations
if (is.null(aconfigurations)) {
Expand Down Expand Up @@ -428,7 +427,6 @@ ablation <- function(iraceResults, src = 1L, target = NULL,
minSurvival = 1L,
elite.data = elite_data,
configurations = race_conf,
parameters = parameters,
scenario = scenario,
elitistNewInstances = 0L)
results <- merge_matrix(results, race.output$experiments)
Expand Down
45 changes: 23 additions & 22 deletions R/irace-options.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# FIXME: Add special type for R functions.
# FIXME: For i and r add their domain.
.irace.params.def <- structure(list(name = c(".help", ".version", ".check", ".init",
".onlytest", "scenarioFile", "execDir", "parameterFile", "initConfigurations",
"configurationsFile", "logFile", "recoveryFile", "instances",
"trainInstancesDir", "trainInstancesFile", "sampleInstances",
".onlytest", "scenarioFile", "execDir", "parameterFile", "parameters",
"initConfigurations", "configurationsFile", "logFile", "recoveryFile",
"instances", "trainInstancesDir", "trainInstancesFile", "sampleInstances",
"testInstancesDir", "testInstancesFile", "testInstances", "testNbElites",
"testIterationElites", "testType", "firstTest", "blockSize",
"eachTest", "targetRunner", "targetRunnerLauncher", "targetCmdline",
Expand All @@ -20,18 +20,18 @@
"boundType", "boundMax", "boundDigits", "boundPar", "boundAsTimeout",
"postselection", "aclib", "nbIterations", "nbExperimentsPerIteration",
"minNbSurvival", "nbConfigurations", "mu", "confidence"), type = c("x",
"x", "x", "x", "p", "p", "p", "p", "x", "p", "p", "p", "s", "p",
"p", "b", "p", "p", "x", "i", "b", "s", "i", "i", "i", "p", "p",
"s", "i", "i", "x", "x", "p", "b", "i", "i", "i", "r", "r", "i",
"b", "b", "s", "b", "i", "i", "b", "r", "b", "i", "i", "x", "b",
"s", "s", "i", "i", "i", "b", "r", "b", "i", "i", "i", "i", "i",
"r"), short = c("-h", "-v", "-c", "-i", "", "-s", "", "-p", "",
"", "-l", "", "", "", "", "", "", "", "", "", "", "", "", "",
"x", "x", "x", "p", "p", "p", "p", "x", "x", "p", "p", "p", "s",
"p", "p", "b", "p", "p", "x", "i", "b", "s", "i", "i", "i", "p",
"p", "s", "i", "i", "x", "x", "p", "b", "i", "i", "i", "r", "r",
"i", "b", "b", "s", "b", "i", "i", "b", "r", "b", "i", "i", "x",
"b", "s", "s", "i", "i", "i", "b", "r", "b", "i", "i", "i", "i",
"i", "r"), short = c("-h", "-v", "-c", "-i", "", "-s", "", "-p",
"", "", "", "-l", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "-q", "", "", "", "", "-e", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", ""), long = c("--help",
"", "", "", "", "", "-q", "", "", "", "", "-e", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", ""), long = c("--help",
"--version", "--check", "--init", "--only-test", "--scenario",
"--exec-dir", "--parameter-file", "", "--configurations-file",
"--exec-dir", "--parameter-file", "", "", "--configurations-file",
"--log-file", "--recovery-file", "", "--train-instances-dir",
"--train-instances-file", "--sample-instances", "--test-instances-dir",
"--test-instances-file", "", "--test-num-elites", "--test-iteration-elites",
Expand All @@ -48,22 +48,23 @@
"--aclib", "--iterations", "--experiments-per-iteration", "--min-survival",
"--num-configurations", "--mu", "--confidence"), default = c(NA,
NA, NA, "", "", "./scenario.txt", "./", "./parameters.txt", "",
"", "./irace.Rdata", "", "", "./Instances", "", "1", "", "",
"", "1", "0", "", "5", "1", "1", "./target-runner", "", "{configurationID} {instanceID} {seed} {instance} {bound} {targetRunnerArgs}",
"", "", "./irace.Rdata", "", "", "./Instances", "", "1", "",
"", "", "1", "0", "", "5", "1", "1", "./target-runner", "", "{configurationID} {instanceID} {seed} {instance} {bound} {targetRunnerArgs}",
"0", "0", "", "", "", "0", "0", NA, "0", "0.05", "0.01", "0",
"1", "0", "0", "0", "0", NA, "1", "1e-04", "1", "1", "2", "",
NA, "median", "candidate", "0", "0", "1", "1", "0", "0", "0",
"0", "0", "0", "5", "0.95"), domain = c(NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "F-test,t-test,t-test-holm,t-test-bonferroni",
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, "sge,pbs,torque,slurm,htcondor", NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, "median,mean,worst,best", "instance,candidate",
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), description = c("Show this help.",
"F-test,t-test,t-test-holm,t-test-bonferroni", NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
"sge,pbs,torque,slurm,htcondor", NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, "median,mean,worst,best", "instance,candidate", NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), description = c("Show this help.",
"Show irace package version.", "Check scenario.", "Initialize the working directory with template config files.",
"Only test the configurations given in the file passed as argument.",
"File that describes the configuration scenario setup and other irace settings.",
"Directory where the programs will be run.", "File that contains the description of the parameters of the target algorithm.",
"", "File that contains a table of initial configurations. If empty or `NULL`, all initial configurations are randomly generated.",
"", "", "File that contains a table of initial configurations. If empty or `NULL`, all initial configurations are randomly generated.",
"File to save tuning results as an R dataset, either absolute path or relative to execDir.",
"Previously saved log file to recover the execution of `irace`, either absolute path or relative to the current directory. If empty or `NULL`, recovery is not performed.",
"", "Directory where training instances are located; either absolute path or relative to current directory. If no `trainInstancesFiles` is provided, all the files in `trainInstancesDir` will be listed as instances.",
Expand Down Expand Up @@ -116,7 +117,7 @@ NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), description = c("Show this help
"Parameter used to define the number of configurations sampled and evaluated at each iteration.",
"Confidence level for the elimination test.")), row.names = c(".help",
".version", ".check", ".init", ".onlytest", "scenarioFile", "execDir",
"parameterFile", "initConfigurations", "configurationsFile",
"parameterFile", "parameters", "initConfigurations", "configurationsFile",
"logFile", "recoveryFile", "instances", "trainInstancesDir",
"trainInstancesFile", "sampleInstances", "testInstancesDir",
"testInstancesFile", "testInstances", "testNbElites", "testIterationElites",
Expand All @@ -131,7 +132,7 @@ NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), description = c("Show this help
"boundType", "boundMax", "boundDigits", "boundPar", "boundAsTimeout",
"postselection", "aclib", "nbIterations", "nbExperimentsPerIteration",
"minNbSurvival", "nbConfigurations", "mu", "confidence"), class = "data.frame")
.irace.params.names <- c("scenarioFile", "execDir", "parameterFile", "initConfigurations",
.irace.params.names <- c("scenarioFile", "execDir", "parameterFile", "parameters", "initConfigurations",
"configurationsFile", "logFile", "recoveryFile", "instances",
"trainInstancesDir", "trainInstancesFile", "sampleInstances",
"testInstancesDir", "testInstancesFile", "testInstances", "testNbElites",
Expand Down
Loading

0 comments on commit 4ad34be

Please sign in to comment.