# NOT RUN {
horizon <- 100L
simulations <- 100L
# rows represent features, columns represent arms:
context_weights <- matrix( c(0.4, 0.2, 0.4,
0.3, 0.4, 0.3,
0.1, 0.8, 0.1), nrow = 3, ncol = 3, byrow = TRUE)
bandit <- ContextualPrecachingBandit$new(weights)
agents <- list( Agent$new(EpsilonGreedyPolicy$new(0.1), bandit),
Agent$new(LinUCBDisjointOptimizedPolicy$new(0.6), bandit))
simulation <- Simulator$new(agents, horizon, simulations)
history <- simulation$run()
plot(history, type = "cumulative")
# }
Run the code above in your browser using DataLab