clingexplaid 1.0.9__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 (111) hide show
  1. clingexplaid-1.0.9/.envrc +10 -0
  2. clingexplaid-1.0.9/.github/workflows/deploy.yml +51 -0
  3. clingexplaid-1.0.9/.github/workflows/test.yml +41 -0
  4. clingexplaid-1.0.9/.gitignore +40 -0
  5. clingexplaid-1.0.9/.pre-commit-config.yaml +35 -0
  6. clingexplaid-1.0.9/.readthedocs.yaml +14 -0
  7. clingexplaid-1.0.9/CHANGES.md +5 -0
  8. clingexplaid-1.0.9/CONTRIBUTING.md +31 -0
  9. clingexplaid-1.0.9/DEPLOYMENT.md +15 -0
  10. clingexplaid-1.0.9/DEVELOPMENT.md +41 -0
  11. clingexplaid-1.0.9/LICENSE +21 -0
  12. clingexplaid-1.0.9/PKG-INFO +244 -0
  13. clingexplaid-1.0.9/README.md +191 -0
  14. clingexplaid-1.0.9/TODO.md +63 -0
  15. clingexplaid-1.0.9/doc/Makefile +20 -0
  16. clingexplaid-1.0.9/doc/_static/css/custom.css +33 -0
  17. clingexplaid-1.0.9/doc/_static/logo-dark-mode.png +0 -0
  18. clingexplaid-1.0.9/doc/_static/logo-light-mode.png +0 -0
  19. clingexplaid-1.0.9/doc/conf.py +126 -0
  20. clingexplaid-1.0.9/doc/content/encodings/index.md +7 -0
  21. clingexplaid-1.0.9/doc/content/encodings/instance.md +32 -0
  22. clingexplaid-1.0.9/doc/content/installation.md +41 -0
  23. clingexplaid-1.0.9/doc/content/quickstart.md +11 -0
  24. clingexplaid-1.0.9/doc/index.md +9 -0
  25. clingexplaid-1.0.9/examples/graph_coloring/README.md +61 -0
  26. clingexplaid-1.0.9/examples/graph_coloring/encoding.lp +5 -0
  27. clingexplaid-1.0.9/examples/graph_coloring/graph_coloring_example.svg +4 -0
  28. clingexplaid-1.0.9/examples/graph_coloring/instance.lp +20 -0
  29. clingexplaid-1.0.9/examples/misc/bad_mucs.lp +5 -0
  30. clingexplaid-1.0.9/examples/misc/sat.lp +17 -0
  31. clingexplaid-1.0.9/examples/misc/simple.lp +4 -0
  32. clingexplaid-1.0.9/examples/misc/soup.lp +3 -0
  33. clingexplaid-1.0.9/examples/misc/sudoku_4x4.lp +11 -0
  34. clingexplaid-1.0.9/examples/misc/sudoku_encoding.lp +17 -0
  35. clingexplaid-1.0.9/examples/misc/sudoku_encoding_2.lp +15 -0
  36. clingexplaid-1.0.9/examples/misc/test/blob.lp +3 -0
  37. clingexplaid-1.0.9/examples/misc/test.lp +3 -0
  38. clingexplaid-1.0.9/examples/misc/test2.lp +8 -0
  39. clingexplaid-1.0.9/examples/misc/test3.lp +4 -0
  40. clingexplaid-1.0.9/examples/misc/test4.lp +13 -0
  41. clingexplaid-1.0.9/examples/misc/test_inert.lp +1 -0
  42. clingexplaid-1.0.9/examples/misc/x.lp +31 -0
  43. clingexplaid-1.0.9/examples/misc/zero_arity_assumptions.lp +5 -0
  44. clingexplaid-1.0.9/examples/queens/README.md +54 -0
  45. clingexplaid-1.0.9/examples/queens/encoding.lp +9 -0
  46. clingexplaid-1.0.9/examples/queens/instance.lp +3 -0
  47. clingexplaid-1.0.9/examples/queens/queens_example.svg +4 -0
  48. clingexplaid-1.0.9/examples/sudoku/README.md +65 -0
  49. clingexplaid-1.0.9/examples/sudoku/encoding.lp +13 -0
  50. clingexplaid-1.0.9/examples/sudoku/instance.lp +6 -0
  51. clingexplaid-1.0.9/examples/sudoku/sudoku_example.svg +4 -0
  52. clingexplaid-1.0.9/noxfile.py +92 -0
  53. clingexplaid-1.0.9/pyproject.toml +91 -0
  54. clingexplaid-1.0.9/setup.cfg +4 -0
  55. clingexplaid-1.0.9/src/clingexplaid/__init__.py +3 -0
  56. clingexplaid-1.0.9/src/clingexplaid/__main__.py +21 -0
  57. clingexplaid-1.0.9/src/clingexplaid/cli/__init__.py +0 -0
  58. clingexplaid-1.0.9/src/clingexplaid/cli/clingo_app.py +352 -0
  59. clingexplaid-1.0.9/src/clingexplaid/muc/__init__.py +9 -0
  60. clingexplaid-1.0.9/src/clingexplaid/muc/core_computer.py +140 -0
  61. clingexplaid-1.0.9/src/clingexplaid/propagators/__init__.py +16 -0
  62. clingexplaid-1.0.9/src/clingexplaid/propagators/constants.py +11 -0
  63. clingexplaid-1.0.9/src/clingexplaid/propagators/propagator_decision_order.py +176 -0
  64. clingexplaid-1.0.9/src/clingexplaid/py.typed +0 -0
  65. clingexplaid-1.0.9/src/clingexplaid/transformers/__init__.py +19 -0
  66. clingexplaid-1.0.9/src/clingexplaid/transformers/constants.py +6 -0
  67. clingexplaid-1.0.9/src/clingexplaid/transformers/exceptions.py +15 -0
  68. clingexplaid-1.0.9/src/clingexplaid/transformers/transformer_assumption.py +112 -0
  69. clingexplaid-1.0.9/src/clingexplaid/transformers/transformer_constraint.py +72 -0
  70. clingexplaid-1.0.9/src/clingexplaid/transformers/transformer_fact.py +77 -0
  71. clingexplaid-1.0.9/src/clingexplaid/transformers/transformer_optimization_remover.py +61 -0
  72. clingexplaid-1.0.9/src/clingexplaid/transformers/transformer_rule_id.py +78 -0
  73. clingexplaid-1.0.9/src/clingexplaid/transformers/transformer_rule_splitter.py +100 -0
  74. clingexplaid-1.0.9/src/clingexplaid/unsat_constraints/__init__.py +9 -0
  75. clingexplaid-1.0.9/src/clingexplaid/unsat_constraints/constants.py +5 -0
  76. clingexplaid-1.0.9/src/clingexplaid/unsat_constraints/unsat_constraint_computer.py +121 -0
  77. clingexplaid-1.0.9/src/clingexplaid/utils/__init__.py +90 -0
  78. clingexplaid-1.0.9/src/clingexplaid/utils/logging.py +90 -0
  79. clingexplaid-1.0.9/src/clingexplaid/utils/parser.py +58 -0
  80. clingexplaid-1.0.9/src/clingexplaid/utils/types.py +13 -0
  81. clingexplaid-1.0.9/src/clingexplaid.egg-info/PKG-INFO +244 -0
  82. clingexplaid-1.0.9/src/clingexplaid.egg-info/SOURCES.txt +109 -0
  83. clingexplaid-1.0.9/src/clingexplaid.egg-info/dependency_links.txt +1 -0
  84. clingexplaid-1.0.9/src/clingexplaid.egg-info/entry_points.txt +2 -0
  85. clingexplaid-1.0.9/src/clingexplaid.egg-info/requires.txt +27 -0
  86. clingexplaid-1.0.9/src/clingexplaid.egg-info/top_level.txt +1 -0
  87. clingexplaid-1.0.9/tests/__init__.py +0 -0
  88. clingexplaid-1.0.9/tests/clingexplaid/__init__.py +0 -0
  89. clingexplaid-1.0.9/tests/clingexplaid/res/test_program.lp +7 -0
  90. clingexplaid-1.0.9/tests/clingexplaid/res/test_program_constants.lp +2 -0
  91. clingexplaid-1.0.9/tests/clingexplaid/res/test_program_constraints.lp +5 -0
  92. clingexplaid-1.0.9/tests/clingexplaid/res/test_program_decision_order.lp +4 -0
  93. clingexplaid-1.0.9/tests/clingexplaid/res/test_program_multi_muc.lp +6 -0
  94. clingexplaid-1.0.9/tests/clingexplaid/res/test_program_optimization.lp +5 -0
  95. clingexplaid-1.0.9/tests/clingexplaid/res/test_program_rules.lp +5 -0
  96. clingexplaid-1.0.9/tests/clingexplaid/res/test_program_unsat_constraints.lp +4 -0
  97. clingexplaid-1.0.9/tests/clingexplaid/res/transformed_program_assumptions_all.lp +8 -0
  98. clingexplaid-1.0.9/tests/clingexplaid/res/transformed_program_assumptions_certain_signatures.lp +8 -0
  99. clingexplaid-1.0.9/tests/clingexplaid/res/transformed_program_constraints.lp +6 -0
  100. clingexplaid-1.0.9/tests/clingexplaid/res/transformed_program_constraints_id.lp +6 -0
  101. clingexplaid-1.0.9/tests/clingexplaid/res/transformed_program_facts.lp +5 -0
  102. clingexplaid-1.0.9/tests/clingexplaid/res/transformed_program_optimization.lp +4 -0
  103. clingexplaid-1.0.9/tests/clingexplaid/res/transformed_program_rule_ids.lp +9 -0
  104. clingexplaid-1.0.9/tests/clingexplaid/res/transformed_program_rules_split.lp +10 -0
  105. clingexplaid-1.0.9/tests/clingexplaid/test_main.py +23 -0
  106. clingexplaid-1.0.9/tests/clingexplaid/test_muc.py +279 -0
  107. clingexplaid-1.0.9/tests/clingexplaid/test_transformers.py +173 -0
  108. clingexplaid-1.0.9/tests/clingexplaid/test_unsat_constraints.py +74 -0
  109. clingexplaid-1.0.9/tests/clingexplaid/test_utils.py +29 -0
  110. clingexplaid-1.0.9/tests/py.typed +0 -0
  111. clingexplaid-1.0.9/tests/test_main.py +34 -0
