本文整理汇总了Python中Plotter.Plotter.addPoint方法的典型用法代码示例。如果您正苦于以下问题:Python Plotter.addPoint方法的具体用法?Python Plotter.addPoint怎么用?Python Plotter.addPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plotter.Plotter
的用法示例。
在下文中一共展示了Plotter.addPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from Plotter import Plotter [as 别名]
# 或者: from Plotter.Plotter import addPoint [as 别名]
experiment_start = time.time()
results_file.write("\n\nExperiment Number %d\n%s\n" % (experiment_num, '-'*20))
fittest_team = None
for i in range(1, 31):
print("Iteration: %d" % (i))
results_file.write("Iteration: %d\n" % (i))
if fittest_team is not None:
this_fittest = pg.runAlgorithm(copy.deepcopy(fittest_team))
else:
this_fittest = pg.runAlgorithm()
if pg.draw_graph:
plotter.addPoint(i, this_fittest.fitness)
if fittest_team is None or this_fittest.fitness > fittest_team.fitness:
fittest_team = copy.deepcopy(this_fittest)
print("New fittest: %f\n\tRecord: %s\n" % (fittest_team.fitness, str(fittest_team.record)))
results_file.write("New fittest: %f\n\tRecord: %s\n" % (fittest_team.fitness, str(fittest_team.record)))
fittest_string = fittest_team.printTeam()
results_file.write(fittest_string)
fittest_team.resetPokemon()
results_file.write("Experiment %d duration: %f\n" % (experiment_num, time.time() - experiment_start))
print("Experiment %d duration: %f" % (experiment_num, time.time() - experiment_start))
if pg.draw_graph:
plotter.showPlot(title=experiment_dir + "/Experiment-" + str(experiment_num), save_to_file=True)
plotter.clearPoints()