I am using Java API of Z3 and I would like to get some statistics from the solver such as solving time, number of variables/symbols, memory usage. The post here (Z3py: how to get the list of variables from a formula?) claims that there is a utility implementation in Python but I was wondering if there is any for JavaAPI.
Thanks.
Those particular utilities are an external contribution to Z3 and only available for the Python API. It should be possible to follow the same ideas in Java though.
The Solver
object has a function called getStatistics()
that returns Statistics
object, which is essentially a collection of key/value pairs. Note that zero-valued statistical values are not reported (see e.g., also the discussion here).
There is currently no documentation for the statistical values reported (or the precision with which they are tracked), so all these values should be treated with care.
See also the following related questions:
Interpretation of Z3 Statistics
How to interpret statistics Z3
Which statistics indicate an efficient run of Z3?