Exemplo n.º 1
0
    def __init__(self,count,popParam,callback=None):
        '''
        进化任务,一个进化任务是将多次执行进化,每次进化为一个session
        :param count:     int 运行次数
        :param popParam:  dict 种群参数
        :param callback:  function(event,monitor) 回调函数
                            monitor Monitor对象
                            event   str 包括
                                    'task.begin'
                                    'epoch.begin'
                                    'session.begin'
                                    'session.end'
                                    'epoch.end'
                                    'task.end'
        '''
        self.count = count
        if isinstance(popParam,dict):
            popParam = Properties(popParam)
        if isinstance(popParam.genomeDefinition,dict):
            popParam.genomeDefinition = Properties(popParam.genomeDefinition)
        self.popParam = popParam

        self.runParam = None
        self.sessions = []
        self.curSession = None

        self.monitor = None
        self.callback = callback

        self.__verifyParam()
Exemplo n.º 2
0
    def __init__(self,count,popParam,callback):
        '''
        进化任务,一个进化任务是将多次执行进化,每次进化为一个session
        :param count:     int 运行次数
        :param popParam:  dict 种群参数
        '''
        self.count = count
        popParam = Properties(popParam)
        popParam.genomeDefinition = Properties(popParam.genomeDefinition)
        self.popParam = popParam

        self.runParam = None
        self.sessions = []
        self.curSession = None

        self.monitor = None
        self.callback = callback

        self.__verifyParam()