clingexplaid 1.3.2__tar.gz → 1.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/PKG-INFO +22 -1
  2. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/README.md +21 -0
  3. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/preprocessors/preprocessor_assumption.py +4 -9
  4. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid.egg-info/PKG-INFO +22 -1
  5. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/test_preprocessors.py +1 -2
  6. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/.envrc +0 -0
  7. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/.github/workflows/deploy.yml +0 -0
  8. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/.github/workflows/test.yml +0 -0
  9. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/.gitignore +0 -0
  10. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/.pre-commit-config.yaml +0 -0
  11. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/.readthedocs.yaml +0 -0
  12. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/CHANGES.md +0 -0
  13. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/CONTRIBUTING.md +0 -0
  14. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/DEPLOYMENT.md +0 -0
  15. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/DEVELOPMENT.md +0 -0
  16. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/LICENSE +0 -0
  17. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/LIMITATIONS.md +0 -0
  18. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/TODO.md +0 -0
  19. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/doc/Makefile +0 -0
  20. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/doc/_static/css/custom.css +0 -0
  21. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/doc/_static/logo-dark-mode.png +0 -0
  22. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/doc/_static/logo-light-mode.png +0 -0
  23. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/doc/conf.py +0 -0
  24. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/doc/content/encodings/index.md +0 -0
  25. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/doc/content/encodings/instance.md +0 -0
  26. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/doc/content/installation.md +0 -0
  27. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/doc/content/quickstart.md +0 -0
  28. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/doc/index.md +0 -0
  29. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/graph_coloring/README.md +0 -0
  30. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/graph_coloring/encoding.lp +0 -0
  31. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/graph_coloring/graph_coloring_example.svg +0 -0
  32. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/graph_coloring/instance.lp +0 -0
  33. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/bad_mucs.lp +0 -0
  34. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/sat.lp +0 -0
  35. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/sat_simple.lp +0 -0
  36. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/simple.lp +0 -0
  37. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/soup.lp +0 -0
  38. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/sudoku_4x4.lp +0 -0
  39. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/sudoku_encoding.lp +0 -0
  40. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/sudoku_encoding_2.lp +0 -0
  41. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/test/blob.lp +0 -0
  42. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/test.lp +0 -0
  43. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/test2.lp +0 -0
  44. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/test3.lp +0 -0
  45. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/test4.lp +0 -0
  46. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/test_inert.lp +0 -0
  47. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/x.lp +0 -0
  48. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/misc/zero_arity_assumptions.lp +0 -0
  49. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/queens/README.md +0 -0
  50. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/queens/encoding.lp +0 -0
  51. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/queens/instance.lp +0 -0
  52. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/queens/queens_example.svg +0 -0
  53. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/sudoku/README.md +0 -0
  54. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/sudoku/encoding.lp +0 -0
  55. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/sudoku/instance.lp +0 -0
  56. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/examples/sudoku/sudoku_example.svg +0 -0
  57. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/noxfile.py +0 -0
  58. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/pyproject.toml +0 -0
  59. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/setup.cfg +0 -0
  60. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/__init__.py +0 -0
  61. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/cli/style/mus.py +0 -0
  62. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/exceptions/__init__.py +0 -0
  63. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/mus/__init__.py +0 -0
  64. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/mus/core_computer.py +0 -0
  65. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/preprocessors/__init__.py +0 -0
  66. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/propagators/__init__.py +0 -0
  67. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/propagators/constants.py +0 -0
  68. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/propagators/propagator_solver_decisions.py +0 -0
  69. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/py.typed +0 -0
  70. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/transformers/__init__.py +0 -0
  71. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/transformers/constants.py +0 -0
  72. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/transformers/transformer_constraint.py +0 -0
  73. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/transformers/transformer_fact.py +0 -0
  74. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/transformers/transformer_optimization_remover.py +0 -0
  75. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/transformers/transformer_rule_id.py +0 -0
  76. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/transformers/transformer_rule_splitter.py +0 -0
  77. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/unsat_constraints/__init__.py +0 -0
  78. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/unsat_constraints/constants.py +0 -0
  79. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/unsat_constraints/unsat_constraint_computer.py +0 -0
  80. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/utils/__init__.py +0 -0
  81. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/utils/logging.py +0 -0
  82. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/utils/match.py +0 -0
  83. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/utils/parser.py +0 -0
  84. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/utils/symbols.py +0 -0
  85. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid/utils/types.py +0 -0
  86. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid.egg-info/SOURCES.txt +0 -0
  87. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid.egg-info/dependency_links.txt +0 -0
  88. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid.egg-info/requires.txt +0 -0
  89. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/src/clingexplaid.egg-info/top_level.txt +0 -0
  90. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/__init__.py +0 -0
  91. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/__init__.py +0 -0
  92. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_constant.lp +0 -0
  93. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_included.lp +0 -0
  94. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_includes.lp +0 -0
  95. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_program.lp +0 -0
  96. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_program_constants.lp +0 -0
  97. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_program_constraints.lp +0 -0
  98. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_program_decision_order.lp +0 -0
  99. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_program_multi_mus.lp +0 -0
  100. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_program_optimization.lp +0 -0
  101. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_program_pattern.lp +0 -0
  102. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_program_rules.lp +0 -0
  103. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/test_program_unsat_constraints.lp +0 -0
  104. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_constant.lp +0 -0
  105. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_includes.lp +0 -0
  106. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_program_assumptions_all.lp +0 -0
  107. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_program_assumptions_certain_signatures.lp +0 -0
  108. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_program_constraints.lp +0 -0
  109. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_program_constraints_id.lp +0 -0
  110. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_program_facts.lp +0 -0
  111. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_program_nothing_transformed.lp +0 -0
  112. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_program_optimization.lp +0 -0
  113. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_program_pattern.lp +0 -0
  114. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_program_rule_ids.lp +0 -0
  115. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/res/transformed_program_rules_split.lp +0 -0
  116. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/test_main.py +0 -0
  117. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/test_muc.py +0 -0
  118. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/test_transformers.py +0 -0
  119. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/test_unsat_constraints.py +0 -0
  120. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/clingexplaid/test_utils.py +0 -0
  121. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/py.typed +0 -0
  122. {clingexplaid-1.3.2 → clingexplaid-1.3.4}/tests/test_main.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clingexplaid
