Changed example
This commit is contained in:
@ -3,9 +3,12 @@ import random
|
|||||||
# Create the Genetic algorithm
|
# Create the Genetic algorithm
|
||||||
ga = EasyGA.GA()
|
ga = EasyGA.GA()
|
||||||
|
|
||||||
|
ga.chromosome_length = 3
|
||||||
|
|
||||||
def user_gene_domain(gene_index):
|
def user_gene_domain(gene_index):
|
||||||
"""Each gene index is assosiated to its index in the chromosome"""
|
"""Each gene index is assosiated to its index in the chromosome"""
|
||||||
chromosome = [
|
chromosome = [
|
||||||
|
# Gene instructions set here
|
||||||
random.randrange(1,100),
|
random.randrange(1,100),
|
||||||
random.uniform(10,5),
|
random.uniform(10,5),
|
||||||
random.choice(["up","down"])
|
random.choice(["up","down"])
|
||||||
|
|||||||
Reference in New Issue
Block a user