From d1b6027ffaf4116577f7d6960790ff9244497750 Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Sun, 17 May 2020 00:46:33 +0200 Subject: [PATCH] Fixed fitness logging --- src/AI/GA.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AI/GA.py b/src/AI/GA.py index ce1c6e2..ee9b42f 100644 --- a/src/AI/GA.py +++ b/src/AI/GA.py @@ -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")