def run6(p): ga_basic = GA.GA_Faster_DP(p) start = time.process_time() ga_basic.run() end = time.process_time() run_time = end - start b_ratio = ga_basic.memo_FV[tuple(ga_basic.opt_chromo)].b_ratio f = open('GA with bounded DP results.txt', 'a') f.write( str(p.n) + "\t" + str(p.b) + "\t" + str(p.rho) + "\t" + str(run_time) + "\t" + str(b_ratio) + "\n") f.close()
def run6(p): ga = GA.GA_Faster_DP(p) start = time.process_time() ga.run() end = time.process_time() run_time = end - start f = open('GA_My_DP_Bound1_0717.txt', 'a') f.write( str(p.n) + "\t" + str(p.b) + "\t" + str(p.rho) + "\t" + str(run_time) + "\t" + str(ga.memo_opt[ga.max_iter]) + "\t" + str(ga.memo_opt[ga.max_iter - 5]) + "\t" + str(ga.memo_opt[ga.max_iter - 10]) + "\n") f.close()