"""
This python file corresponds to the influence of \nu_{0} on TLR-UCB under Example 1
"""

import sys
import os
import numpy as np
sys.path.append('/Your Path/Data_Code/Methods')
import TLR_UCB as TU
import LR_UCB as LU
import A_UCB_V as AUV


# Example 1 setting:
# pos: the position effect vector
# v: the preference vector
# r: the revenue vector
# T: horizon length
# simu_times: number of replications
pos = [1,1/2]
v = [1/4,2/5,4/5]
r = [4/5,3/4,1/2]
T = 200000
simu_times = 500

# more parameters for TLR-UCB, LR-UCB, and A-UCB-V:
# lam: lambda
# c_UCB: UCB constant ahead of the bonus
# rsd: np.random.seed
lam = 1
c_UCB = 0.01
rsd = 0


# apply TLR-UCB with different \nu_{0} (v_max)
v_max = 1
reg_mean_TLR_UCB_Ex1_Sen_1 = TU.TLR_UCB(pos,v,r,v_max,T,simu_times,lam,c_UCB,rsd)
print(np.sum(reg_mean_TLR_UCB_Ex1_1))

v_max = 1.5
reg_mean_TLR_UCB_Ex1_Sen_2 = TU.TLR_UCB(pos,v,r,v_max,T,simu_times,lam,c_UCB,rsd)
print(np.sum(reg_mean_TLR_UCB_Ex1_2))

v_max = 2
reg_mean_TLR_UCB_Ex1_Sen_3 = TU.TLR_UCB(pos,v,r,v_max,T,simu_times,lam,c_UCB,rsd)
print(np.sum(reg_mean_TLR_UCB_Ex1_3))

reg_mean_LR_UCB_Ex1_Sen = LU.LR_UCB(pos,v,r,v_max,T,simu_times,lam,c_UCB,rsd)
print(np.sum(reg_mean_LR_UCB_Ex1_Sen))

reg_mean_A_UCB_V_Ex1_Sen = AUV.A_UCB_V(pos,v,r,T,simu_times,c_UCB,rsd)
print(np.sum(reg_mean_A_UCB_V_Ex1_Sen))


# save the results
os.chdir('/Your Path/Data_Code/Simulation/Results')
np.save("TLR-UCB_Ex1_reg_mean_Sen_1.npy",reg_mean_TLR_UCB_Ex1_Sen_1)
np.save("TLR-UCB_Ex1_reg_mean_Sen_2.npy",reg_mean_TLR_UCB_Ex1_Sen_2)
np.save("TLR-UCB_Ex1_reg_mean_Sen_3.npy",reg_mean_TLR_UCB_Ex1_Sen_3)
np.save("LR-UCB_Ex1_reg_mean_Sen_1.npy",reg_mean_LR_UCB_Ex1_Sen)
np.save("A-UCB-V_Ex1_reg_mean_Sen_1.npy",reg_mean_A_UCB_V_Ex1_Sen)