diff --git a/src/database.db b/src/database.db new file mode 100644 index 0000000..1f12b84 Binary files /dev/null and b/src/database.db differ diff --git a/src/database/matplotlib_graph.py b/src/database/matplotlib_graph.py index ed044f9..265d32a 100644 --- a/src/database/matplotlib_graph.py +++ b/src/database/matplotlib_graph.py @@ -30,16 +30,17 @@ class Matplotlib_Graph: X = list(range(0, generations)) # Query for Y data - Y_list = self.database.get_generation_total_fitness() + Y_data = self.database.get_generation_total_fitness() if(self.yscale == "log"): # If using log then the values have to be positive numbers - Y = [abs(ele) for ele in Y_list] + Y = [abs(ele) for ele in Y_data] + Y_data = Y # Setup data plt.figure(figsize = self.size) plt.yscale(self.yscale) - self.type_of_plot(X,Y_list) + self.type_of_plot(X,Y_data) # x and y labels if(self.xlabel == None): @@ -63,16 +64,17 @@ class Matplotlib_Graph: X = list(range(0, generations)) # Query for Y data - Y_list = self.database.get_highest_chromosome() + Y_data = self.database.get_highest_chromosome() if(self.yscale == "log"): # If using log then the values have to be positive numbers - Y = [abs(ele) for ele in Y_list] + Y = [abs(ele) for ele in Y_data] + Y_data = Y # Setup data plt.figure(figsize = self.size) plt.yscale(self.yscale) - self.type_of_plot(X,Y_list) + self.type_of_plot(X,Y_data) # x and y labels if(self.xlabel == None): @@ -94,19 +96,22 @@ class Matplotlib_Graph: # Create the generations list - [0,1,2,etc] X = list(range(0, generations)) + print(X) + # Query for Y data - Y_list = self.database.get_lowest_chromosome() + Y_data = self.database.get_lowest_chromosome() if(self.yscale == "log"): # If using log then the values have to be positive numbers - Y = [abs(ele) for ele in Y_list] + Y = [abs(ele) for ele in Y_data] + Y_data = Y # Setup data plt.figure(figsize = self.size) plt.yscale(self.yscale) - self.type_of_plot(X,Y_list) + self.type_of_plot(X,Y_data) - # x and y labels + # Default x and y labels if(self.xlabel == None): plt.xlabel('Generation') if(self.ylabel == None): diff --git a/src/run_testing.py b/src/run_testing.py index 4443b05..9cec020 100644 --- a/src/run_testing.py +++ b/src/run_testing.py @@ -18,6 +18,9 @@ ga.target_fitness_type = 'min' ga.evolve() +ga.print_generation() ga.print_population() +ga.graph.type_of_plot = "line" +ga.graph.yscale = "log" ga.graph.lowest_value_chromosome()