install.packages("mlbench")
install.packages("mlr3")
install.packages("mlr3learners")
install.packages("mlr3viz")
install.packages("kknn")
install.packages("e1071")
install.packages("kdensity")
library("parallel")
library('ExtDist')
library(R6)
library(evd)
library(rootSolve)
source("Feedback.R")
source("Feedback.R")
getwd()
setwd("C:\\Users\\bengs\\LRZ Sync+Share\\Research\\Contextual_Pref_Bandits\\ICML_2022\\Simulation_files")
getwd()
source("Feedback.R")
source("Performance.R")
source("Auxiliary.R")
source("Learner.R")
source("MLE.R")
source("Random.R")
source("MaxInP.R")
source("COLSTIM.R")
source("SelfSparring.R")
source("DTS.R")
set.seed(21)
T 			= 3000
num_arms 	= 50
dim 		= 10
num.cores 	<- 16 # number of CPU cores
reps 		= 100
num.cores 	<- 1
reps=1
num_arms= 10
tau_0 		= dim*num_arms
p_t = function(x){
min(1,dim/(sqrt(x-tau_0))*log(dim*T) )
}
threshold	= sqrt(dim * log(T))
rand    <- Random$new(data_model_specs = list(num_arms = num_arms, dim = dim), aggregation = mean )
maxinp  <- MaxInP$new(data_model_specs = list(num_arms = num_arms, dim = dim), aggregation = mean, eta = threshold, tau_0 = tau_0, fullMLE = FALSE, alpha = 0.5 )
colstim <- COLSTIM$new(data_model_specs = list(num_arms = num_arms, dim = dim), aggregation = mean,  tau_0 = tau_0, cdf = plogis, df =dlogis, pert_dis = rgumbel,  fullMLE = FALSE,
eta = 0.5 , threshold = threshold, p_t = p_t )
ss 		<- SelfSparring$new(data_model_specs = list(num_arms = num_arms, dim = dim), aggregation = mean , action_size = 2, eta = 3.5)
dts 	<- DTS$new(data_model_specs = list(num_arms = num_arms, dim = dim), aggregation = mean , alpha = 0.51)
diff_vec 	= c("easy","medium","hard")
perf 		= Performance$new(learners = list(rand,maxinp,colstim,ss,dts), d = dim, diff="easy", time_horizon = T, n = num_arms, pert_dis = rgumbel, reps= reps )
perf$runSimulations()
perf$getStatistics()
perf$plotCumRegret()
reps=2
diff_vec 	= c("easy","medium","hard")
perf 		= Performance$new(learners = list(rand,maxinp,colstim,ss,dts), d = dim, diff="easy", time_horizon = T, n = num_arms, pert_dis = rgumbel, reps= reps )
perf$runSimulations()
perf$getStatistics()
perf$plotCumRegret()
rand    <- Random$new(data_model_specs = list(num_arms = num_arms, dim = dim), aggregation = mean )
maxinp  <- MaxInP$new(data_model_specs = list(num_arms = num_arms, dim = dim), aggregation = mean, eta = threshold, tau_0 = tau_0, fullMLE = FALSE, alpha = 0.5 )
colstim <- COLSTIM$new(data_model_specs = list(num_arms = num_arms, dim = dim), aggregation = mean,  tau_0 = tau_0, cdf = pnorm, df =dnorm, pert_dis = rnorm, fullMLE = FALSE,
eta = 0.5 , threshold = threshold, p_t = p_t )
ss 		<- SelfSparring$new(data_model_specs = list(num_arms = num_arms, dim = dim), aggregation = mean , action_size = 2, eta = 3.5)
dts 	<- DTS$new(data_model_specs = list(num_arms = num_arms, dim = dim), aggregation = mean , alpha = 0.51)
diff_vec 	= c("easy","medium","hard")
perf 		= Performance$new(learners = list(rand,maxinp,colstim,ss,dts), d = dim, diff="easy", time_horizon = T, n = num_arms, pert_dis = rnorm, reps= reps )
perf$runSimulations()
perf$getStatistics()
perf$plotCumRegret()
