Fixed fitness logging

This commit is contained in:
Marcin Kostrzewski 2020-05-17 00:46:33 +02:00
parent eed7d2ea82
commit d1b6027ffa

View File

@ -65,7 +65,7 @@ def geneticAlgorithm(map, iter, solutions, mutationAmount=0.05, multithread=Fals
# Add info to logfile
with open("results.txt", "a") as f:
f.write("Population: {}\n".format(i))
f.write("Best fitness: {}\n".format(fitness[0]))
f.write("Best fitness: {}\n".format(max(fitness)))
f.write("Best offspring: " + str(offspring[0]))
f.write("\n\n")