children = POPULATION(c.popSize) entire_fill_temp = children.Fill_From(parents) fillTime = time.time() - starttime # pp.pformat(children.pop[0]) children.Evaluate(envs, pb=True, pp=False) evaluateTime = time.time() - fillTime parents = copy.deepcopy(children) copyTime = time.time() - evaluateTime if g % 2 == 0: print(g, end=" ") children.Print() else: print(g) recorder.record_times(g, evaluateTime, copyTime, fillTime, starttime, entire_fill_temp) recorder.add_metrics(parents.pop[0]) recorder.plotTimes() recorder.plot_evolution() best = POPULATION(1) best.pop[0] = parents.Copy_Best_From(parents) repeat = 'r' while repeat == 'r': best.Evaluate_Best(envs, pb=False, pp=True, retain_data=True) recorder.plot_touch_values(best.pop[0]) repeat = input("Press 'r' to repeat: ") saveOption = input("Save File? [y/n]") if (saveOption == 'y'): saveBot = True saveLabel = input("file name: ")
entire_fill_temp = children.Fill_From(parents) fillTime = time.time() - starttime # pp.pformat(children.pop[0]) children.Evaluate(envs, pb=True, pp=False) evaluateTime = time.time() - fillTime parents = copy.deepcopy(children) copyTime = time.time() - evaluateTime if g % 2 == 0: print(g, end=" ") children.Print() else: print(g) recorder.record_times(g, evaluateTime, copyTime, fillTime, starttime) if c.evolution_alg == 'apfo': recorder.add_metrics( parents.pop[recorder.evolution_data['pop_fitness'][g - 1] ['best_index']], g) elif c.evolution_alg == 'genetic': recorder.add_metrics(parents.pop[0], g) pop_size = len(parents.pop) # recorder.plotTimes() recorder.plot_evolution() best = POPULATION(1) best.pop[0] = parents.Copy_Best_From(parents) repeat = 'r' while repeat == 'r': best.Evaluate_Best(envs, pb=False, pp=True, retain_data=True) recorder.plot_touch_values(best.pop[0]) repeat = input("Press 'r' to repeat: ")