def __init__()

in LaNAS/Distributed_LaNAS/server/MCTS.py [0:0]


    def __init__(self, search_space, tree_height, arch_code_len ):
        assert type(search_space)    == type([])
        assert len(search_space)     >= 1
        assert type(search_space)    == type([])
        assert type(search_space[0]) == type([])
        #############################################
        self.ARCH_CODE_LEN = arch_code_len
        self.ROOT           = None
        self.Cp             = 0.2
        self.search_space   = None
        self.ARCH_CODE_LEN  = arch_code_len
        self.nodes          = []
        self.samples        = {}
        self.TASK_QUEUE     = []
        self.DISPATCHED_JOB = {}
        self.JOB_COUNTER    = 0
        self.TOTAL_SEND     = 0
        self.TOTAL_RECV     = 0
        self.ITERATION      = 0
        self.MAX_ACC        = 0
        #############################################

        
        
        # set random seed
        np.random.seed(seed=int(time.time() ) )
        random.seed(datetime.now() )
        
        self.search_space = search_space
        
        #initialize the a full tree
        total_nodes = 2**tree_height - 1
        for i in range(1, total_nodes + 1):
            is_good_kid = False
            if (i-1)  > 0 and (i-1) % 2 == 0:
                is_good_kid = False
            elif (i -1) > 0:
                is_good_kid = True
            
            parent_id = i // 2  - 1
            if parent_id == -1:
                self.nodes.append( Node( None, is_good_kid, self.ARCH_CODE_LEN, True ) )
            else:
                self.nodes.append( Node(self.nodes[parent_id], is_good_kid, self.ARCH_CODE_LEN, False) )
        
        # self.loads_all_states()
        self.ROOT = self.nodes[0]
        self.CURT = self.ROOT
        
        print('='*10 + 'search space start' + '='*10)
        print("total architectures:", len(search_space) )
        print('='*10 + 'search space end  ' + '='*10)
        self.init_train()