Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import logging
- import gym
- from agents.SimulatedAnnealing import SimulatedAnnealingAgent
- def main():
- logger = logging.getLogger()
- logger.setLevel(logging.DEBUG)
- env = gym.make('Acrobot-v0')
- agent = SimulatedAnnealingAgent(env.action_space, decay=0.8, alpha=3)
- upload = True # Sets whether to upload to OpenAI
- outdir = '/tmp/' + agent.name + '-results'
- env.monitor.start(outdir, force=True)
- episode_count = 1000
- for i in xrange(episode_count):
- ob = env.reset()
- done = False
- reward = 0
- while not done:
- action = agent.act(ob, reward, done)
- ob, reward, done, _ = env.step(action)
- agent.act(ob, reward, done) # Final push required so agent receives notification that episode is done and can update model
- # Dump result info to disk
- env.monitor.close()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement