Commit 4c718543 authored by Eric Hambro's avatar Eric Hambro
Browse files

Remove unnecessary functions.

parent 2c437cb4
...@@ -3,19 +3,11 @@ import numpy as np ...@@ -3,19 +3,11 @@ import numpy as np
from agents.batched_agent import BatchedAgent from agents.batched_agent import BatchedAgent
class RandomAgent(BatchedAgent): class RandomAgent(BatchedAgent):
"""This random agent just selects an action from the action space."""
def __init__(self, num_envs, num_actions): def __init__(self, num_envs, num_actions):
super().__init__(num_envs, num_actions) super().__init__(num_envs, num_actions)
self.seeded_state = np.random.RandomState(42) self.seeded_state = np.random.RandomState(42)
def preprocess_observations(self, observations, rewards, dones, infos):
return observations, rewards, dones, infos
def postprocess_actions(self, actions):
return actions
def batched_step(self, observations, rewards, dones, infos): def batched_step(self, observations, rewards, dones, infos):
rets = self.preprocess_observations(observations, rewards, dones, infos)
observations, rewards, dones, infos = rets
actions = self.seeded_state.randint(self.num_actions, size=self.num_envs) actions = self.seeded_state.randint(self.num_actions, size=self.num_envs)
actions = self.postprocess_actions(actions)
return actions return actions
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment