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


Python Population.routineForPopulation方法代码示例

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


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

示例1: routineTo

# 需要导入模块: from Population import Population [as 别名]
# 或者: from Population.Population import routineForPopulation [as 别名]
def routineTo(sf, cf):
    gen = Genetic(sf, cf)
    fen = fenetre()
    food = Food(fen)
    #newFen = newFenTop()
    #texts = addScoreOnTopWindows(newFen, int(Params.p['sizePop']))
    pop = Population(fen, food)
    pop.setInitialPositions()
    for i in range(int(Params.p['nbEvol'])):
        popName = "pop_" + str(i)
        if i > 0:
            gen.createNewPopulation(pop)
            food = Food(fen)
            pop.setFood(food)
            pop.setInitialPositions()
        #newFen[1].itemconfig(newFen[2], text=popName)
        t = time.time()
        #while time.time() - t < Params.p['lifeTime']:
        j = 0
        while j < Params.p['lifeTime']:
            #refreshScores(newFen, texts, pop)
            pop.routineForPopulation()
            fen.refreshScreen()
            j += 1
        timeGen = time.time() - t
        print("Execution time: ", timeGen)
        savePop(pop, popName = popName)
    fen.fen.destroy()
开发者ID:thbeucher,项目名称:ANNGA,代码行数:30,代码来源:main.py

示例2: routine2

# 需要导入模块: from Population import Population [as 别名]
# 或者: from Population.Population import routineForPopulation [as 别名]
def routine2():
    for i in range(int(Params.p['nbEvol'])):
        popName = "pop_" + str(i)
        fen = fenetre()
        food = Food(fen)
        pop = Population(fen, food)
        t = time.time()
        while time.time() - t < Params.p['lifeTime']:
            pop.routineForPopulation()
            fen.refreshScreen()
        fen.fen.destroy()
        savePop(pop, popName = popName)
开发者ID:thbeucher,项目名称:ANNGA,代码行数:14,代码来源:main.py

示例3: routine

# 需要导入模块: from Population import Population [as 别名]
# 或者: from Population.Population import routineForPopulation [as 别名]
def routine():
    #create the windows
    fen = fenetre()
    #create the food
    food = Food(fen)
    #create the population
    pop = Population(fen, food)

    t = time.time()
    while time.time() - t < Params.p['lifeTime']:
        #time.sleep(0.01)
        pop.routineForPopulation()
        fen.refreshScreen()
    fen.fen.destroy()
    savePop(pop)
开发者ID:thbeucher,项目名称:ANNGA,代码行数:17,代码来源:main.py

示例4: routine3

# 需要导入模块: from Population import Population [as 别名]
# 或者: from Population.Population import routineForPopulation [as 别名]
def routine3():
    gen = Genetic()
    fen = fenetre()
    food = Food(fen)
    newFen = newFenTop()
    texts = addScoreOnTopWindows(newFen, int(Params.p['sizePop']))
    for i in range(int(Params.p['nbEvol'])):
        popName = "pop_" + str(i)
        if i == 0:
            pop = Population(fen, food)
        else:
            gen.createNewPopulation(pop)
            food = Food(fen)
            pop.setFood(food)
            pop.setInitialPositions()
        newFen[1].itemconfig(newFen[2], text=popName)
        t = time.time()
        while time.time() - t < Params.p['lifeTime']:
            refreshScores(newFen, texts, pop)
            pop.routineForPopulation()
            fen.refreshScreen()
        savePop(pop, popName = popName)
    fen.fen.destroy()
开发者ID:thbeucher,项目名称:ANNGA,代码行数:25,代码来源:main.py


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