Skip to content

Count the number of combinations the algorithm tries #131

Closed Answered by ahmedfgad
ayushi-ddt asked this question in Q&A
Discussion options

You must be logged in to vote

@ayushi-ddt, you can set save_solutions=True in the constructor of the pygad.GA class. This saves every individual solution the algorithm explored into the instance attribute solutions. After the algorithm finishes, you can count the number of solutions there:

ga_instance = pygad.GA(..., save_solutions=True)
print(ga_instance.solutions.shape())

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ahmedfgad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants