Updated genes,chromosme,population prints

This commit is contained in:
Daniel Wilczak
2020-09-24 15:02:58 -04:00
parent 9c5092525a
commit c4ead43d6d
4 changed files with 17 additions and 7 deletions

View File

@ -32,7 +32,15 @@ class population:
self.fitness = fitness
def __repr__(self):
return f"population({self.chromosomes.__repr__()})"
pass
def print_all(self):
# Ex .Current population
# Chromosome 1 - [gene][gene][gene][.etc] / Chromosome fitness - #
print("Current population:")
for index in range(len(self.chromosomes)):
print(f'Chromosome - {index} {self.chromosomes[index]}', end = "")
print(f' / Fitness = {self.chromosomes[index].fitness}')
def generate_first_chromosomes(self, chromosome_count, chromosome_length, gene_lower_bound, gene_upper_bound):
#Creating the chromosomes with Genes of random size