hoffile = open(dirname + "/hof.pickle") (gen_hof, class_hof) = cPickle.load(hoffile) hoffile.close() else: gen_hof = [hgcpp.Generator()] class_hof = [hgcpp.Classifier()] print 0 t0 = time.time() for i in xrange(runtimes): (class_pop, c) = hgcpp.evo_step(class_pop, gen_hof) t1 = time.time() print "Classifier HOF member found after " + str(t1 - t0) + " seconds" t0 = t1 class_hof = [c] + class_hof (gen_pop, g) = hgcpp.evo_step(gen_pop, class_hof) t1 = time.time() print "Generator HOF member found after " + str(t1 - t0) + " seconds" t0 = t1 gen_hof = [g] + gen_hof test.teststep(g, c, ref_data) print i + 1 final_file = open(dirname + "/breed.pickle", "w") cPickle.dump((gen_pop, class_pop), final_file, protocol=cPickle.HIGHEST_PROTOCOL) final_file.close() final_file = open(dirname + "/hof.pickle", "w") cPickle.dump((gen_hof, class_hof), final_file, protocol=cPickle.HIGHEST_PROTOCOL) final_file.close() cf.write()
#!/usr/bin/env python from cli import command_line as cli from test import TestStep as teststep import time __author__ = 'tianheng' cli_output = cli() test_run = teststep() if cli_output is 1: test_run.step_one() elif cli_output is 2: test_run.step_two() elif cli_output is 3: test_run.step_three() elif cli_output is 4: test_run.step_four() elif cli_output is 5: test_run.step_five() elif cli_output is 6: test_run.step_six() elif cli_output is 7: test_run.step_seven() elif cli_output is 8: pass_flag_list = [] pass_flag_list.append(test_run.step_one()) pass_flag_list.append(test_run.step_two()) pass_flag_list.append(test_run.step_three()) pass_flag_list.append(test_run.step_four()) pass_flag_list.append(test_run.step_five()) pass_flag_list.append(test_run.step_six()) pass_flag_list.append(test_run.step_seven())