Added to database file
This commit is contained in:
22
src/run.py
22
src/run.py
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user