diff --git a/fclingo/__main__.py b/fclingo/__main__.py index 38e7a8b..ccb17c8 100644 --- a/fclingo/__main__.py +++ b/fclingo/__main__.py @@ -29,6 +29,7 @@ def __init__(self): self.translate_program = 0 self.constraints_added = 0 self.rules_added = 0 + self.variables_added = 0 class AppConfig: @@ -150,6 +151,7 @@ def _on_statistics(self, step, akku): translation = fclingo["Translation time in seconds"] translation["AST rewriting"] = self.stats.rewrite_ast translation["Translation"] = self.stats.translate_program + fclingo["Number of variables added"] = self.stats.variables_added fclingo["Number of constraints added"] = self.stats.constraints_added fclingo["Number of rules added"] = self.stats.rules_added return True diff --git a/fclingo/translator.py b/fclingo/translator.py index 9f59f68..3a60673 100644 --- a/fclingo/translator.py +++ b/fclingo/translator.py @@ -231,10 +231,12 @@ def _add_auxvar(self): clingo.TheoryTermType.Function, ) self._auxvars += 1 + self._stats.variables_added+=1 return var def _add_atom(self, symbol=None): with self._prg.backend() as backend: + self._stats.constraints_added+=1 if symbol: return backend.add_atom(symbol) return backend.add_atom() @@ -256,6 +258,7 @@ def _search_atom(self, lit): def _add_rule(self, head, body, choice=False): with self._prg.backend() as backend: + self._stats.rules_added+=1 backend.add_rule(head, body, choice) if self._config.print_trans: head_atoms = []