def run7(p): ga_basic = GA.GA_Faster_Select(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 Improved Selection 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 run7(p): ga = GA.GA_Faster_Select(p) start = time.process_time() ga.run() end = time.process_time() run_time = end - start f = open('GA_bound2.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()