3
- Version: 1.3.2
3
+ Version: 1.3.4
4
4
  Summary: Tools to aid the development of explanation systems using clingo
5
5
  Author-email: Hannes Weichelt <hweichelt@uni-potsdam.de>, Susana Hahn <susuhahnml@yahoo.com.mx>
6
6
  Maintainer-email: Hannes Weichelt <hweichelt@uni-potsdam.de>
@@ -123,6 +123,27 @@ print(result)
123
123
  print(ap.control)
124
124
  ```
125
125
 
126
+ You can also use an existing control and pass it to the
127
+ `AssumptionPreprocessor` as follows:
128
+
129
+ ```python
130
+
131
+ FILE = "local/encoding.lp"
132
+
133
+ ctl = clingo.Control("0")
134
+ ap = AssumptionPreprocessor(
135
+ control=ctl,
136
+ filters=[
137
+ FilterSignature("a", 1),
138
+ FilterPattern("d(2)")
139
+ ])
140
+ ap.process_files([FILE])
141
+
142
+ # The transformed files are added to ctl so it can be directly used
143
+ ctl.ground([("base", [])])
144
+ ctl.solve()
145
+ ```
146
+
126
147
  Getting a single MUS:
127
148
 
128
149
  ```python
@@ -54,6 +54,27 @@ print(result)
54
54
  print(ap.control)
55
55
  ```
56
56
 
57
+ You can also use an existing control and pass it to the
58
+ `AssumptionPreprocessor` as follows:
59
+
60
+ ```python
61
+
62
+ FILE = "local/encoding.lp"
63
+
64
+ ctl = clingo.Control("0")
65
+ ap = AssumptionPreprocessor(
66
+ control=ctl,
67
+ filters=[
68
+ FilterSignature("a", 1),
69
+ FilterPattern("d(2)")
70
+ ])
71
+ ap.process_files([FILE])
72
+
73
+ # The transformed files are added to ctl so it can be directly used
74
+ ctl.ground([("base", [])])
75
+ ctl.solve()
76
+ ```
77
+
57
78
  Getting a single MUS:
58
79
 
59
80
  ```python
@@ -98,7 +98,7 @@ class AssumptionPreprocessor:
98
98
  rules.append(f"#const {constant}={value}.")
99
99
  return "\n".join(rules) + "\n"
100
100
 
101
- def _unpool(self, ast_symbol: clingo.ast.ASTType.SymbolicAtom) -> Set[clingo.Symbol]:
101
+ def _unpool(self, ast_symbol: clingo.ast.AST) -> Set[clingo.Symbol]:
102
102
  if ".." in str(ast_symbol):
