Skip to content
Snippets Groups Projects
Select Git revision
  • 2b44091bc4045e71f11153c6b115cdeb7aa53483
  • main default
2 results

lecture_10_mc_control.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    lecture_10_mc_control.py 914 B
    # This file may not be shared/redistributed without permission. Please read copyright notice in the git repo. If this file contains other copyright notices disregard this text.
    from irlc.lectures.lec10.lecture_10_mc_q_estimation import keyboard_play
    from irlc.gridworld.gridworld_environments import BookGridEnvironment
    from irlc.ex10.mc_agent import MCAgent
    # from irlc.lectures.lec10.utils import MCAgentResettable
    
    import numpy as np
    
    if __name__ == "__main__":
        np.random.seed(433)
        env = BookGridEnvironment(render_mode='human',zoom=2, living_reward=-0.05)
        # agent = MCAgent(env, gamma=0.9, epsilon=0.15, alpha=0.1, first_visit=True)
        from irlc.lectures.lec10.utils import agent_reset
        MCAgent.reset = agent_reset
        agent = MCAgent(env, gamma=1.0, epsilon=0.15, alpha=None, first_visit=True)
    
        # env, agent = interactive(env, agent)
        keyboard_play(env,agent,method_label='MC control')