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-09-15 12:53:47 UTC: Starting post-selection:
#> # scenario maxExperiments:1000
#> # Configurations selected: 124, 99, 103, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12.
#> # Pending instances: 1, 1, 1, 8, 10, 10, 8, 8, 8, 8, 10, 10, 8, 8.
#> # 2026-09-15 12:53:48 UTC: seed: 1316787058
#> # 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|         99|   0.01790543627|         11|00:00:00|   NA|  NA|    NA|
#> |.|          5|         14|         99|   0.01789139535|         11|00:00:00|+0.23|0.62|0.9767|
#> |.|          2|         14|         99|   0.02900454797|         11|00:00:00|+0.20|0.46|0.8128|
#> |.|          4|         14|         99|   0.02577589192|         11|00:00:00|+0.29|0.47|0.7498|
#> |x|          8|         14|         99|   0.02720198738|         22|00:00:00|+0.29|0.43|0.7659|
#> |x|         11|         14|         99|   0.03250308728|         33|00:00:00|+0.32|0.44|0.7632|
#> |x|         14|         14|         99|   0.03092099947|         44|00:00:00|+0.30|0.40|0.7700|
#> |.|          3|         14|         99|   0.02888520483|         44|00:00:00|+0.29|0.38|0.8202|
#> |.|          1|         14|         99|   0.02894571889|         44|00:00:00|+0.31|0.39|0.8044|
#> |x|          6|         14|         99|   0.02713267147|         48|00:00:00|+0.32|0.39|0.7834|
#> |x|         12|         14|         99|   0.02943573055|         59|00:00:00|+0.34|0.40|0.7572|
#> |x|          7|         14|         99|   0.03342908593|         63|00:00:00|+0.36|0.41|0.7481|
#> |x|         13|         14|         99|   0.03137485305|         74|00:00:00|+0.39|0.43|0.7209|
#> |-|          9|          3|         99|   0.03018040544|         85|00:00:00|-0.06|0.02|0.6958|
#> |=|         15|          3|        124|    0.2288145064|         88|00:00:00|-0.05|0.02|0.7060|
#> |=|         16|          3|        103|    0.7434025081|         91|00:00:00|-0.05|0.01|0.7030|
#> |=|         17|          3|        124|    0.4442068196|         94|00:00:00|-0.05|0.01|0.6937|
#> |=|         18|          3|        124|    0.4229701045|         97|00:00:00|-0.04|0.02|0.7002|
#> |=|         19|          3|        103|    0.8397891081|        100|00:00:00|-0.04|0.02|0.7020|
#> +-+-----------+-----------+-----------+----------------+-----------+--------+-----+----+------+
#> Best-so-far configuration:         103    mean value:     0.8397891081
#> Description of the best-so-far configuration:
#>     .ID. tmax   temp .PARENT.
#> 103  103 2407 0.3138       75
#> 
#> # 2026-09-15 12:53:50 UTC: Elite configurations (first number is the configuration ID; listed from best to worst according to the sum of ranks):
#>     tmax   temp
#> 103 2407 0.3138
#> 124 2739 0.7383
#> 99  2643 1.1444
#> # Total CPU user time: 22.37, CPU sys time: 0.038, Wall-clock time: 22.504
#>     .ID. tmax   temp .PARENT. .RANK.  .WEIGHT.
#> 103  103 2407 0.3138       75     36 0.5000000
#> 124  124 2739 0.7383       95     37 0.3333333
#> 99    99 2643 1.1444       95     41 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] 103 124 99
#>   ..$ tmax    : int [1:3] 2407 2739 2643
#>   ..$ temp    : num [1:3] 0.314 0.738 1.144
#>   ..$ .PARENT.: int [1:3] 75 95 95
#>   ..$ .RANK.  : num [1:3] 36 37 41
#>   ..$ .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] 16 10 31 3 22 50 9 46 13 15 ...
#>   ..$ seed      : int [1:19] 1506697220 1641750207 295628037 2129144331 1864184977 1715184466 1812097798 1046184383 1006362321 425202518 ...
#>   ..- attr(*, ".internal.selfref")=<pointer: (nil)> 
#>  $ max_experiments: int 100
#>  $ experiments    : num [1:19, 1:14] 0.059 0.0645 0.5448 0.129 0.025 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:19] "10" "5" "2" "4" ...
#>   .. ..$ : chr [1:14] "1" "2" "3" "4" ...
#>  $ elites         : int [1:3] 103 124 99
# }