예제 #1
0
def test_aeb_space(test_spec):
    global aeb_space
    if aeb_space is None:
        aeb_space = AEBSpace(test_spec, InfoSpace())
        env_space = EnvSpace(test_spec, aeb_space)
        agent_space = AgentSpace(test_spec, aeb_space)
        aeb_space.init_body_space()
    return aeb_space
예제 #2
0
 def __init__(self, spec):
     self.spec = spec
     self.coor, self.index = info_space.index_lab_comp(self)
     self.df = None
     self.fitness_df = None
     self.aeb_space = AEBSpace(self.spec)
     self.env_space = EnvSpace(self.spec, self.aeb_space)
     self.agent_space = AgentSpace(self.spec, self.aeb_space)
     logger.info(util.self_desc(self))
     self.aeb_space.init_body_space()
     self.aeb_space.post_body_init()
예제 #3
0
def test_prioritized_replay_memory(request):
    memspec = spec_util.get('base.json', 'base_prioritized_replay_memory')
    memspec = util.override_test_spec(memspec)
    aeb_mem_space = AEBSpace(memspec, InfoSpace())
    env_space = EnvSpace(memspec, aeb_mem_space)
    aeb_mem_space.init_body_space()
    agent_space = AgentSpace(memspec, aeb_mem_space)
    agent = agent_space.agents[0]
    body = agent.nanflat_body_a[0]
    res = (body.memory, ) + request.param
    return res
예제 #4
0
 def __init__(self, spec, info_space=InfoSpace()):
     self.spec = spec
     if info_space.get('session') is None:
         info_space.tick('session')
     self.info_space = info_space
     self.coor, self.index = self.info_space.get_coor_idx(self)
     # TODO option to set rand_seed. also set np random seed
     self.torch_rand_seed = torch.initial_seed()
     self.data = None
     self.aeb_space = AEBSpace(self.spec, self.info_space)
     self.env_space = EnvSpace(self.spec, self.aeb_space)
     self.agent_space = AgentSpace(self.spec, self.aeb_space)
     logger.info(util.self_desc(self))
     self.aeb_space.init_body_space()
     self.aeb_space.post_body_init()
예제 #5
0
 def __init__(self, spec, info_space=None):
     info_space = info_space or InfoSpace()
     init_thread_vars(spec, info_space, unit='session')
     self.spec = spec
     self.info_space = info_space
     self.coor, self.index = self.info_space.get_coor_idx(self)
     # TODO option to set rand_seed. also set np random seed
     self.torch_rand_seed = torch.initial_seed()
     self.data = None
     self.aeb_space = AEBSpace(self.spec, self.info_space)
     self.env_space = EnvSpace(self.spec, self.aeb_space)
     self.agent_space = AgentSpace(self.spec, self.aeb_space)
     logger.info(util.self_desc(self))
     self.aeb_space.init_body_space()
     self.aeb_space.post_body_init()
     logger.info(f'Initialized session {self.index}')
예제 #6
0
파일: control.py 프로젝트: vmuthuk2/SLM-Lab
    def __init__(self, spec, info_space, global_nets=None):
        self.spec = spec
        self.info_space = info_space
        self.index = self.info_space.get('session')
        util.set_logger(self.spec, self.info_space, logger, 'session')
        self.data = None

        self.aeb_space = AEBSpace(self.spec, self.info_space)
        self.env_space = EnvSpace(self.spec, self.aeb_space)
        self.aeb_space.init_body_space()
        util.set_rand_seed(self.info_space.get_random_seed(), self.env_space)
        util.try_set_cuda_id(self.spec, self.info_space)
        self.agent_space = AgentSpace(self.spec, self.aeb_space, global_nets)

        logger.info(util.self_desc(self))
        logger.info(f'Initialized session {self.index}')
예제 #7
0
 def __init__(self, spec, info_space=None):
     info_space = info_space or InfoSpace()
     init_thread_vars(spec, info_space, unit='session')
     self.spec = deepcopy(spec)
     self.info_space = info_space
     self.coor, self.index = self.info_space.get_coor_idx(self)
     self.random_seed = 100 * (info_space.get('trial') or 0) + self.index
     torch.cuda.manual_seed_all(self.random_seed)
     torch.manual_seed(self.random_seed)
     np.random.seed(self.random_seed)
     self.data = None
     self.aeb_space = AEBSpace(self.spec, self.info_space)
     self.env_space = EnvSpace(self.spec, self.aeb_space)
     self.agent_space = AgentSpace(self.spec, self.aeb_space)
     logger.info(util.self_desc(self))
     self.aeb_space.init_body_space()
     self.aeb_space.post_body_init()
     logger.info(f'Initialized session {self.index}')
예제 #8
0
    def __init__(self, spec, info_space, global_nets=None):
        self.spec = spec
        self.info_space = info_space
        self.index = self.info_space.get('session')
        util.set_session_logger(self.spec, self.info_space, logger)
        self.data = None

        self.aeb_space = AEBSpace(self.spec, self.info_space)
        self.env_space = EnvSpace(self.spec, self.aeb_space)
        self.aeb_space.init_body_space()
        util.set_rand_seed(self.info_space.get_random_seed(), self.env_space)
        util.try_set_cuda_id(self.spec, self.info_space)
        assert not ps.is_dict(
            global_nets
        ), f'multi agent global_nets must be a list of dicts, got {global_nets}'
        self.agent_space = AgentSpace(self.spec, self.aeb_space, global_nets)

        logger.info(util.self_desc(self))
        logger.info(f'Initialized session {self.index}')