def __init__(self, env, config=None):
     super(AbstractDQNAgent, self).__init__(config)
     self.env = env
     assert isinstance(env.action_space, spaces.Discrete) or isinstance(env.action_space, spaces.Tuple), \
         "Only compatible with Discrete action spaces."
     self.memory = ReplayMemory(self.config)
     self.exploration_policy = exploration_factory(self.config["exploration"], self.env.action_space)
     self.training = True
     self.previous_state = None
Exemple #2
0
 def __init__(self, env, config=None):
     super(AbstractDQNAgent, self).__init__(config)
     self.env = env
     assert isinstance(
         env.action_space,
         spaces.Discrete), "Only compatible with Discrete action spaces."
     self.config["model"]["in"] = int(np.prod(env.observation_space.shape))
     self.config["model"]["out"] = env.action_space.n
     self.memory = ReplayMemory(self.config)
     self.exploration_policy = exploration_factory(
         self.config["exploration"], self.env.action_space)
     self.training = True
     self.previous_state = None
Exemple #3
0
 def eval(self):
     self.training = False
     self.config['exploration']['method'] = "Greedy"
     self.exploration_policy = exploration_factory(
         self.config["exploration"], self.env.action_space)