Remove random gene function

This commit is contained in:
danielwilczak101
2020-09-25 16:52:09 -04:00
parent 044cc9d1f6
commit 9b77d3619b
2 changed files with 5 additions and 7 deletions

View File

@ -6,17 +6,19 @@ ga = EasyGA.GA()
def user_gene_domain(gene_index):
"""Each gene index is assosiated to its index in the chromosome"""
domain = [
random.randrange(1,100),
random.randrange(1,100,5),
random.uniform(10,5),
random.choice(["up","down"])
]
return domain[gene_index]
print(user_gene_domain(0))
# If the user wants to use a domain
ga.domain = user_gene_domain
# If the user wants to use a custom range
#ga.new_range = [random.randrange,1,100]
#ga.new_range = [random.randrange,1,100,None]
ga.initialize()
ga.population.print_all()
#ga.population.print_all()