# Plot results for Example 1 under known position effects
# Reproduce the left panel of Figure 1 in the manuscript

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 = np.load("TLR-UCB_Ex1_reg_mean_1.npy")
y_tlr = acu(y_tlr)

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

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


horizon = len(y_tlr)
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,color='red',linewidth=1.5)
plt.legend(labels=['LR-UCB','A-UCB-V','TLR-UCB'],loc='best',fontsize = 12)
plt.axis([0,horizon,0,max(max(y_tlr),max(y_a))])
plt.xlabel("Time",fontsize = 20)
plt.ylabel("Regret",fontsize = 20)
plt.title("Example 1",fontsize = 24)
plt.show()



