def init_env(config, port=0, naive_policy=False): if config.get('scenario') == 'small_grid': if not naive_policy: return SmallGridEnv(config, port=port) else: env = SmallGridEnv(config, port=port) policy = SmallGridController(env.node_names) return env, policy elif config.get('scenario') == 'large_grid': if not naive_policy: return LargeGridEnv(config, port=port) else: env = LargeGridEnv(config, port=port) policy = LargeGridController(env.node_names) return env, policy elif config.get('scenario') == 'real_net': if not naive_policy: return RealNetEnv(config, port=port) else: env = RealNetEnv(config, port=port) policy = RealNetController(env.node_names, env.nodes) return env, policy elif config.get('scenario') in [ 'Acrobot-v1', 'CartPole-v0', 'MountainCar-v0' ]: return GymEnv(config.get('scenario')) else: if not naive_policy: return None else: return None, None
def init_env(config, port=0): scenario = config.get('scenario') if scenario.startswith('atsc'): if scenario.endswith('large_grid'): return LargeGridEnv(config, port=port) else: return RealNetEnv(config, port=port) else: return CACCEnv(config)