From 135d1c48b8651d0320452e3bbabe93bf0491d6fe Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 17 Jun 2021 22:45:42 +0200 Subject: [PATCH] Add fitness column to individual --- src/genetic_algorithm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/genetic_algorithm.py b/src/genetic_algorithm.py index c163779..5221cf0 100644 --- a/src/genetic_algorithm.py +++ b/src/genetic_algorithm.py @@ -82,12 +82,13 @@ def get_matching_genes(parents): def populate_offspring(values): - offspring = DataFrame(columns=["point", "distance"]) + offspring = DataFrame(columns=["point", "distance", "fitness"]) for element in values: - aux = DataFrame(columns=["point", "distance"]) + aux = DataFrame(columns=["point", "distance", "fitness"]) aux["point"] = element offspring = offspring.append(aux) offspring["distance"] = 0 + offspring["fitness"] = 0 offspring = offspring[1:] return offspring