@@ -0,0 +1,10 @@
1
+ # automatically activate dev environment when in project tree using direnv.
2
+ ACT=.nox/dev/bin/activate
3
+
4
+ if [ -e $ACT ]
5
+ then
6
+ source $ACT
7
+ else
8
+ echo "Activation script ${ACT} not found for dev environment.
9
+ Run nox -s dev to install dev environment"
10
+ fi
@@ -0,0 +1,51 @@
1
+ name: deploy to pypi
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - 'v[0-9]+.[0-9]+.[0-9]+'
8
+
9
+ jobs:
10
+ test:
11
+ uses: ./.github/workflows/test.yml
12
+
13
+ deploy:
14
+ name: deploy
15
+ needs: test
16
+ permissions:
17
+ id-token: write
18
+ environment: release
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 0
24
+
25
+ - uses: actions/setup-python@v5
26
+ with:
27
+ python-version: 3.11
28
+
29
+ - name: install build dependencies
30
+ run: python3 -m pip install build
31
+
32
+ - name: build package
33
+ run: python3 -m build --sdist --wheel --outdir dist/
34
+
35
+ - name: upload package
36
+ uses: actions/upload-artifact@v4
37
+ with:
38
+ name: package
39
+ path: dist/
40
+
41
+ - name: publish package (pypi)
42
+ if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
43
+ uses: pypa/gh-action-pypi-publish@release/v1
44
+ with:
45
+ repository-url: "https://upload.pypi.org/legacy/"
46
+
47
+ - name: publish package (test.pypi)
48
+ if: ${{ github.event_name == 'workflow_dispatch' }}
49
+ uses: pypa/gh-action-pypi-publish@release/v1
50
+ with:
51
+ repository-url: "https://test.pypi.org/legacy/"
@@ -0,0 +1,41 @@
1
+ name: run CI test
2
+
3
+ on:
4
+ push:
5
+ branches: [devel, main, master, wip]
6
+ pull_request:
7
+ workflow_call:
8
+
9
+ env:
10
+ FORCE_COLOR: "3"
11
+
12
+ jobs:
13
+ build:
14
+ name: test on ${{ matrix.os }}
15
+ runs-on: ${{ matrix.os }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: [ubuntu-latest, macos-latest, windows-latest]
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - uses: actions/setup-python@v5
24
+ with:
25
+ python-version: 3.9
26
+ - uses: actions/setup-python@v5
27
+ with:
28
+ python-version: 3.11
29
+ - uses: actions/setup-python@v5
30
+ with:
31
+ python-version: 3.12
32
+
33
+ - name: install requirements
34
+ run: python -m pip install nox pre-commit
35
+
36
+ - name: run pre-commit
37
+ if: ${{ matrix.os == 'ubuntu-latest' }}
38
+ run: pre-commit run --all --show-diff-on-failure
39
+
40
+ - name: run tests
41
+ run: nox
@@ -0,0 +1,40 @@
1
+ # Editors
2
+ .vscode/
3
+ *~
4
+ \#*\#
5
+ .\#*
6
+ .idea/
7
+
8
+ # Mac/OSX
9
+ .DS_Store
10
+
11
+ # Byte-compiled / optimized / DLL files
12
+ __pycache__/
13
+ *.py[cod]
14
+ *$py.class
15
+
16
+ # Installer logs
17
+ pip-log.txt
18
+ pip-delete-this-directory.txt
19
+
20
+ # Unit test / coverage reports
21
+ .pytest_cache/
22
+
23
+ #venv
24
+ .venv
25
+
26
+ # pyenv
27
+ .python-version
28
+
29
+ # mypy
30
+ .mypy_cache/
31
+ .dmypy.json
32
+ dmypy.json
33
+ *egg-info*
34
+
35
+ # unclassified
36
+ dist
37
+ build
38
+ .coverage
39
+ _build
40
+ _autosummary
@@ -0,0 +1,35 @@
1
+ repos:
2
+ - repo: https://github.com/myint/autoflake
3
+ rev: v2.3.0
4
+ hooks:
5
+ - id: autoflake
6
+ args: ["--in-place", "--imports=clingexplaid", "--ignore-init-module-imports", "--remove-unused-variables"]
7
+ exclude: ^.github/
8
+
9
+ - repo: https://github.com/pre-commit/pre-commit-hooks
10
+ rev: v4.5.0
11
+ hooks:
12
+ - id: end-of-file-fixer
13
+ - id: trailing-whitespace
14
+ exclude: ^.github/
15
+
16
+ - repo: https://github.com/pycqa/isort
17
+ rev: 5.13.2
18
+ hooks:
19
+ - id: isort
20
+ exclude: ^.github/
21
+
22
+ - repo: https://github.com/psf/black
23
+ rev: 24.2.0
24
+ hooks:
25
+ - id: black
26
+ exclude: ^.github/
27
+
28
+ - repo: https://github.com/executablebooks/mdformat
29
+ rev: 0.7.17
30
+ hooks:
31
+ - id: mdformat
32
+ args: ["--wrap", "79"]
33
+ exclude: ^doc/
34
+ additional_dependencies:
35
+ - mdformat-gfm
@@ -0,0 +1,14 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: "ubuntu-20.04"
5
+ tools:
6
+ python: "3.9"
7
+
8
+ sphinx:
9
+ configuration: docs/conf.py
10
+
11
+ python:
12
+ install:
13
+ - method: setuptools
14
+ path: .[doc]
@@ -0,0 +1,5 @@
1
+ # Changes
2
+
3
+ ## v0.1.0
4
+
5
+ - create project
@@ -0,0 +1,31 @@
1
+ # Contributing
2
+
3
+ Thanks for considering a contribution to clingexplaid. ❤️
4
+
5
+ ## How to get help or discuss possible contributions
6
+
7
+ To avoid duplicating issues, please search our [issue tracker][issues] and our
8
+ [mailing list][mailing_list] before filing a new issue.
9
+
10
+ - Open an [issue][new_issue] describing your problem.
11
+ - [Subscribe] to our mailing list on SourceForge.
12
+
13
+ ## How to make a contribution
14
+
15
+ - Fork the [clingexplaid][project_url] repository and create a branch for your
16
+ changes.
17
+ - Submit a pull request to the master branch with your changes.
18
+ - Respond to feedback on your pull request.
19
+ - If everything is fine your pull request is merged. 🥳
20
+
21
+ ## License
22
+
23
+ When contributing to this project, you agree that you have authored 100% of the
24
+ content, that you have the necessary rights to the content and that the content
25
+ you contribute may be provided under the project license.
26
+
27
+ [issues]: https://github.com/krr-up/clingo-explaidissues/
28
+ [mailing_list]: https://sourceforge.net/p/potassco/mailman/potassco-users/
29
+ [new_issue]: https://github.com/krr-up/clingo-explaidissues/new/
30
+ [project_url]: https://github.com/krr-up/clingo-explaid
31
+ [subscribe]: https://sourceforge.net/projects/potassco/lists/potassco-users/
@@ -0,0 +1,15 @@
1
+ # Deployment
2
+
3
+ Releases are deployed on [pypi] whenever a tag of form `vMajor.Minor.Revision`
4
+ is pushed. Furthermore, the deployment workflow can be triggered manually to
5
+ deploy test releases on [test.pypi].
6
+
7
+ For this to work, the workflow has to be granted permission to deploy on the
8
+ two services. Please follow this packaging [guide] to setup your accounts
9
+ accordingly. We also recommend to setup a github [environment] to restrict
10
+ which contributors can deploy packages.
11
+
12
+ [environment]: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment/
13
+ [guide]: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
14
+ [pypi]: https://pypi.org/
15
+ [test.pypi]: https://test.pypi.org/
@@ -0,0 +1,41 @@
1
+ # Development
2
+
3
+ To improve code quality, we use [nox] to run linters, type checkers, unit
4
+ tests, documentation and more. We recommend installing nox using [pipx] to have
5
+ it available globally.
6
+
7
+ ```bash
8
+ # install
9
+ python -m pip install pipx
10
+ python -m pipx install nox
11
+
12
+ # run all sessions
13
+ nox
14
+
15
+ # list all sessions
16
+ nox -l
17
+
18
+ # run individual session
19
+ nox -s session_name
20
+
21
+ # run individual session (reuse install)
22
+ nox -Rs session_name
23
+ ```
24
+
25
+ Note that the nox sessions create [editable] installs. In case there are
26
+ issues, try recreating environments by dropping the `-R` option. If your
27
+ project is incompatible with editable installs, adjust the `noxfile.py` to
28
+ disable them.
29
+
30
+ We also provide a [pre-commit][pre] config to autoformat code upon commits. It
31
+ can be set up using the following commands:
32
+
33
+ ```bash
34
+ python -m pipx install pre-commit
35
+ pre-commit install
36
+ ```
37
+
38
+ [editable]: https://setuptools.pypa.io/en/latest/userguide/development_mode.html
39
+ [nox]: https://nox.thea.codes/en/stable/index.html
40
+ [pipx]: https://pypa.github.io/pipx/
41
+ [pre]: https://pre-commit.com/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Hannes Weichelt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,244 @@
1
+ Metadata-Version: 2.1
2
+ Name: clingexplaid
3
+ Version: 1.0.9
4
+ Summary: A template project.
5
+ Author-email: Hannes Weichelt <hweichelt@uni-potsdam.de>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 Hannes Weichelt
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/krr-up/clingo-explaid
29
+ Requires-Python: >=3.9
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: clingo>=5.7.1
33
+ Requires-Dist: autoflake
34
+ Provides-Extra: format
35
+ Requires-Dist: black; extra == "format"
36
+ Requires-Dist: isort; extra == "format"
37
+ Requires-Dist: autoflake; extra == "format"
38
+ Provides-Extra: lint-pylint
39
+ Requires-Dist: pylint; extra == "lint-pylint"
40
+ Provides-Extra: typecheck
41
+ Requires-Dist: types-setuptools; extra == "typecheck"
42
+ Requires-Dist: mypy; extra == "typecheck"
43
+ Provides-Extra: test
44
+ Requires-Dist: coverage[toml]; extra == "test"
45
+ Provides-Extra: doc
46
+ Requires-Dist: sphinx; extra == "doc"
47
+ Requires-Dist: furo; extra == "doc"
48
+ Requires-Dist: nbsphinx; extra == "doc"
49
+ Requires-Dist: sphinx_copybutton; extra == "doc"
50
+ Requires-Dist: myst-parser; extra == "doc"
51
+ Provides-Extra: dev
52
+ Requires-Dist: clingexplaid[lint_pylint,test,typecheck]; extra == "dev"
53
+
54
+ # clingexplaid
55
+
56
+ ## Usage
57
+
58
+ Run the following for basic usage information:
59
+
60
+ ```bash
61
+ clingexplaid -h
62
+ ```
63
+
64
+ The clingexplaid CLI (based on the `clingo.Application` class) can be called
65
+ using this generic command.
66
+
67
+ ```bash
68
+ clingexplaid <filenames> <n> <method> <options>
69
+ ```
70
+
71
+ - `<filenames>`: has to be replaced by a list of all files or a single filename
72
+ - `<n>`: defines how many models are computed (Default=`1`, All=`0`)
73
+ - `<method>`: specifies which Clingexplaid method is used (Required)
74
+ - Options:
75
+ - `--muc`:
76
+ - Computes the Minimal Unsatisfiable Cores (MUCs) of the provided
77
+ unsatisfiable program
78
+ - `--unsat-constraints`:
79
+ - Computes the Unsatisfiable Constraints of the unsatisfiable program
80
+ provided.
81
+ - `--show-decisions`:
82
+ - Visualizes the decision process of clasp
83
+ - `<options>`: Additional options for the different methods
84
+ - For `--muc`:
85
+ - `-a`, `--assumption-signature`: limits which facts of the current program
86
+ are converted to choices/assumptions for finding the MUCs (Default: all
87
+ facts are converted)
88
+ - For `--show-decisions`:
89
+ - `--decision-signature`: limits which decisions are shown in the
90
+ visualization (Default: all atom's decisions are shown)
91
+
92
+ ### Examples
93
+
94
+ - A selection of examples can be found [here](examples)
95
+
96
+ ## Development
97
+
98
+ ### Installation
99
+
100
+ To install the project, run
101
+
102
+ ```bash
103
+ pip install .
104
+ ```
105
+
106
+ To improve code quality, we run linters, type checkers, and unit tests. The
107
+ tools can be run using [nox]. We recommend installing nox using [pipx] to have
108
+ it available globally:
109
+
110
+ ```bash
111
+ python -m pip install pipx
112
+ python -m pipx install nox
113
+ nox
114
+ ```
115
+
116
+ You can invoke `nox -s` to run individual sessions. For example, to install
117
+ your package into a virtual environment and run your test suite, invoke:
118
+
119
+ ```bash
120
+ nox -s test
121
+ ```
122
+
123
+ We also provide a nox session that creates an environment for development. The
124
+ project is installed in [editable] mode into this environment along with
125
+ linting, type checking and formatting tools. Activating it allows your editor
126
+ of choice to access these tools for, e.g., linting and autocompletion. To
127
+ create and then activate virtual environment run:
128
+
129
+ ```bash
130
+ nox -s dev
131
+ source .nox/dev/bin/activate
132
+ ```
133
+
134
+ Furthermore, we provide individual sessions to easily run linting, type
135
+ checking and formatting via nox. These also create editable installs. So you
136
+ can safely skip the recreation of the virtual environment and reinstallation of
137
+ your package in subsequent runs by passing the `-R` command line argument. For
138
+ example, to auto-format your code using [black], run:
139
+
140
+ ```bash
141
+ nox -Rs format -- check
142
+ nox -Rs format
143
+ ```
144
+
145
+ The former command allows you to inspect changes before applying them.
146
+
147
+ Note that editable installs have some caveats. In case there are issues, try
148
+ recreating environments by dropping the `-R` option. If your project is
149
+ incompatible with editable installs, adjust the `noxfile.py` to disable them.
150
+
151
+ We also provide a [pre-commit][pre] config to automate this process. It can be
152
+ set up using the following commands:
153
+
154
+ ```bash
155
+ python -m pipx install pre-commit
156
+ pre-commit install
157
+ ```
158
+
159
+ This blackens the source code whenever `git commit` is used.
160
+
161
+ ## Problems and Limitations
162
+
163
+ ### Meta-encoding based approach (ASP-Approach)
164
+
165
+ **Important Notes:**
166
+
167
+ - The Meta-encoding approach as it stands is not fully functional
168
+
169
+ **Problem:**
170
+
171
+ - In the meta encoding all facts (or a selection matching a certain signature)
172
+ are transformed into assumptions which are then used as the assumption set
173
+ for finding the MUC
174
+ - During the MUC search when subsets of this assumption set are fixed for
175
+ satisfiability checking it is important that even though they are not fixed,
176
+ the other assumptions are not assumed as false but as undefined
177
+ - This is currently not possible with the meta-encoding, since assumptions are
178
+ chosen through a choice rule and all assumptions that aren't selected are
179
+ defaulted to false
180
+ - This doesn't allow for properly checking if such subsets entail
181
+ unsatisfiability and thus prevents us from finding the proper MUCs
182
+
183
+ ### Specifying Assumption Set using only Signatures
184
+
185
+ **Important Notes:**
186
+
187
+ - clingo-explaid provides the `--muc` mode which gives you Minimal
188
+ Unsatisfiable Cores for a given set of assumption signatures that can be
189
+ defined with `-a`
190
+ - These signatures though allow not always for finding the best fitting MUC for
191
+ a given encoding, compared to an assumption set generated by hand
192
+
193
+ **Problem:**
194
+
195
+ - Imagine this [example encoding](examples/misc/bad_mucs.lp):
196
+
197
+ ```MATLAB
198
+ a(1..3).
199
+ :- a(X).
200
+
201
+ unsat.
202
+ :- unsat.
203
+ ```
204
+
205
+ - So when I execute `clingexplaid examples/misc/bad_mucs.lp --muc 0` I get the
206
+ MUCs:
207
+
208
+ ```
209
+ MUC 1
210
+ a(3)
211
+ MUC 2
212
+ a(2)
213
+ MUC 3
214
+ a(1)
215
+ MUC 4
216
+ unsat
217
+ ```
218
+
219
+ - So you would generally expect that executing
220
+ `clingexplaid examples/misc/bad_mucs.lp --muc 0 -a/1` would return the first
221
+ 3 found MUCs from before
222
+ - But what actually happens is that there are no MUCs detected:
223
+
224
+ ```
225
+ NO MUCS CONTAINED: The unsatisfiability of this program is not induced by the provided assumptions
226
+ UNSATISFIABLE
227
+ ```
228
+
229
+ - This is actually due to an implicit `(unsat, False)` in the first 3 MUCs that
230
+ isn't printed
231
+ - Since the standard mode of `--muc` converts all facts to choices when no `-a`
232
+ is provided `a(1)`, `a(2)`, `a(3)`, and `unsat` are all converted to choices
233
+ - We know that for the program to become satisfiable `unsat` cannot be true
234
+ (line 4)
235
+ - But since it is provided as a fact the choice rule conversion is necessary
236
+ for the iterative deletion algorithm to find any MUCs
237
+ - This holds vice versa for the last MUC 4 just so that all `a/1` need to be
238
+ converted to choice rules for the MUC to be found
239
+
240
+ [black]: https://black.readthedocs.io/en/stable/
241
+ [editable]: https://setuptools.pypa.io/en/latest/userguide/development_mode.html
242
+ [nox]: https://nox.thea.codes/en/stable/index.html
243
+ [pipx]: https://pypa.github.io/pipx/
244
+ [pre]: https://pre-commit.com/