Skip to contents

buildCommandLine receives two vectors, one containing the values of the parameters, the other containing the switches of the parameters. It builds a string with the switches and the values that can be used as a command line to call the program to be tuned, thus generating one candidate configuration.

Usage

buildCommandLine(values, switches)

Arguments

values

A vector containing the value of each parameter for the candidate configuration.

switches

A vector containing the switches of each paramter (in an order that corresponds to the values vector).

Value

A string concatenating each element of switches and values for all parameters with a space between each pair of parameters (but none between the switches and the corresponding values).

Author

Manuel López-Ibáñez and Jérémie Dubois-Lacoste

Examples

switches <- c("--switch1 ", "--switch2-", "--switch3=")
values <- list("value_1", 1L, sqrt(2))
buildCommandLine (values, switches)
#> [1] "--switch1 value_1 --switch2-1 --switch3=1.4142135623731"
## Build a command-line from the results produced by a previous run of irace.
# First, load the data produced by irace.
logfile <- file.path(system.file(package="irace"), "exdata", "irace-acotsp.Rdata")
iraceResults <- read_logfile(logfile)
allConfigurations <- iraceResults$allConfigurations
parameters <- iraceResults$scenario$parameters
apply(allConfigurations[1:10, unlist(parameters$names)], 1, buildCommandLine,
      unlist(parameters$switches))
#>                                                                                                                         1 
#>                                      "--as --localsearch 0 --alpha 1.0000 --beta 1.0000 --rho  0.9500 --ants 10 --time 5" 
#>                                                                                                                         2 
#>                    "--as --localsearch 1 --alpha 4.9626 --beta 8.3474 --rho  0.2990 --ants 28 --nnls 30 --dlb 1 --time 5" 
#>                                                                                                                         3 
#>     "--ras --localsearch 3 --alpha 2.4626 --beta 3.3474 --rho  0.7940 --ants  6 --nnls  7 --dlb 0 --rasranks 86 --time 5" 
#>                                                                                                                         4 
#>                         "--acs --localsearch 0 --alpha 3.7126 --beta 5.8474 --rho  0.5465 --ants 13 --q0 0.8964 --time 5" 
#>                                                                                                                         5 
#>                  "--mmas --localsearch 2 --alpha 1.2126 --beta 0.8474 --rho  0.0515 --ants 60 --nnls 18 --dlb 1 --time 5" 
#>                                                                                                                         6 
#>     "--ras --localsearch 1 --alpha 0.5876 --beta 4.5974 --rho  0.9178 --ants 19 --nnls 36 --dlb 1 --rasranks 24 --time 5" 
#>                                                                                                                         7 
#>                  "--mmas --localsearch 3 --alpha 3.0876 --beta 9.5974 --rho  0.4228 --ants 88 --nnls 13 --dlb 0 --time 5" 
#>                                                                                                                         8 
#>                   "--eas --localsearch 0 --alpha 1.8376 --beta 2.0974 --rho  0.1753 --ants 41 --elitistants 404 --time 5" 
#>                                                                                                                         9 
#>       "--acs --localsearch 2 --alpha 4.3376 --beta 7.0974 --rho  0.6703 --ants  9 --nnls 24 --q0 0.2714 --dlb 1 --time 5" 
#>                                                                                                                        10 
#> "--eas --localsearch 3 --alpha 4.0251 --beta 3.9724 --rho  0.6084 --ants 23 --nnls 16 --dlb 0 --elitistants 451 --time 5"