Skip to content
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

Measure solver statistics access #35

Open
ThomSerg opened this issue Nov 20, 2024 · 1 comment
Open

Measure solver statistics access #35

ThomSerg opened this issue Nov 20, 2024 · 1 comment

Comments

@ThomSerg
Copy link

ThomSerg commented Nov 20, 2024

Hello,

I'm working on a student exercise session for a CP course. I'm using Choco through its Python interface to demonstrate to
the students how the chosen decision variable representation can impact the solver's performance (e.g. boolean vs integer decision variables, dependent on the problem and used constraints). I have access to the solving time as to show the impact on the performance, but ideally I would also like to be able to show the difference in the number of traversed search nodes.

I saw that the Java API makes this available through solver.getMeasures() via getNodeCount(). In the Python interface, I only found .show_statistics() and .show_short_statistics() as to enable the printing of these statistics after solving. They get directly printed to stdout (making them also invisible in a jupyter notebook). More ideal would be to have these metrics accessible through Choco's Python API, i.e. that we can also call .getMeasures() on the Python solver object as to access these fields.

I experimented a bit and got something working to get the .toString() representation of a Measures object back to Python. But I believe that it would be beneficial to have access to an actual Measures object in Python instead of only its string representation.

So this issue is more of a feature request. If you agree this would be a nice addition, I believe I understand enough of the code base to attempt an initial implementation myself (although I would probably have some questions along the way).

With kind regards,
Thomas

@dimitri-justeau
Copy link
Collaborator

Hi ! Indeed, that looks like a feature request :-) And you are right, it would be nice to have more access to measures in pychoco, I cannot guarantee any deadline to implement it, but we keep that on the list !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants