File tree Expand file tree Collapse file tree 2 files changed +2
-0
lines changed Expand file tree Collapse file tree 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):
114114 print (" Generation = {generation} " .format(generation = ga_instance.generations_completed))
115115 print (" Fitness = {fitness} " .format(fitness = ga_instance.best_solution()[1 ]))
116116 print (" Change = {change} " .format(change = ga_instance.best_solution()[1 ] - last_fitness))
117+ last_fitness = ga_instance.best_solution()[1 ]
117118
118119# Creating an instance of the GA class inside the ga module. Some parameters are initialized within the constructor.
119120ga_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):
4747 print ("Generation = {generation}" .format (generation = ga_instance .generations_completed ))
4848 print ("Fitness = {fitness}" .format (fitness = ga_instance .best_solution ()[1 ]))
4949 print ("Change = {change}" .format (change = ga_instance .best_solution ()[1 ] - last_fitness ))
50+ last_fitness = ga_instance .best_solution ()[1 ]
5051
5152# Creating an instance of the GA class inside the ga module. Some parameters are initialized within the constructor.
5253ga_instance = pygad .GA (num_generations = num_generations ,
You can’t perform that action at this time.
0 commit comments