Hi Manuel,
Thanks for the reply. It is very helpful!
Just a few things to clarify, is the random seed provided by irace and passed to the target algorithm the same as the random seed in the scenario list? If so, my understanding is that I should pass the scenario$seed to the target algorithm in the target runner function in order to get the reproducible best configurations. Is that correct?
Moreover, if the final best configurations are several and I want to test them on the target algorithm for cost values, I don't quite understand why the cost values are not the same, assuming that everything else is the same, except the parameter values to be used in the target algorithm. I tried the example from the package file:
scenario <- list(targetRunner = target_runner,
instances = weights[1:10],
maxExperiments = 1000,
seed=12345,
# Do not create a logFile
logFile = "")
target_runner <- function(experiment, scenario) {
instance <- experiment$instance
configuration <- experiment$configuration
D <- 3
par <- runif(D, min = -1, max = 1)
fn <- function(x) { # function to be optimized, x can be in any dimension
weight <- instance
return(weight * f_rastrigin(x) + (1 - weight) * f_rosenbrock(x))
}
res <- stats::optim(par, fn, method="SANN",
control=list(maxit=1000
, tmax = as.numeric(configuration[["tmax"]])
, temp = as.numeric(configuration[["temp"]])))
return(list(cost = res$value))
}
tuned_confs <- irace(scenario = scenario, parameters = parameters)
test <- function(configuration) {
res <- lapply(weights[1:10],
function(x) target_runner( # run target_runner using default values
experiment = list(instance = x,
configuration = configuration),
scenario = scenario))
return (sapply(res, getElement, name = "cost"))
}
tuned <- test(removeConfigurationsMetaData(tuned_confs[1,]))
In this example, I used the same instances (weights[1:10]) in the test function as the ones (weights[1:10]) used for irace tuning. But the tuned_confs produces 3 best configurations, and the tuned values of tuned_confs[1,] are different from the tuned values of tuned_confs[2,] for instance. Is there some reason why this happens?
Thanks a lot!
Sarah