当前位置: 首页>>代码示例>>Python>>正文


Python GPopulation.clearFlags方法代码示例

本文整理汇总了Python中GPopulation.GPopulation.clearFlags方法的典型用法代码示例。如果您正苦于以下问题:Python GPopulation.clearFlags方法的具体用法?Python GPopulation.clearFlags怎么用?Python GPopulation.clearFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GPopulation.GPopulation的用法示例。


在下文中一共展示了GPopulation.clearFlags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: your_func

# 需要导入模块: from GPopulation import GPopulation [as 别名]
# 或者: from GPopulation.GPopulation import clearFlags [as 别名]

#.........这里部分代码省略.........
               self.internalPop.proc_pool.join()
            else:
               logging.debug("CTRL-C detected, finishing evolution.")
            if freq_stats: print "\n\tA break was detected, you have interrupted the evolution !\n"

         if freq_stats != 0:
            self.printStats()
            self.printTimeElapsed()

         if self.dbAdapter:
            logging.debug("Closing the DB Adapter")
            if not (self.currentGeneration % self.dbAdapter.getStatsGenFreq() == 0):
               self.dumpStatsDB()
            self.dbAdapter.commitAndClose()

         if self.migrationAdapter:
            logging.debug("Closing the Migration Adapter")
            if freq_stats: print "Stopping the migration adapter... ",
            self.migrationAdapter.stop()
            if freq_stats: print "done !"

         if s == signal.SIGINT:
            print self.bestIndividual()
            exit(0)
         else:
            return self.bestIndividual()

      signal.signal(signal.SIGINT, stop_evolution)

      while True:
         if self.migrationAdapter:
            logging.debug("Migration adapter: exchange")
            self.migrationAdapter.exchange()
            self.internalPop.clearFlags()
            self.internalPop.sort()

         if not self.stepCallback.isEmpty():
            for it in self.stepCallback.applyFunctions(self):
               stopFlagCallback = it

         if not self.terminationCriteria.isEmpty():
            for it in self.terminationCriteria.applyFunctions(self):
               stopFlagTerminationCriteria = it

         if freq_stats:
            if (self.currentGeneration % freq_stats == 0) or (self.getCurrentGeneration() == 0):
               self.printStats()
               #print self.bestIndividual()

         if self.dbAdapter:
            if self.currentGeneration % self.dbAdapter.getStatsGenFreq() == 0:
               self.dumpStatsDB()

         if stopFlagTerminationCriteria:
            logging.debug("Evolution stopped by the Termination Criteria !")
            if freq_stats:
               print "\n\tEvolution stopped by Termination Criteria function !\n"
            break

         if stopFlagCallback:
            logging.debug("Evolution stopped by Step Callback function !")
            if freq_stats:
               print "\n\tEvolution stopped by Step Callback function !\n"
            break

         if self.interactiveMode:
开发者ID:aguirrea,项目名称:pyevolve,代码行数:70,代码来源:GSimpleGA.py


注:本文中的GPopulation.GPopulation.clearFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。