Aluriak / clyngor

Handy python wrapper around Potassco's Clingo ASP solver.
GNU General Public License v3.0
34 stars 7 forks source link

Optimize opt_models_from_clyngor_answers. #18

Closed ArnaudBelcour closed 5 years ago

ArnaudBelcour commented 5 years ago

Hello,

To avoid memory issue with the opt_models_from_clyngor_answers function, use yield to create a generator instead of storing the optimal models in a list. This can be done thanks to the option with_answer_number added in 0.3.21.

Warning: this modification changes the object returns by the function. Now, It is a generator instead of a tuple. Also it is no more possible to use the repeated_optimal argument to extract the first optimal answer twice.