-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get info on number of models generated? #22
Comments
Hi ! Sorry for the late reply. Thank you :) I made a little example, that uses this line to access the
You may want something like that for later use:
|
That is perfect. Thanks very much! |
Odd thing I've noticed (noting it here in case it's useful): The above example will only work if clingo's python package is not installed. If it is installed I get: >>> import clyngor
>>> models = clyngor.solve(inline='1{n(1..1000)}1.', nb_model=500, stats=True)
>>> nb_model_found = 0
>>> for nb_model_found, model in enumerate(models, start=1):
... pass
...
>>> models.statistics['Models']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'Models' Uninstall clingo's python package, start a new python session, and: >>> import clyngor
>>> models = clyngor.solve(inline='1{n(1..1000)}1.', nb_model=500, stats=True)
>>> nb_model_found = 0
>>> for nb_model_found, model in enumerate(models, start=1):
... pass
...
>>> models.statistics['Models']
'500+' Is that expected behaviour? |
Thanks for taking time to document that. No, it's not expected officially, but it's expected behavior since there is little work on the statistics data structure when the clingo module is installed. This is due to the fact that using the clingo module, clyngor uses the API, whereas without the clingo module it parses the output, building the For the moment, i don't have time for such development. If that interests you, we can continue discussions at #23 |
Thanks for the explanation :) I'm happy just not using the clingo module (I think, ..., for now at least). Clyngor seems to provide what I'm looking for in terms of access to clingo from python. If it turns out I need both |
Cool ! Do not hesitate to open issues if you have more questions, remarks or inquiries. Happy coding ! |
Dear Lucas
This is brilliant. Thank you very much for making it open-source!
Is there a way to get an indication of the number of models generated? If I run clingo on the commandline with a set number of models, clingo will tell me if there are more models available, e.g.:
The "+" in "Models: 500+" tells me there are more than 500 possibilities. Can I access that kind of info via Clyngor?
Thanks again
Ivan
The text was updated successfully, but these errors were encountered: