From 31375774c437403e8a05f5fe8d0346caba0f43e4 Mon Sep 17 00:00:00 2001 From: Lucas Bourneuf Date: Wed, 30 Oct 2019 18:36:04 +0100 Subject: [PATCH] when using clingo module, only put in model the shown atoms When using .symbols method, many selections are available. Before this commit, we asked for everything. What interests us is the sole clingo output. Hence this commit. --- README.mkd | 1 + clyngor/answers.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.mkd b/README.mkd index 2f2858f..63d5cc6 100644 --- a/README.mkd +++ b/README.mkd @@ -291,6 +291,7 @@ the official module can be used by clyngor if it is available. - 0.4.0 (todo) - see [further ideas](#Further-ideas) - 0.3.24 + - when using clingo module, the models contains only the output atoms, not everything - access to the answer set number with `.with_answer_number` - parsing and string reproduction of nested atoms such as `a((a("g(2,3)",(2)),))` is now correctly handled and tested - fix the `models.command` output when clingo module is used diff --git a/clyngor/answers.py b/clyngor/answers.py index 82c1bc2..a2b5d88 100644 --- a/clyngor/answers.py +++ b/clyngor/answers.py @@ -321,7 +321,7 @@ def __compute_answers(self): with self._solver.solve(**kwargs) as models: for model in models: answer_set = set((a.name, utils.clingo_value_to_python(a.arguments)) - for a in model.symbols(atoms=True)) + for a in model.symbols(shown=True)) yield answer_set, model.cost, model.optimality_proven, model.number @property