Testing
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
from initialization.random_initialization import random_initialization
|
from initialization.random_initialization import random_initialization
|
||||||
|
|
||||||
def check_gene(value):
|
def check_gene(value):
|
||||||
|
#Check to make sure the gene is not empty
|
||||||
assert value != "" , "Gene can not be empty"
|
assert value != "" , "Gene can not be empty"
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -36,11 +37,15 @@ 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.
|
||||||
|
if(i == range(len(self.genes))):
|
||||||
|
print(f"[{self.genes[i].get_value()}]", end = '')
|
||||||
|
else:
|
||||||
print(f"[{self.genes[i].get_value()}],", end = '')
|
print(f"[{self.genes[i].get_value()}],", end = '')
|
||||||
|
|
||||||
|
|
||||||
class population:
|
class population:
|
||||||
# chromosomes = [chromosome,chromosome,etc]
|
# population = [chromosome,chromosome,etc]
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.chromosomes = []
|
self.chromosomes = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user