def __init__( self, action_space: gym.Space, observation_space: gym.Space, max_concurrent: int = 100, ): """Initializes an ExternalMultiAgentEnv instance. Args: action_space: Action space of the env. observation_space: Observation space of the env. max_concurrent: Max number of active episodes to allow at once. Exceeding this limit raises an error. """ ExternalEnv.__init__(self, action_space, observation_space, max_concurrent) # We require to know all agents' spaces. if isinstance(self.action_space, dict) or isinstance( self.observation_space, dict ): if not (self.action_space.keys() == self.observation_space.keys()): raise ValueError( "Agent ids disagree for action space and obs " "space dict: {} {}".format( self.action_space.keys(), self.observation_space.keys() ) )
def __init__(self, number_of_plants, server_port=9920, max_bid=600): self.SERVER_ADDRESS = "localhost" # SERVER_PORT = 9920 self.CHECKPOINT_FILE = "last_checkpoint.out" self.server_port = server_port self.max_bid = max_bid self.number_of_plants = number_of_plants lower_bounds = [-100000] * 7 # lower_bounds.extend([-99999]) upper_bounds = [10000000] * 7 # upper_bounds.extend([99999]) ExternalEnv.__init__( self, # MultiDiscrete([16, 10]), # Discrete(159), # action_space=Box(shape=37), # action_space=Box(low=0, high=200, shape=(37,), dtype=np.float), action_space=Box(low=0, high=self.max_bid, shape=(self.number_of_plants, ), dtype=np.float), observation_space=Box(np.array(lower_bounds), np.array(upper_bounds)))
def __init__(self, config): ExternalEnv.__init__( self, spaces.Discrete(config["action_size"]), spaces.Box( low=-10, high=10, shape=(config["observation_size"],), dtype=np.float32)) self.server = config["input"]
def __init__(self, config): self.config = config ExternalEnv.__init__( self, action_space=spaces.Discrete(config['action_size']), observation_space=spaces.Box(low=-10, high=10, shape=(config['observation_size'], ), dtype=np.float32))
def __init__(self, external_env: ExternalEnv, preprocessor: "Preprocessor" = None): self.external_env = external_env self.prep = preprocessor self.multiagent = issubclass(type(external_env), ExternalMultiAgentEnv) self.action_space = external_env.action_space if preprocessor: self.observation_space = preprocessor.observation_space else: self.observation_space = external_env.observation_space external_env.start()
def __init__(self, action_space, observation_space, max_concurrent=100): """Initialize a multi-agent external env. ExternalMultiAgentEnv subclasses must call this during their __init__. Arguments: action_space (gym.Space): Action space of the env. observation_space (gym.Space): Observation space of the env. max_concurrent (int): Max number of active episodes to allow at once. Exceeding this limit raises an error. """ ExternalEnv.__init__(self, action_space, observation_space, max_concurrent) # we require to know all agents' spaces if isinstance(self.action_space, dict) or isinstance( self.observation_space, dict): if not (self.action_space.keys() == self.observation_space.keys()): raise ValueError("Agent ids disagree for action space and obs " "space dict: {} {}".format( self.action_space.keys(), self.observation_space.keys()))
def __init__(self, env, off_pol_frac): ExternalEnv.__init__(self, env.action_space, env.observation_space) self.env = env self.off_pol_frac = off_pol_frac
def __init__(self, action_space, observation_space): ExternalEnv.__init__(self, action_space, observation_space)
def __init__(self, env, fixed_action): ExternalEnv.__init__(self, env.action_space, env.observation_space) self.env = env self.fixed_action = fixed_action
def __init__(self, env): ExternalEnv.__init__(self, env.action_space, env.observation_space) self.env = env
def __init__(self): ExternalEnv.__init__(self, spaces.Discrete(64), spaces.Box(low, high, dtype=np.float32))
def __init__(self, env_creator): self.env_creator = env_creator self.env = env_creator() ExternalEnv.__init__(self, self.env.action_space, self.env.observation_space)
def __init__(self, env, file_name: str): ExternalEnv.__init__(self, env.action_space, env.observation_space) self.csv_file = open(file_name, newline='')
def __init__(self, env, episodes: int): ExternalEnv.__init__(self, env.action_space, env.observation_space) self.env = env self.episodes = episodes
def __init__(self): ExternalEnv.__init__( self, spaces.Discrete(3), #discrete state == [0, 1, 2] or sell, hold, buy spaces.Box(low=-100, high=100, shape=(10, ), dtype=np.float32)) # we'll take an NP array of 10 positions between -100, and 100 to train
def __init__(self): ExternalEnv.__init__( self, spaces.Discrete(2), spaces.Box(low=-10, high=10, shape=(4, ), dtype=np.float32))
def __init__(self): ExternalEnv.__init__(self, RLHelper.action_space(), RLHelper.observation_space()) self.port = SERVER_PORT