Fixed bugs
This commit is contained in:
@ -38,7 +38,7 @@ class chromosome:
|
|||||||
def print_chromosome(self):
|
def print_chromosome(self):
|
||||||
for i in range(len(self.genes)):
|
for i in range(len(self.genes)):
|
||||||
# Print the gene one by one.
|
# Print the gene one by one.
|
||||||
if(i == len(self.genes)):
|
if(i == len(self.genes) - 1):
|
||||||
print(f"[{self.genes[i].get_value()}]", end = '')
|
print(f"[{self.genes[i].get_value()}]", end = '')
|
||||||
else:
|
else:
|
||||||
print(f"[{self.genes[i].get_value()}],", end = '')
|
print(f"[{self.genes[i].get_value()}],", end = '')
|
||||||
|
|||||||
@ -14,4 +14,4 @@ ga = EasyGA.GA(Population_size, Chromosome_length,user_gene_function)
|
|||||||
ga.initialize()
|
ga.initialize()
|
||||||
|
|
||||||
# Looking at the first chromosome in the population
|
# Looking at the first chromosome in the population
|
||||||
print(ga.population.chromosomes[0].print_chromosome())
|
ga.population.chromosomes[0].print_chromosome()
|
||||||
|
|||||||
Reference in New Issue
Block a user