2 digits from repairConfiguration

13 views
Skip to first unread message

nico.rod...@gmail.com

unread,
Oct 19, 2022, 9:45:15 AM10/19/22
to The irace package: Iterated Racing for Automatic Configuration
Hello,

In the previous thread, I was recommended to use a repair configuration. I am using this one:

repairConfiguration = function (configuration, parameters, digits)
{
    columns <- c("pC1","pC2","pC3","pC4")
    cat("Before\n");
    print(configuration)
    configuration[columns] <- configuration[columns] / sum(configuration[columns])
    cat("After\n");
    print(configuration)
    return(configuration)
}

It works properly, but the values generated (after being repaired) have more than two decimals. How I can set to two decimals?

Question_iRace.PNG

The results returned by iRace also have more than two decimals.

I know that I have to do something with "digits" but ...

Thanks in advance.

Best regards,

Nicolas R. Uribe

Manuel López-Ibáñez

unread,
Oct 19, 2022, 10:43:31 AM10/19/22
to The irace package: Iterated Racing for Automatic Configuration
Hi Nicolas,

You may need to use "configuration[columns] <- round(configuration[columns], digits)" before returning.

But if it is mandatory that the values sum up to 1, even after rounding, then you may need to do:

configuration[columns] <- round(configuration[columns], digits)
configuration["pc4"] <- 1.0 - sum(configuration[c("pc1", "pc2", "pc3")])

(assuming you have set "digits=2" in scenario.txt)

Cheers,

Manuel.
Reply all
Reply to author
Forward
0 new messages