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 fileirace.Rdata. If a character string is given, then it is interpreted as the path to the log file from which theiraceResultsobject 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 byiraceResults$scenario$maxExperimentsoriraceResults$scenario$maxTime / iraceResults$state$boundEstimate.- conf_ids
IDs of the configurations in
iraceResults$allConfigurationsto be used for the post-selection. IfNULL, then the configurations are automatically selected.- iteration_elites
If
FALSE, give priority to selecting the configurations that were elite in the last iteration. IfTRUE, select from all elite configurations of all iterations. This parameter only has an effect whenconf_idsis notNULL.- psrace_logFile
character(1)
Log file to save the post-selection race log. IfNULL, the log is saved iniraceResults$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.
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)
#> # 2025-10-17 19:25:19 UTC: Starting post-selection:
#> # scenario maxExperiments:1000
#> # Configurations selected: 128, 80, 91, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13.
#> # Pending instances: 1, 1, 1, 6, 6, 4, 4, 6, 4, 4, 4, 6, 4, 4, 6, 4.
#> # 2025-10-17 19:25:19 UTC: seed: 687264462
#> # Configurations: 16
#> # 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|
#> +-+-----------+-----------+-----------+----------------+-----------+--------+-----+----+------+
#> |.| 1| 16| 128| 0.01996442284| 0|00:00:00| NA| NA| NA|
#> |x| 10| 16| 91| 0.04671217104| 13|00:00:00|+0.19|0.59|0.8420|
#> |x| 9| 16| 91| 0.03917574490| 26|00:00:00|+0.31|0.54|0.6617|
#> |x| 8| 16| 91| 0.03487616768| 39|00:00:00|+0.37|0.53|0.5788|
#> |x| 6| 16| 128| 0.4500345539| 44|00:00:00|+0.32|0.46|0.5504|
#> |x| 7| 16| 128| 0.3975991523| 49|00:00:00|+0.26|0.38|0.6140|
#> |.| 4| 16| 128| 1.762868241| 49|00:00:00|+0.21|0.32|0.6903|
#> |.| 3| 16| 128| 2.045212556| 49|00:00:00|+0.23|0.33|0.6596|
#> |.| 2| 16| 128| 1.820441720| 49|00:00:00|+0.24|0.33|0.6561|
#> |.| 5| 16| 128| 1.649445285| 49|00:00:00|+0.25|0.32|0.6605|
#> |-| 11| 4| 80| 0.4915594776| 65|00:00:00|-0.03|0.07|0.7859|
#> |=| 12| 4| 91| 0.4379356217| 69|00:00:00|+0.01|0.09|0.7705|
#> |=| 13| 4| 91| 0.4057438824| 73|00:00:00|+0.05|0.12|0.7418|
#> |=| 14| 4| 91| 0.4014988437| 77|00:00:00|+0.08|0.15|0.7158|
#> |=| 15| 4| 91| 0.3874512014| 81|00:00:00|+0.10|0.16|0.6867|
#> |=| 16| 4| 91| 0.3677075297| 85|00:00:00|+0.05|0.11|0.7208|
#> |=| 17| 4| 91| 0.3538188571| 89|00:00:00|+0.06|0.11|0.7281|
#> |=| 18| 4| 91| 0.3518531743| 93|00:00:00|+0.07|0.12|0.7260|
#> |-| 19| 3| 91| 0.3379661034| 97|00:00:00|-0.02|0.04|0.6767|
#> |=| 20| 3| 91| 0.3256171422| 100|00:00:00|-0.00|0.05|0.6626|
#> +-+-----------+-----------+-----------+----------------+-----------+--------+-----+----+------+
#> Best-so-far configuration: 91 mean value: 0.3256171422
#> Description of the best-so-far configuration:
#> .ID. tmax temp .PARENT.
#> 91 91 66 44.6677 28
#>
#> # 2025-10-17 19:25:21 UTC: Elite configurations (first number is the configuration ID; listed from best to worst according to the sum of ranks):
#> tmax temp
#> 91 66 44.6677
#> 80 123 42.5337
#> 128 191 40.5608
#> # Total CPU user time: 54.592, CPU sys time: 0.121, Wall-clock time: 55.109
#> .ID. tmax temp .PARENT. .RANK. .WEIGHT.
#> 91 91 66 44.6677 28 37 0.5000000
#> 80 80 123 42.5337 18 38 0.3333333
#> 128 128 191 40.5608 80 45 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] 91 80 128
#> ..$ tmax : int [1:3] 66 123 191
#> ..$ temp : num [1:3] 44.7 42.5 40.6
#> ..$ .PARENT.: int [1:3] 28 18 80
#> ..$ .RANK. : num [1:3] 37 38 45
#> ..$ .WEIGHT.: num [1:3] 0.5 0.333 0.167
#> $ instances :Classes ‘data.table’ and 'data.frame': 20 obs. of 2 variables:
#> ..$ instanceID: int [1:20] 20 19 7 25 34 50 42 6 21 10 ...
#> ..$ seed : int [1:20] 232049485 32055254 1641632623 1631511891 2050085845 822857599 188021279 1591959540 324610117 1741880949 ...
#> ..- attr(*, ".internal.selfref")=<externalptr>
#> $ max_experiments: int 100
#> $ experiments : num [1:20, 1:16] 4.08 7.41 3.03 2.15 0.12 ...
#> ..- attr(*, "dimnames")=List of 2
#> .. ..$ : chr [1:20] "1" "10" "9" "8" ...
#> .. ..$ : chr [1:16] "1" "2" "3" "4" ...
#> $ elites : int [1:3] 91 80 128
# }