File tree 2 files changed +2
-0
lines changed
2 files changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ def callback_generation(ga_instance):
114
114
print (" Generation = {generation} " .format(generation = ga_instance.generations_completed))
115
115
print (" Fitness = {fitness} " .format(fitness = ga_instance.best_solution()[1 ]))
116
116
print (" Change = {change} " .format(change = ga_instance.best_solution()[1 ] - last_fitness))
117
+ last_fitness = ga_instance.best_solution()[1 ]
117
118
118
119
# Creating an instance of the GA class inside the ga module. Some parameters are initialized within the constructor.
119
120
ga_instance = pygad.GA(num_generations = num_generations,
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ def callback_generation(ga_instance):
47
47
print ("Generation = {generation}" .format (generation = ga_instance .generations_completed ))
48
48
print ("Fitness = {fitness}" .format (fitness = ga_instance .best_solution ()[1 ]))
49
49
print ("Change = {change}" .format (change = ga_instance .best_solution ()[1 ] - last_fitness ))
50
+ last_fitness = ga_instance .best_solution ()[1 ]
50
51
51
52
# Creating an instance of the GA class inside the ga module. Some parameters are initialized within the constructor.
52
53
ga_instance = pygad .GA (num_generations = num_generations ,
You can’t perform that action at this time.
0 commit comments