def generate_parameters(self, parameter_id):
        """Returns a set of trial graph config, as a serializable object.
        parameter_id : int
        """
        if len(self.population) <= 0:
            logger.debug("the len of poplution lower than zero.")
            raise Exception('The population is empty')
        pos = -1
        for i in range(len(self.population)):
            if self.population[i].result == None:
                pos = i
                break
        if pos != -1:
            indiv = copy.deepcopy(self.population[pos])
            self.population.pop(pos)
            temp = json.loads(graph_dumps(indiv.config))
        else:
            random.shuffle(self.population)
            if self.population[0].result < self.population[1].result:
                self.population[0] = self.population[1]
            indiv = copy.deepcopy(self.population[0])
            self.population.pop(1)
            indiv.mutation()
            graph = indiv.config
            temp =  json.loads(graph_dumps(graph))
        logger.debug('generate_parameter return value is:')
        logger.debug(temp)
        return temp
def generate_parameters ( self , parameter_id ) : if len ( self . population ) <= 0 : logger . debug ( "the len of poplution lower than zero." ) raise Exception ( 'The population is empty' ) pos = - 1 for i in range ( len ( self . population ) ) : if self . population [ i ] . result == None : pos = i break if pos != - 1 : indiv = copy . deepcopy ( self . population [ pos ] ) self . population . pop ( pos ) temp = json . loads ( graph_dumps ( indiv . config ) ) else : random . shuffle ( self . population ) if self . population [ 0 ] . result < self . population [ 1 ] . result : self . population [ 0 ] = self . population [ 1 ] indiv = copy . deepcopy ( self . population [ 0 ] ) self . population . pop ( 1 ) indiv . mutation ( ) graph = indiv . config temp = json . loads ( graph_dumps ( graph ) ) logger . debug ( 'generate_parameter return value is:' ) logger . debug ( temp ) return temp
Returns a set of trial graph config, as a serializable object.
        parameter_id : int