103
103
  # Case range in ast symbol (i.e. 1..10)
104
104
  # Solved using grounding, but if possible, I'd rather avoid this if possible
@@ -116,7 +116,7 @@ class AssumptionPreprocessor:
116
116
  atoms_unpooled = ast_symbol.unpool()
117
117
  return {clingo.parse_term(str(a)) for a in atoms_unpooled}
118
118
 
119
- def _transform_rule(self, rule: clingo.ast.ASTType.Rule) -> List[clingo.ast.ASTType.Rule]:
119
+ def _transform_rule(self, rule: clingo.ast.AST) -> List[clingo.ast.AST]:
120
120
  if rule.head.ast_type != clingo.ast.ASTType.Literal:
121
121
  return [rule]
122
122
  if rule.body:
@@ -161,9 +161,6 @@ class AssumptionPreprocessor:
161
161
  if ast.ast_type == clingo.ast.ASTType.Definition:
162
162
  self._add_constant(str(ast.name), ast.value.symbol)
163
163
  self._parsed_rules.append(str(ast))
164
- warnings.warn(
165
- "Currently the ProgramBuilder does not fill the control. Please add the processed programm manually."
166
- )
167
164
  builder.add(ast)
168
165
 
169
166
  def _process_ast_list(self, ast_list: List[clingo.ast.AST], builder: ProgramBuilder) -> None:
@@ -182,9 +179,8 @@ class AssumptionPreprocessor:
182
179
 
183
180
  def process(self, program_string: str) -> str:
184
181
  """Processes the provided program string and returns the transformed program string (control is also updated)"""
185
- control = clingo.Control("0")
186
182
  ast_list: List[clingo.ast.AST] = []
187
- with ProgramBuilder(control) as builder:
183
+ with ProgramBuilder(self.control) as builder:
188
184
  parse_string(program_string, ast_list.append)
189
185
  self._process_ast_list(ast_list, builder)
190
186
  self._processed = True
@@ -195,9 +191,8 @@ class AssumptionPreprocessor:
195
191
  if files is None:
196
192
  warnings.warn("Nothing to process, no files provided")
197
193
  return ""
198
- control = clingo.Control("0")
199
194
  ast_list: List[clingo.ast.AST] = []
200
- with ProgramBuilder(control) as builder:
195
+ with ProgramBuilder(self.control) as builder:
201
196
  parse_files(files, ast_list.append)
202
197
  self._process_ast_list(ast_list, builder)
203
198
  self._processed = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clingexplaid
3
- Version: 1.3.2
3
+ Version: 1.3.4
4
4
  Summary: Tools to aid the development of explanation systems using clingo
5
5
  Author-email: Hannes Weichelt <hweichelt@uni-potsdam.de>, Susana Hahn <susuhahnml@yahoo.com.mx>
6
6
  Maintainer-email: Hannes Weichelt <hweichelt@uni-potsdam.de>
@@ -123,6 +123,27 @@ print(result)
123
123
  print(ap.control)
124
124
  ```
125
125
 
126
+ You can also use an existing control and pass it to the
127
+ `AssumptionPreprocessor` as follows:
128
+
129
+ ```python
130
+
131
+ FILE = "local/encoding.lp"
132
+
133
+ ctl = clingo.Control("0")
134
+ ap = AssumptionPreprocessor(
135
+ control=ctl,
136
+ filters=[
137
+ FilterSignature("a", 1),
138
+ FilterPattern("d(2)")
139
+ ])
140
+ ap.process_files([FILE])
141
+
142
+ # The transformed files are added to ctl so it can be directly used
143
+ ctl.ground([("base", [])])
144
+ ctl.solve()
145
+ ```
146
+
126
147
  Getting a single MUS:
127
148
 
128
149
  ```python
@@ -79,8 +79,7 @@ class TestPreprocessors(TestCase):
79
79
  program_path = TEST_DIR.joinpath("res/test_program_constants.lp")
80
80
  ap = AssumptionPreprocessor()
81
81
  with open(program_path, "r", encoding="utf-8") as file:
82
- result = ap.process(file.read())
83
- ap.control.add("base", [], result)
82
+ ap.process(file.read())
84
83
  ap.control.ground([("base", [])])
85
84
  self.assertEqual(
86
85
  ap.constants,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes