You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the agent_loop in evaluation.py (with a fix for #43 used)
[...]
whileepisode<EVAL_EPISODES:
# check if env needs resetifenv.done:
print('Episode %d (%.2f)%%'% (episode, (episode/EVAL_EPISODES) *100.))
# **** fixes #43iftype(agent.current_agent) ==RandomAgent:
agent_type=PigChaseEnvironment.AGENT_TYPE_1else:
agent_type=PigChaseEnvironment.AGENT_TYPE_2obs=env.reset(agent_type)
# ****whileobsisNone:
# this can happen if the episode ended with the first# action of the other agentprint('Warning: received obs == None.')
obs=env.reset()
episode+=1# select an actionaction=agent.act(obs, reward, agent_done, is_training=True)
# take a stepobs, reward, agent_done=env.do(action)
Since agent.act([...],agent_done=True,[...]) resets the current_agent used, it needs to happen before env.reset(agent_type). Otherwise the appearance of the agent is based on the agent type used during the previous episode.
By simply moving the agent.act([...]) call above the if env.done, leads to an action from the previous episode to be given as the first action in the subsequent episode.
In the agent_loop in evaluation.py (with a fix for #43 used)
Since
agent.act([...],agent_done=True,[...])resets the current_agent used, it needs to happen beforeenv.reset(agent_type). Otherwise the appearance of the agent is based on the agent type used during the previous episode.By simply moving the
agent.act([...])call above theif env.done, leads to an action from the previous episode to be given as the first action in the subsequent episode.