Changed run testing and removed database.db file
This commit is contained in:
BIN
src/database.db
BIN
src/database.db
Binary file not shown.
@ -4,11 +4,18 @@ import random
|
|||||||
# Create the Genetic algorithm
|
# Create the Genetic algorithm
|
||||||
ga = EasyGA.GA()
|
ga = EasyGA.GA()
|
||||||
|
|
||||||
|
# Create 25 chromosomes each with 10 genes and 200 generations
|
||||||
|
ga.population_size = 25
|
||||||
|
ga.chromosome_length = 10
|
||||||
ga.generation_goal = 200
|
ga.generation_goal = 200
|
||||||
ga.population_size = 50
|
|
||||||
|
# Create random genes from 0 to 10
|
||||||
|
ga.gene_impl = lambda: random.randint(0, 10)
|
||||||
|
|
||||||
|
# Minimize the sum of the genes
|
||||||
|
ga.fitness_function_impl = lambda chromosome: sum(gene.get_value() for gene in chromosome.get_gene_list())
|
||||||
|
ga.target_fitness_type = 'min'
|
||||||
|
|
||||||
ga.evolve()
|
ga.evolve()
|
||||||
|
|
||||||
ga.print_population()
|
|
||||||
|
|
||||||
ga.graph_scatter()
|
ga.graph_scatter()
|
||||||
|
|||||||
Reference in New Issue
Block a user