diff --git a/CHANGES.md b/CHANGES.md index d57c65b9..c0ce4552 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,10 +17,12 @@ * added option to set false assumptions * type parsing and defaults for user input in `_context_value` * model selection now accepts show statements for filtering + * added operation to set a constant * Domain constructors * added optimization information into domain state * added information about externals * added automatic check to skip constructors based on `ui files` + * added information about the constants * Examples * New example with incremental solving * New examples with optimization and false assumptions diff --git a/clinguin/server/application/backends/clingo_backend.py b/clinguin/server/application/backends/clingo_backend.py index 43e258a8..25595a6c 100644 --- a/clinguin/server/application/backends/clingo_backend.py +++ b/clinguin/server/application/backends/clingo_backend.py @@ -214,6 +214,7 @@ def _init_ds_constructors(self): self._domain_state_constructors = [] self._backup_ds_cache = {} self._add_domain_state_constructor("_ds_context") + self._add_domain_state_constructor("_ds_constants") self._add_domain_state_constructor("_ds_browsing") self._add_domain_state_constructor("_ds_cautious_optimal") self._add_domain_state_constructor("_ds_brave_optimal") @@ -1062,7 +1063,7 @@ def clear_assumptions(self): self._outdate() self._assumptions = set() - def add_assumption(self, atom, value): + def add_assumption(self, atom, value="true"): """ Adds an atom `a` as an assumption. If the value is True, the atom is assumed to be true. diff --git a/clinguin/server/application/backends/explanation_backend.py b/clinguin/server/application/backends/explanation_backend.py index d1e5b432..3c008f36 100644 --- a/clinguin/server/application/backends/explanation_backend.py +++ b/clinguin/server/application/backends/explanation_backend.py @@ -46,18 +46,6 @@ def _assumption_list(self): # Initialization # --------------------------------------------- - @extends(ClingoBackend) - def _init_interactive(self): - """ - Adds the MUS property - - Attributes: - _mus (str): The list of assumptions in the MUS property - """ - super()._init_interactive() - # pylint: disable= attribute-defined-outside-init - self._mus = None - @extends(ClingoBackend) def _init_command_line(self): """ @@ -72,7 +60,8 @@ def _init_command_line(self): self._assumption_sig = [] for a in self._args.assumption_signature or []: try: - self._assumption_sig.append((a.split(",")[0], int(a.split(",")[1]))) + name, arity = a.split(",") + self._assumption_sig.append((name, int(arity))) except Exception as ex: raise ValueError( "Argument assumption_signature must have format name,arity"