File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1- import ga
1+ import pygad
22import numpy
33
44num_generations = 50 # Number of generations.
@@ -37,7 +37,7 @@ def fitness_func(solution):
3737 return fitness
3838
3939# Creating an instance of the GA class inside the ga module. Some parameters are initialized within the constructor.
40- ga_instance = ga .GA (num_generations = num_generations ,
40+ ga_instance = pygad .GA (num_generations = num_generations ,
4141 sol_per_pop = sol_per_pop ,
4242 num_parents_mating = num_parents_mating ,
4343 num_genes = num_genes ,
@@ -66,6 +66,7 @@ def fitness_func(solution):
6666ga_instance .save (filename = filename )
6767
6868# Loading the saved GA instance.
69- loaded_ga_instance = ga .load (filename = filename )
69+ loaded_ga_instance = pygad .load (filename = filename )
70+ print ("The saved instance of the genetic algorithm is loaded successfully." )
7071loaded_ga_instance .plot_result ()
7172print (loaded_ga_instance .best_solution ())
You can’t perform that action at this time.
0 commit comments