diff --git a/algorithms/genetic_algorithm.py b/algorithms/genetic_algorithm.py index 17ba233592aa37c8e498ea9e64766aec5a58f709..ef0266af9e0e192cbdc483a537e42aed2d03b112 100644 --- a/algorithms/genetic_algorithm.py +++ b/algorithms/genetic_algorithm.py @@ -32,6 +32,9 @@ class Chromosome: def __hash__(self): return hash(tuple(self.gene)) + def __str__(self): + return "{} [{:.2f}]".format(tuple(self.gene), self.get_score()) + def get_score(self): """Evaluates a score based on chromosome's pattern""" return -20 * log10(abs(self.pattern))