當前位置: 首頁>>代碼示例>>Python>>正文


Python Plotter.addPoint方法代碼示例

本文整理匯總了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()
開發者ID:cjdinsmore,項目名稱:pokemon_ga,代碼行數:32,代碼來源:Poke_GA.py


注:本文中的Plotter.Plotter.addPoint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。