Fixed import problems

This commit is contained in:
danielwilczak101
2020-09-29 21:23:18 -04:00
parent 5883208c68
commit d531888d78
4 changed files with 16 additions and 23 deletions

View File

@ -5,19 +5,12 @@ ga = EasyGA.GA()
ga.chromosome_length = 3
def user_gene_domain(gene_index):
"""Each gene index is assosiated to its index in the chromosome"""
chromosome = [
# Gene instructions set here
random.randrange(1,100),
random.uniform(10,5),
random.choice(["up","down"])
]
return chromosome[gene_index]
# If the user wants to use a domain
ga.chromosome_impl = user_gene_domain
ga.gene_impl = [random.randrange,1,10]
# Run Everyhting
ga.evolve()
# Print the current population
ga.population.print_all()