Updated structure and fixed bugs.
This commit is contained in:
@ -40,7 +40,7 @@ class chromosome:
|
||||
self.genes.append(gene)
|
||||
|
||||
def get_fitness(self):
|
||||
return self.score
|
||||
return self.fitness
|
||||
|
||||
def get_chromosome(self):
|
||||
return self.genes
|
||||
|
||||
@ -25,8 +25,10 @@ ga.population.chromosomes[0].print_chromosome()
|
||||
ga.population.chromosomes[0].genes[0].print_value()
|
||||
|
||||
# Looking to get the data of a chromosome
|
||||
my_chromosome = ga.population.chromosomes[0].get_chromosome()
|
||||
print(f"my_chromosome: {my_chromosome}")
|
||||
my_chromosome = ga.population.chromosomes[0]
|
||||
print(f"my_chromosome: {my_chromosome.get_chromosome()}")
|
||||
print(f"my_chromosome fitness: {my_chromosome.get_fitness()}")
|
||||
# Looking to get the data of one gene in the chromosome
|
||||
my_gene = ga.population.chromosomes[0].genes[0].get_value()
|
||||
print(f"my_gene: {my_gene}")
|
||||
my_gene = ga.population.chromosomes[0].genes[0]
|
||||
print(f"my_gene: {my_gene.get_value()}")
|
||||
print(f"my_gene fitness: {my_gene.get_fitness()}")
|
||||
|
||||
Reference in New Issue
Block a user