本文整理汇总了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()
示例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)
示例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)
示例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()