from baselines.common import plot_util as pu
results1 = pu.load_results('../Documents/PhD/allresults/IceHockey_acer_4c/acer_single-0')
results2 = pu.load_results('../Documents/PhD/allresults/IceHockey_garl_acer')
#print(len(results))

import matplotlib.pyplot as plt
import pandas as pd

r1 = results1[0]
r2 = results2[0]
#pu.plot_results_garl(results)
#print(type(r1.progress.eprewmean))
r1s = r1.progress['total_timesteps']
r2s = r2.progress['total_timesteps']
r2s_2 = r2s.append(r1s[r1s > r2s[r2s.size-1]])
r2_2 = pd.Series([r2.progress.mean_episode_reward[r2.progress.mean_episode_reward.size-1] for i in range(int(r2s_2.size-r2.progress.mean_episode_reward.size))])
r2_3 = r2.progress.mean_episode_reward.append(r2_2)
plt.plot(r1.progress['total_timesteps'], r1.progress.mean_episode_reward, label='single-agent')
plt.plot(r2s_2, r2_3, label='group-agent')
plt.xlim([0, 4e7])
plt.title('ACER')
plt.xlabel('timesteps')
plt.ylabel('reward')
plt.legend()
plt.show()
