Generate a command-line representation of a configuration
Source:R/race-wrapper.R
buildCommandLine.Rd
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.
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).
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.
irace.logfile <- file.path(system.file(package="irace"),
"exdata", "irace-acotsp.Rdata")
load(irace.logfile)
allConfigurations <- iraceResults$allConfigurations
parameters <- iraceResults$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"
#> 2
#> "--acs --localsearch 3 --alpha 1.1275 --beta 3.3469 --rho 0.6471 --ants 36 --nnls 43 --q0 0.9053 --dlb 0"
#> 3
#> "--eas --localsearch 3 --alpha 3.7246 --beta 5.5153 --rho 0.5998 --ants 75 --nnls 29 --dlb 1 --elitistants 91"
#> 4
#> "--ras --localsearch 1 --alpha 4.8395 --beta 5.9323 --rho 0.7610 --ants 5 --nnls 40 --dlb 0 --rasranks 61"
#> 5
#> "--ras --localsearch 3 --alpha 4.2077 --beta 5.2256 --rho 0.7607 --ants 22 --nnls 8 --dlb 1 --rasranks 49"
#> 6
#> "--mmas --localsearch 3 --alpha 1.6813 --beta 7.1353 --rho 0.9089 --ants 16 --nnls 26 --dlb 1"
#> 7
#> "--as --localsearch 2 --alpha 2.8519 --beta 7.3960 --rho 0.6928 --ants 40 --nnls 8 --dlb 1"
#> 8
#> "--eas --localsearch 1 --alpha 3.0019 --beta 7.9433 --rho 0.4756 --ants 15 --nnls 11 --dlb 1 --elitistants 336"
#> 9
#> "--eas --localsearch 1 --alpha 3.9897 --beta 0.7250 --rho 0.5477 --ants 67 --nnls 28 --dlb 0 --elitistants 350"
#> 10
#> "--acs --localsearch 1 --alpha 3.9875 --beta 0.2808 --rho 0.4399 --ants 7 --nnls 27 --q0 0.7146 --dlb 1"