Added to database file

This commit is contained in:
danielwilczak101
2020-11-21 20:40:10 -05:00
parent 1a8219d720
commit 2f1e21f828
3 changed files with 67 additions and 30 deletions

View File

@ -4,21 +4,11 @@ import matplotlib.pyplot as plt
# Create the genetic algorithm
ga = EasyGA.GA()
# Create 25 chromosomes each with 10 genes and 200 generations
ga.population_size = 200
ga.chromosome_length = 10
ga.generation_goal = 150
# Evolve the genetic algorithm
ga.evolve()
# Print generation and population
ga.print_generation()
ga.print_population()
# Plot the data from the genetic algorithm
plt.figure(figsize = [6, 6])
ga.graph.highest_value_chromosome() # Change this so it doesn't make its own figure or show
plt.xlabel('My datas generations') # override the xlabel
plt.ylabel('How well the fitness is') # override the ylabel
plt.title('My GA fitness x generations') # override the title
plt.show()
ga.database.past_runs()
ga.graph.highest_value_chromosome(1) # Change this so it doesn't make its own figure or show
ga.graph.show()