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


Python System.latestVersion方法代码示例

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


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

示例1: run_simulation

# 需要导入模块: from system import System [as 别名]
# 或者: from system.System import latestVersion [as 别名]
def run_simulation(repo_path, gen_max):
    logger.info("Running simulation with: REPO_PATH={}, GENERATION_MAX={}"
                .format(repo_path, gen_max))
    
    # Init base system
    sys=System(repo_path=repo_path)
    sys.setLowestVersions()
    sys.dump()
    
    # Init goal (latest version)
    goal=System.latestVersion(sys)
    goal.dump()
    
    # Init population
    pop=Population(DEFAULT_POP_SIZE, sys, goal)
    
    # Init dataframe for storing results
    ## TODO

    logger.info("Starting simulation...")
    
    for i in range(gen_max):
        '''
        For each generation we need to go through all the genomes
        and evolve them (mutate/crossover/rebel) and test. The more
        successful a genome is (more programs installed/tests), the
        more likely it is to create offspring for the next generation
        '''
        
        logger.info("Generation #{}".format(i))
        
        for genome in pop.getGenomes():
            # TODO some evaluation, score, record
            logger.info("\t{}".format(genome))
        
        #Check if objective has been met yet
        if pop.isGoalMet():
            # TODO
            logger.info("Goal configuration has been found!")
            break
        
        pop=pop.nextGeneration()
        
        logger.debug("System state at end of this generation")
        pop.sys.dump()
    
    #TODO do some final reporting
    logger.info("Final configuration after {} generations looks like:".format(i))
    pop.sys.dump()
开发者ID:CodethinkLabs,项目名称:scalam,代码行数:51,代码来源:scalam.py


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