# NOT RUN {
# Uses dummy algorithms and a dummy instance to illustrate the
# use of calc_nreps2
algorithm1 <- list(FUN = "dummyalgo", alias = "algo1",
distribution.fun = "rnorm",
distribution.pars = list(mean = 10, sd = 1))
algorithm2 <- list(FUN = "dummyalgo", alias = "algo2",
distribution.fun = "rnorm",
distribution.pars = list(mean = 20, sd = 4))
instance <- list(FUN = "dummyinstance")
# Theoretical results for an SE = 0.5 on the simple difference:
# phi = 10; n1 = 20; n2 = 80
# (using the parametric approach)
my.reps <- calc_nreps2(instance, algorithm1, algorithm2,
se.max = 0.5, dif = "simple", seed = 1234)
cat("n1j =", my.reps$n1j, "\nn2j =", my.reps$n2j,
"\nphi_j =", my.reps$phi.est, "\nse =", my.reps$se)
# Forcing equal sample sizes:
my.reps <- calc_nreps2(instance, algorithm1, algorithm2,
se.max = 0.5, dif = "simple", seed = 1234,
force.balanced = TRUE)
cat("n1j =", my.reps$n1j, "\nn2j =", my.reps$n2j,
"\nphi_j =", my.reps$phi.est, "\nse =", my.reps$se)
# }
# NOT RUN {
# Using the bootstrap approach
algorithm3 <- list(FUN = "dummyalgo", alias = "algo3",
distribution.fun = "rchisq",
distribution.pars = list(df = 2, ncp = 3))
my.reps <- calc_nreps2(instance, algorithm1, algorithm3,
se.max = 0.05, dif = "perc",
method = "boot", seed = 1234,
nstart = 20)
cat("n1j =", my.reps$n1j, "\nn2j =", my.reps$n2j,
"\nphi_j =", my.reps$phi.est, "\nse =", my.reps$se)
# }
# NOT RUN {
# }
# NOT RUN {
# Example for a 21-city TSP instance using 2 configurations of SANN
algorithm1 <- list(FUN = "my.SANN", alias = "algo1",
Temp = 2000, budget = 10000)
algorithm2 <- list(FUN = "my.SANN", alias = "algo2",
Temp = 4000, budget = 10000)
instance <- list(FUN = "TSP.dist",
mydist = datasets::eurodist)
my.reps <- calc_nreps2(instance, algorithm1, algorithm2,
se.max = 0.01, dif = "perc",
method = "param", seed = 1234,
nstart = 20)
cat("n1j =", my.reps$n1j, "\nn2j =", my.reps$n2j,
"\nphi_j =", my.reps$phi.est, "\nse =", my.reps$se)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab