Aluriak / clyngor

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

Support for optimize #1

Closed domoritz closed 6 years ago

domoritz commented 6 years ago

If I have soft constraints, this library gives me multiple results and also does not return the penalty for the different optimizations.

I saw yield_stats but it's not passed through from clyngor.solve.

Aluriak commented 6 years ago

I just updated clyngor to 0.1.0, that now handle access to stats and optimizations.

solver = clyngor.solve(...)
solver.stats  # it's a dict

for answer, opt in solver.with_optimization:
    # opt is the optimization score

Note that the stats are copy pasted raw into a dict, without any consideration for the eventual doublons or hierarchy.

Aluriak commented 6 years ago

In case you update : the optimization score is now a list of integers, enable support of multiple optimization scores.