示例#1
0
 def setup_space(self):
     self.observation_space = spaces.Box(low=0,
                                         high=config.ss_state_max_queue,
                                         shape=(config.ss_num_ports,
                                                config.ss_num_ports))
     self.action_space = spaces.Discrete(math.factorial(
         config.ss_num_ports))
示例#2
0
 def setup_space(self):
     # Set up the observation and action space
     # The boundary of the space may change if the dynamics is changed
     # a warning message will show up every time e.g., the observation falls
     # out of the observation space
     self.obs_low = np.array([0] * (config.num_servers + 1))
     self.obs_high = np.array([config.load_balance_obs_high] * (config.num_servers + 1))
     self.observation_space = spaces.Box(
         low=self.obs_low, high=self.obs_high, dtype=np.float32)
     self.action_space = spaces.Discrete(config.num_servers)
示例#3
0
文件: abr.py 项目: saeid93/park-rllib
 def setup_space(self):
     # Set up the observation and action space
     # The boundary of the space may change if the dynamics is changed
     # a warning message will show up every time e.g., the observation falls
     # out of the observation space
     self.obs_low = np.array([0] * 11)
     self.obs_high = np.array([
         10e6, 100, 100, 500, 5, 10e6, 10e6, 10e6, 10e6, 10e6, 10e6])
     self.observation_space = spaces.Box(
         low=self.obs_low, high=self.obs_high, dtype=np.float32)
     self.action_space = spaces.Discrete(6)
示例#4
0
    def __init__(self, seed=42):
        self.seed(seed)
        self.cache_size = config.cache_size

        # load trace, attach initial online feature values
        self.src = TraceSrc(trace=config.cache_trace, cache_size=self.cache_size)

        # set up the state and action space
        self.action_space = spaces.Discrete(2)
        self.observation_space = spaces.Box(self.src.min_values, \
                                      self.src.max_values, \
                                      dtype=np.float32)

        # cache simulator
        self.sim = CacheSim(cache_size=self.cache_size, \
                            policy='lru', \
                            action_space=self.action_space, \
                            state_space=self.observation_space)

        # reset environment (generate new jobs)
        self.reset(1, 2)