Commit d4c582df authored by harry1080ti's avatar harry1080ti
Browse files

lacking full evo

parent ad94e11e
......@@ -213,6 +213,7 @@ class cma_approach(object):
best_overall = self.penalty_offest
self.i = 0
temp_out = []
while not self.es.stop() and self.i < self.max_iter:
samples = self.es.ask()
id_list = [(idx, sample) for idx, sample in enumerate(samples)]
......@@ -258,7 +259,7 @@ class cma_approach(object):
self.end = time.time()
self.best_layer = [self.decode(val, len(self.layers)) for val in self.es.result[0]]
self.best_layer.append(len(self.layers) - sum(self.best_layer))
self.report()
temp_out.append(self.report()[1])
self.i += 1
self.ending_iter = self.i
......
......@@ -60,12 +60,13 @@ def trial(prop):
print_to_csv = False
)
instance.run()
process_out = instance.run()
success, out = instance.report()
while not success and trials < MAX_TRIAL:
instance.run()
process_out = instance.run()
success, out = instance.report()
trials += 1
process_out.append(out)
return out
topology = sys.argv[1]
......@@ -93,8 +94,9 @@ if __name__ == "__main__":
pool = Pool(processes = cpu_count() - 2)
for result in pool.imap_unordered(trial, approaches):
with open(pc.RESULT_CSV_PATH+'cma_logmore_sq.csv', 'a') as csvFile:
writer = csv.writer(csvFile, delimiter=',', lineterminator="\n")
writer.writerow(result)
with open(pc.RESULT_CSV_PATH+'cma_logmore_sq_full_evo.csv', 'a') as csvFile:
for evo in result:
writer = csv.writer(csvFile, delimiter=',', lineterminator="\n")
writer.writerow(evo)
pool.close()
pool.join()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment