flamapy-sharpsat 2.6.0.dev5__tar.gz → 2.6.0.dev11__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 (22) hide show
  1. {flamapy_sharpsat-2.6.0.dev5/flamapy_sharpsat.egg-info → flamapy_sharpsat-2.6.0.dev11}/PKG-INFO +3 -4
  2. flamapy_sharpsat-2.6.0.dev11/flamapy/metamodels/sharpsat_metamodel/transformations/fm_to_sharpsat.py +35 -0
  3. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11/flamapy_sharpsat.egg-info}/PKG-INFO +3 -4
  4. flamapy_sharpsat-2.6.0.dev11/flamapy_sharpsat.egg-info/requires.txt +10 -0
  5. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/pyproject.toml +3 -4
  6. flamapy_sharpsat-2.6.0.dev5/flamapy/metamodels/sharpsat_metamodel/transformations/fm_to_sharpsat.py +0 -41
  7. flamapy_sharpsat-2.6.0.dev5/flamapy_sharpsat.egg-info/requires.txt +0 -11
  8. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/LICENSE +0 -0
  9. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/README.md +0 -0
  10. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/flamapy/metamodels/sharpsat_metamodel/__init__.py +0 -0
  11. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/flamapy/metamodels/sharpsat_metamodel/models/__init__.py +0 -0
  12. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/flamapy/metamodels/sharpsat_metamodel/models/sharpsat_model.py +0 -0
  13. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/flamapy/metamodels/sharpsat_metamodel/operations/__init__.py +0 -0
  14. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/flamapy/metamodels/sharpsat_metamodel/operations/sharpsat_configurations_number.py +0 -0
  15. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/flamapy/metamodels/sharpsat_metamodel/operations/sharpsat_sampling.py +0 -0
  16. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/flamapy/metamodels/sharpsat_metamodel/transformations/__init__.py +0 -0
  17. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/flamapy_sharpsat.egg-info/SOURCES.txt +0 -0
  18. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/flamapy_sharpsat.egg-info/dependency_links.txt +0 -0
  19. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/flamapy_sharpsat.egg-info/top_level.txt +0 -0
  20. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/setup.cfg +0 -0
  21. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/setup.py +0 -0
  22. {flamapy_sharpsat-2.6.0.dev5 → flamapy_sharpsat-2.6.0.dev11}/tests/test_sharpsat.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flamapy-sharpsat
3
- Version: 2.6.0.dev5
3
+ Version: 2.6.0.dev11
4
4
  Summary: flamapy-sharpsat is a plugin to flamapy providing approximate model counting and almost-uniform sampling
5
5
  Author-email: Flamapy <flamapy@us.es>
6
6
  License-Expression: GPL-3.0-or-later
@@ -8,9 +8,8 @@ Project-URL: Homepage, https://github.com/flamapy/sharpsat_metamodel
8
8
  Requires-Python: >=3.11
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
- Requires-Dist: flamapy-fw~=2.6.0.dev5
12
- Requires-Dist: flamapy-fm~=2.6.0.dev5
13
- Requires-Dist: flamapy-sat~=2.6.0.dev5
11
+ Requires-Dist: flamapy-fw~=2.6.0.dev11
12
+ Requires-Dist: flamapy-fm~=2.6.0.dev11
14
13
  Requires-Dist: pyunigen~=2.5
15
14
  Provides-Extra: dev
16
15
  Requires-Dist: pytest; extra == "dev"
@@ -0,0 +1,35 @@
1
+ from flamapy.core.transformations import ModelToModel
2
+ from flamapy.metamodels.fm_metamodel.models import FeatureModel, ClauseSet
3
+ from flamapy.metamodels.sharpsat_metamodel.models import SharpSATModel
4
+
5
+
6
+ class FmToSharpSAT(ModelToModel):
7
+ """Transform a feature model into a SharpSAT (CNF) model.
8
+
9
+ The CNF is produced by the feature-model ``ClauseSet`` (no SAT-solver dependency), so the
10
+ same constraint encoding (and the optional Tseytin encoding via ``cnf_method``) is available
11
+ here.
12
+ """
13
+
14
+ @staticmethod
15
+ def get_source_extension() -> str:
16
+ return 'fm'
17
+
18
+ @staticmethod
19
+ def get_destination_extension() -> str:
20
+ return 'sharpsat'
21
+
22
+ def __init__(self, source_model: FeatureModel, cnf_method: str = 'distributive') -> None:
23
+ self.source_model = source_model
24
+ self.cnf_method = cnf_method
25
+ self.destination_model = SharpSATModel()
26
+
27
+ def transform(self) -> SharpSATModel:
28
+ clause_set = ClauseSet.from_feature_model(self.source_model, cnf_method=self.cnf_method)
29
+ model = self.destination_model
30
+ model.clauses = [list(clause) for clause in clause_set.clauses]
31
+ model.variables = dict(clause_set.variables)
32
+ model.features = dict(clause_set.features)
33
+ model.auxiliary_variables = set(clause_set.auxiliary_variables)
34
+ model.original_model = self.source_model
35
+ return model
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flamapy-sharpsat
3
- Version: 2.6.0.dev5
3
+ Version: 2.6.0.dev11
4
4
  Summary: flamapy-sharpsat is a plugin to flamapy providing approximate model counting and almost-uniform sampling
