File tree 1 file changed +4
-3
lines changed 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
- import ga
1
+ import pygad
2
2
import numpy
3
3
4
4
num_generations = 50 # Number of generations.
@@ -37,7 +37,7 @@ def fitness_func(solution):
37
37
return fitness
38
38
39
39
# 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 ,
41
41
sol_per_pop = sol_per_pop ,
42
42
num_parents_mating = num_parents_mating ,
43
43
num_genes = num_genes ,
@@ -66,6 +66,7 @@ def fitness_func(solution):
66
66
ga_instance .save (filename = filename )
67
67
68
68
# 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." )
70
71
loaded_ga_instance .plot_result ()
71
72
print (loaded_ga_instance .best_solution ())
You can’t perform that action at this time.
0 commit comments