Statistics¶
Solvers and term managers keep statistics about their work. Python returns
each statistic as a dict with the keys default, internal, and value.
Mojo returns a Stat, which has them as fields:
default: Bool, whether the statistic still has its default value;internal: Bool, whether it is internal to cvc5;value: Stat.Value, aVariant[Int, Float64, String, Dict[String, UInt64]]. Test its type withvalue.isa[Int](), and read it withvalue[Int]. A histogram maps names to counts.
So Python's stats["name"]["value"] is stats["name"].value[Int], and
stats.get() returns a Dict[String, Stat]. A Stat prints as Python
prints the dict, for example {'default': False, 'internal': True, 'value': 0.0}.
See the base API.
Statistics¶
The cvc5 Statistics.
Wrapper class for Statistics.
Obtain a single statistic value using stats["name"] and a
dictionary with, configurably all (including internal and unchanged)
statistics using Statistics.get().
Iterate over all (including internal and unchanged) statistics via (the
standard iterable functions) __iter__() and __next__().
3 of the 3 mirrored methods of Statistics are generated.
| Method | Summary | Binding | Mojo |
|---|---|---|---|
__getitem__ |
Get the statistics information for the statistic called name. |
manual | ✓ |
__iter__ |
Iterate over all statistics (including internal and unchanged statistics). | manual | ✓ |
get |
Get all statistics as a dictionary. | manual | ✓ |
Statistics.__getitem__¶
Mojo declaration:
def __getitem__(self, name: String) raises -> Stat
Upstream Python signature:
Statistics.__getitem__(name: str)
Get the statistics information for the statistic called name.
Parameters
name: The name of the statistic to get.
Binding: Hand-written using cvc5_stats_get, cvc5_stat_is_default, cvc5_stat_is_internal, cvc5_stat_is_int, cvc5_stat_get_int, cvc5_stat_is_double, cvc5_stat_get_double, cvc5_stat_is_string, cvc5_stat_get_string, cvc5_stat_is_histogram, cvc5_stat_get_histogram, cvc5_stat_release.
Statistics.__iter__¶
Mojo declaration:
def __iter__(self) raises -> OwnedIterator[Tuple[String, Stat]]
Upstream Python signature:
Statistics.__iter__()
Iterate over all statistics (including internal and unchanged statistics).
Binding: Hand-written using cvc5_stats_iter_init, cvc5_stats_iter_has_next, cvc5_stats_iter_next, cvc5_stat_is_default, cvc5_stat_is_internal, cvc5_stat_is_int, cvc5_stat_get_int, cvc5_stat_is_double, cvc5_stat_get_double, cvc5_stat_is_string, cvc5_stat_get_string, cvc5_stat_is_histogram, cvc5_stat_get_histogram, cvc5_stat_release.
Statistics.get¶
Mojo declaration:
def get(self, internal: Bool = False, defaulted: Bool = False) raises -> Dict[String, Stat]
Upstream Python signature:
Statistics.get(internal: bint = False, defaulted: bint = False)
Get all statistics as a dictionary.
Parameters
internal: True to also include internal statistics.defaulted: True to also include unchanged statistics.
Returns
A dictionary with all available statistics.
Binding: Hand-written using cvc5_stats_iter_init, cvc5_stats_iter_has_next, cvc5_stats_iter_next, cvc5_stat_is_default, cvc5_stat_is_internal, cvc5_stat_is_int, cvc5_stat_get_int, cvc5_stat_is_double, cvc5_stat_get_double, cvc5_stat_is_string, cvc5_stat_get_string, cvc5_stat_is_histogram, cvc5_stat_get_histogram, cvc5_stat_release.