# Plot results for Example 2 under unknown position effects
# Reproduce the middle panel of Figure 2 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_setc = np.load("S-ETC_Ex2_reg_mean_1.npy")
y_setc = acu(y_setc)

y_aucb = np.load("A-UCB_Ex2_reg_mean_1.npy")
y_aucb = acu(y_aucb)

y_eitlr = np.load("EI-TLR_Ex2_reg_mean_1.npy")
y_eitlr = acu(y_eitlr)


horizon = len(y_eitlr)
x0 = list(range(1,horizon+1))
l1 = plt.plot(x0,y_setc,color='black',linewidth=1.5,linestyle=':')
l2 = plt.plot(x0,y_aucb,color='green',linewidth=1.5,linestyle='--')
l3 = plt.plot(x0,y_eitlr,color='blue',linewidth=1.5)
plt.legend(labels=['S-ETC','A-UCB','EI-TLR'],loc='best',fontsize = 12)
plt.axis([0,horizon,0,1/2*max(max(y_setc),max(y_aucb),max(y_eitlr))])
plt.xlabel("Time",fontsize = 20)
plt.ylabel("Regret",fontsize = 20)
plt.title("Example 2",fontsize = 24)
plt.show()