From e8e36a4420d1a908abc1fc7454439ad9d56d16b6 Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Sat, 16 May 2020 14:13:46 +0200 Subject: [PATCH] Added more info printing --- src/AI/GA.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/AI/GA.py b/src/AI/GA.py index 0130161..941449b 100644 --- a/src/AI/GA.py +++ b/src/AI/GA.py @@ -21,11 +21,13 @@ def geneticAlgorithm(map, iter, solutions, mutationAmount=0.2): initialPopulation = numpy.random.uniform(low=0.0, high=1.0, size=(solutions, weightsCount)) population = initialPopulation for i in range(iter): + print("Running {} generation...".format(i)) fitness = [] for player in population: fitness.append(doSimulation(player, map)) parents = selectMatingPool(population, fitness, int(solutions / 2)) + print("Best fitness: {}".format(max(fitness))) offspring = mating(parents, solutions, mutationAmount) # TODO: Parents selection, mating, offspring @@ -46,7 +48,6 @@ def selectMatingPool(population, fitness, count): bestIdxs.append(bestIdx) for id in bestIdxs: result.append(population[id]) - print(result) return result