Skip to contents

psRace performs a post-selection race of a set of configurations.

Usage

psRace(
  iraceResults,
  max_experiments,
  conf_ids = NULL,
  iteration_elites = FALSE,
  psrace_logFile = NULL
)

Arguments

iraceResults

list()|character(1)
Object created by irace and typically saved in the log file irace.Rdata. If a character string is given, then it is interpreted as the path to the log file from which the iraceResults object will be loaded.

max_experiments

numeric(1)
Number of experiments for the post-selection race. If it is equal to or smaller than 1, then it is a fraction of the total budget given by iraceResults$scenario$maxExperiments or iraceResults$scenario$maxTime / iraceResults$state$boundEstimate.

conf_ids

IDs of the configurations in iraceResults$allConfigurations to be used for the post-selection. If NULL, then the configurations are automatically selected.

iteration_elites

If FALSE, give priority to selecting the configurations that were elite in the last iteration. If TRUE, select from all elite configurations of all iterations. This parameter only has an effect when conf_ids is not NULL.

psrace_logFile

character(1)
Log file to save the post-selection race log. If NULL, the log is saved in iraceResults$scenario$logFile.

Value

The elite configurations after the post-selection. In addition, if iraceResults$scenario$logFile is defined, it saves an updated copy of iraceResults in that file, where iraceResults$psrace_log is a list with the following elements:

configurations

Configurations used in the post-selection race.

instances

Data frame with the instances used in the post-selection race. First column has the instances IDs from iraceResults$scenario$instances, second column the seed assigned to the instance.

max_experiments

Configuration budget assigned to the post-selection race.

experiments

Matrix of results generated by the post-selection race, in the same format as the matrix iraceResults$experiments. Column names are the configuration IDs and row names are the instance IDs.

elites

Best configurations found in the experiments.

Author

Leslie Pérez Cáceres and Manuel López-Ibáñez

Examples

# \donttest{
  irace_log <- read_logfile(system.file(package="irace", "exdata", "sann.rda"))
  # Use a temporary file to not change the original "sann.rda".
  psrace_logFile <- withr::local_tempfile(fileext = ".Rdata")
  # Execute the post-selection after the execution of irace. Use 10% of the total budget.
  psRace(irace_log, max_experiments=0.1, psrace_logFile = psrace_logFile)
