Fixed Raw logging

This commit is contained in:
Marcin Kostrzewski 2020-05-17 10:34:36 +02:00
parent 3108343513
commit 1aacc693b9

View File

@ -219,6 +219,9 @@ def writeResults(iter, bestFit, bestMember):
f.write("GA Results from " + str(datetime.now())) f.write("GA Results from " + str(datetime.now()))
f.write("\n") f.write("\n")
with open("resultsRaw.txt", "w+") as f:
f.write("=HEADER=GA=\n")
with open("results.txt", "a") as f: with open("results.txt", "a") as f:
f.write("Population: {}\n".format(iter)) f.write("Population: {}\n".format(iter))
f.write("Best fitness: {}\n".format(bestFit)) f.write("Best fitness: {}\n".format(bestFit))
@ -226,5 +229,6 @@ def writeResults(iter, bestFit, bestMember):
f.write("\n\n") f.write("\n\n")
# Write raw arrays # Write raw arrays
with open("resultsRaw.txt", "w+") as f: with open("resultsRaw.txt", "a") as f:
f.write(str(bestMember + [bestFit])) f.write(str(bestMember + [bestFit]))
f.write("\n")