5
5
  Author-email: Flamapy <flamapy@us.es>
6
6
  License-Expression: GPL-3.0-or-later
@@ -8,9 +8,8 @@ Project-URL: Homepage, https://github.com/flamapy/sharpsat_metamodel
8
8
  Requires-Python: >=3.11
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
- Requires-Dist: flamapy-fw~=2.6.0.dev5
12
- Requires-Dist: flamapy-fm~=2.6.0.dev5
13
- Requires-Dist: flamapy-sat~=2.6.0.dev5
11
+ Requires-Dist: flamapy-fw~=2.6.0.dev11
12
+ Requires-Dist: flamapy-fm~=2.6.0.dev11
14
13
  Requires-Dist: pyunigen~=2.5
15
14
  Provides-Extra: dev
16
15
  Requires-Dist: pytest; extra == "dev"
@@ -0,0 +1,10 @@
1
+ flamapy-fw~=2.6.0.dev11
2
+ flamapy-fm~=2.6.0.dev11
3
+ pyunigen~=2.5
4
+
5
+ [dev]
6
+ pytest
7
+ pytest-mock
8
+ prospector
9
+ mypy
10
+ coverage
@@ -4,16 +4,15 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "flamapy-sharpsat"
7
- version = "2.6.0.dev5"
7
+ version = "2.6.0.dev11"
8
8
  description = "flamapy-sharpsat is a plugin to flamapy providing approximate model counting and almost-uniform sampling"
9
9
  readme = "README.md"
10
10
  license = "GPL-3.0-or-later"
11
11
  authors = [{ name = "Flamapy", email = "flamapy@us.es" }]
12
12
  requires-python = ">=3.11"
13
13
  dependencies = [
14
- "flamapy-fw~=2.6.0.dev5",
15
- "flamapy-fm~=2.6.0.dev5",
16
- "flamapy-sat~=2.6.0.dev5",
14
+ "flamapy-fw~=2.6.0.dev11",
15
+ "flamapy-fm~=2.6.0.dev11",
17
16
  "pyunigen~=2.5",
18
17
  ]
19
18
 
@@ -1,41 +0,0 @@
1
- from flamapy.core.transformations import ModelToModel
2
- from flamapy.metamodels.fm_metamodel.models import FeatureModel
3
- from flamapy.metamodels.pysat_metamodel.transformations import FmToPysat
4
- from flamapy.metamodels.sharpsat_metamodel.models import SharpSATModel
5
-
6
-
7
- class FmToSharpSAT(ModelToModel):
8
- """Transform a feature model into a SharpSAT (CNF) model.
9
-
10
- The CNF is produced by reusing the SAT metamodel's ``FmToPysat`` transformation, so
11
- the same constraint encoding (and the optional Tseytin encoding via ``cnf_method``) is
12
- available here.
13
- """
14
-
15
- @staticmethod
16
- def get_source_extension() -> str:
17
- return 'fm'
18
-
19
- @staticmethod
20
- def get_destination_extension() -> str:
21
- return 'sharpsat'
22
-
23
- def __init__(self, source_model: FeatureModel, cnf_method: str = 'distributive') -> None:
24
- self.source_model = source_model
25
- self.cnf_method = cnf_method
26
- self.destination_model = SharpSATModel()
27
-
28
- def transform(self) -> SharpSATModel:
29
- # Only pass cnf_method when a non-default encoding is requested, so the plugin also
30
- # works against releases of flamapy-sat that predate the Tseytin cnf_method option.
31
- if self.cnf_method == 'distributive':
32
- sat_model = FmToPysat(self.source_model).transform()
33
- else:
34
- sat_model = FmToPysat(self.source_model, cnf_method=self.cnf_method).transform()
35
- model = self.destination_model
36
- model.clauses = [list(clause) for clause in sat_model.get_all_clauses().clauses]
37
- model.variables = dict(sat_model.variables)
38
- model.features = dict(sat_model.features)
39
- model.auxiliary_variables = set(sat_model.auxiliary_variables)
40
- model.original_model = self.source_model
41
- return model
@@ -1,11 +0,0 @@
1
- flamapy-fw~=2.6.0.dev5
2
- flamapy-fm~=2.6.0.dev5
3
- flamapy-sat~=2.6.0.dev5
4
- pyunigen~=2.5
5
-
6
- [dev]
7
- pytest
8
- pytest-mock
9
- prospector
10
- mypy
11
- coverage