# Plot results for Example 1 under known position effects, especially for TLR-UCB under different \nu_{0}
# Reproduce Figure 1 in the appendix

import os
import sys
sys.path.append('/Your Path/Data_Code/Methods')
from Pre_Functions import acu
import numpy as np
import matplotlib.pyplot as plt


# read data
os.chdir('/Your Path/Data_Code/Simulation/Results')
y_tlr_1 = np.load("TLR-UCB_Ex1_reg_mean_Sen_1.npy")
y_tlr_1 = acu(y_tlr_1)

y_tlr_2 = np.load("TLR-UCB_Ex1_reg_mean_Sen_2.npy")
y_tlr_2 = acu(y_tlr_2)

y_tlr_3 = np.load("TLR-UCB_Ex1_reg_mean_Sen_3.npy")
y_tlr_3 = acu(y_tlr_3)

y_lr = np.load("LR-UCB_Ex1_reg_mean_Sen_1.npy")
y_lr = acu(y_lr)

y_a = np.load("A-UCB-V_Ex1_reg_mean_Sen_1.npy")
y_a = acu(y_a)


horizon = len(y_tlr_1)
x0 = list(range(1,horizon+1))
l1 = plt.plot(x0,y_lr,color='purple',linewidth=1.5,linestyle=':')
l2 = plt.plot(x0,y_a,color='green',linewidth=1.5,linestyle='-.')
l3 = plt.plot(x0,y_tlr_1,color='red',linewidth=1.5)
l4 = plt.plot(x0,y_tlr_2,color='cyan',linewidth=1.5,linestyle='--')
l5 = plt.plot(x0,y_tlr_3,color='orange',linewidth=1.5,linestyle=':')
plt.legend(labels=['LR-UCB','A-UCB-V',r"TLR-UCB:$\nu_{0}=1$",r"TLR-UCB:$\nu_{0}=1.5$",r"TLR-UCB:$\nu_{0}=2$"],loc='best',fontsize = 12)
plt.axis([0,horizon,0,max(max(y_a),max(y_tlr_1),max(y_tlr_2),max(y_tlr_3))])
plt.xlabel("Time",fontsize = 20)
plt.ylabel("Regret",fontsize = 20)
plt.title(r"Choice of $\nu_{0}$",fontsize = 24)
plt.show()