# Plot results for real car data under unknown position effects
# Reproduce the right panel of Figure 4 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 and process data
simu_times = 50
T = 4000000

os.chdir('/Your Path/Data_Code/Real_Application/Results/EI_TLR')
y_eitlr_0 = np.zeros((simu_times,T))
for i in range(simu_times):
    s = "EI-TLR_reg_mean_" + str(i+1) + ".npy"
    y_eitlr_0[i,] = np.load(s)
y_eitlr = np.mean(y_eitlr_0,axis=0)
y_eitlr = acu(y_eitlr)

os.chdir('/Your Path/Data_Code/Real_Application/Results/A_UCB')
y_a_0 = np.zeros((simu_times,T))
for i in range(simu_times):
    s = "A-UCB_reg_mean_" + str(i+1) + ".npy"
    y_a_0[i,] = np.load(s)
y_a = np.mean(y_a_0,axis=0)
y_a = acu(y_a)


horizon = len(y_eitlr)
x0 = list(range(1,horizon+1))
l1 = plt.plot(x0,y_a,color='green',linewidth=1.5,linestyle='--')
l2 = plt.plot(x0,y_eitlr,color='blue',linewidth=1.5)
plt.legend(labels=['A-UCB','EI-TLR'],loc='best',fontsize = 12)
plt.axis([0,horizon,0,max(max(y_eitlr),max(y_a))])
plt.xlabel("Time",fontsize = 20)
plt.ylabel("Regret",fontsize = 20)
plt.title("Car Data: Unknown Position Effects",fontsize = 20)
plt.show()