#> # 2026-02-04 08:50:47 UTC: Starting post-selection:
#> # scenario maxExperiments:1000
#> # Configurations selected: 125, 105, 104, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.
#> # Pending instances: 1, 1, 1, 9, 9, 7, 9, 7, 7, 9, 9, 9, 9, 7.
#> # 2026-02-04 08:50:47 UTC: seed: 466374708
#> # Configurations: 14
#> # Available experiments: 100
#> # minSurvival: 1
#> # Markers:
#>      x No test is performed.
#>      c Configurations are discarded only due to capping.
#>      - The test is performed and some configurations are discarded.
#>      = The test is performed but no configuration is discarded.
#>      ! The test is performed and configurations could be discarded but elite configurations are preserved.
#>      . Alive configurations were already evaluated on this instance and nothing is discarded.
#>      : All alive configurations are elite, but some need to be evaluated on this instance.
#> 
#> +-+-----------+-----------+-----------+----------------+-----------+--------+-----+----+------+
#> | |   Instance|      Alive|       Best|       Mean best| Exp so far|  W time|  rho|KenW|  Qvar|
#> +-+-----------+-----------+-----------+----------------+-----------+--------+-----+----+------+
#> |x|         10|         14|        104|   0.02214442433|         11|00:00:00|   NA|  NA|    NA|
#> |x|         13|         14|        105|    0.3512966628|         22|00:00:00|+0.12|0.56|0.7405|
#> |.|          5|         14|        105|    0.3350948425|         22|00:00:00|+0.44|0.62|0.6146|
#> |.|          1|         14|        105|    0.2650541250|         22|00:00:00|+0.49|0.62|0.6026|
#> |x|         12|         14|        125|    0.1489621243|         33|00:00:00|+0.49|0.59|0.6165|
#> |.|          3|         14|        125|    0.1352708378|         33|00:00:00|+0.50|0.58|0.5733|
#> |x|          7|         14|        125|    0.1291400488|         40|00:00:00|+0.49|0.57|0.5443|
#> |x|         11|         14|        125|    0.1184444400|         51|00:00:00|+0.50|0.56|0.5704|
#> |x|          8|         14|        125|    0.1420089437|         62|00:00:00|+0.48|0.54|0.5824|
#> |.|          2|         14|        125|    0.1307958033|         62|00:00:00|+0.47|0.52|0.5818|
#> |x|          6|         14|        125|    0.1204771636|         69|00:00:00|+0.48|0.52|0.5646|
#> |.|          4|         14|        125|    0.1400263259|         69|00:00:00|+0.42|0.47|0.5969|
#> |-|          9|          3|        125|    0.1337820960|         80|00:00:00|+0.05|0.12|0.6460|
#> |=|         14|          3|        125|    0.2012401500|         83|00:00:00|-0.01|0.07|0.6799|
#> |=|         15|          3|        125|    0.1920454897|         86|00:00:00|+0.02|0.08|0.6712|
#> |=|         16|          3|        125|    0.3124532933|         89|00:00:00|+0.01|0.07|0.6721|
#> |=|         17|          3|        125|    0.4965359433|         92|00:00:00|-0.02|0.04|0.6881|
#> |=|         18|          3|        125|    0.6345582371|         95|00:00:00|-0.04|0.02|0.6922|
#> |=|         19|          3|        125|    0.6418804432|         98|00:00:00|-0.04|0.01|0.6978|
#> +-+-----------+-----------+-----------+----------------+-----------+--------+-----+----+------+
#> Best-so-far configuration:         125    mean value:     0.6418804432
#> Description of the best-so-far configuration:
#>     .ID. tmax    temp .PARENT.
#> 125  125 1352 42.4881       82
#> 
#> # 2026-02-04 08:50:49 UTC: Elite configurations (first number is the configuration ID; listed from best to worst according to the sum of ranks):
#>     tmax    temp
#> 125 1352 42.4881
#> 104 1247 43.0175
#> 105 1201 40.2213
#> # Total CPU user time: 20.741, CPU sys time: 0.065, Wall-clock time: 20.851
#>     .ID. tmax    temp .PARENT. .RANK.  .WEIGHT.
#> 125  125 1352 42.4881       82     36 0.5000000
#> 104  104 1247 43.0175       82     38 0.3333333
#> 105  105 1201 40.2213       82     40 0.1666667
  # Print psrace_log
  irace_log <- read_logfile(psrace_logFile)
  str(irace_log$psrace_log)
#> List of 5
#>  $ configurations :'data.frame':	3 obs. of  6 variables:
#>   ..$ .ID.    : int [1:3] 125 104 105
#>   ..$ tmax    : int [1:3] 1352 1247 1201
#>   ..$ temp    : num [1:3] 42.5 43 40.2
#>   ..$ .PARENT.: int [1:3] 82 82 82
#>   ..$ .RANK.  : num [1:3] 36 38 40
#>   ..$ .WEIGHT.: num [1:3] 0.5 0.333 0.167
#>  $ instances      :Classes ‘data.table’ and 'data.frame':	19 obs. of  2 variables:
#>   ..$ instanceID: int [1:19] 37 46 15 11 39 29 17 45 20 24 ...
#>   ..$ seed      : int [1:19] 1615950541 151223328 1191742131 1772027558 713020034 760769549 972999654 932856429 456480825 32197914 ...
#>   ..- attr(*, ".internal.selfref")=<externalptr> 
#>  $ max_experiments: int 100
#>  $ experiments    : num [1:19, 1:14] 6.74 3.719 4.466 0.952 3.501 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:19] "10" "13" "5" "1" ...
#>   .. ..$ : chr [1:14] "1" "2" "3" "4" ...
#>  $ elites         : int [1:3] 125 104 105
# }