Count the number of combinations the algorithm tries #131
-
Is there a way to count the number of combinations that the algorithm is trying when finding the optimal solution? |
Beta Was this translation helpful? Give feedback.
Answered by
ahmedfgad
Feb 21, 2023
Replies: 1 comment
-
@ayushi-ddt, you can set ga_instance = pygad.GA(..., save_solutions=True)
print(ga_instance.solutions.shape()) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ahmedfgad
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ayushi-ddt, you can set
save_solutions=True
in the constructor of thepygad.GA
class. This saves every individual solution the algorithm explored into the instance attributesolutions
. After the algorithm finishes, you can count the number of solutions there: