Skip to content

Measure solver statistics access #35

@ThomSerg

Description

@ThomSerg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions