flamapy-z3 2.6.0.dev12__tar.gz → 2.9.0.dev0__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.
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/PKG-INFO +5 -3
- flamapy_z3-2.9.0.dev0/flamapy/metamodels/z3_metamodel/__init__.py +36 -0
- flamapy_z3-2.9.0.dev0/flamapy/metamodels/z3_metamodel/operations/z3_backbone.py +53 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy_z3.egg-info/PKG-INFO +5 -3
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy_z3.egg-info/SOURCES.txt +2 -0
- flamapy_z3-2.9.0.dev0/flamapy_z3.egg-info/entry_points.txt +2 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy_z3.egg-info/requires.txt +5 -2
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/pyproject.toml +11 -3
- flamapy_z3-2.9.0.dev0/tests/test_z3_backbone.py +57 -0
- flamapy_z3-2.6.0.dev12/flamapy/metamodels/z3_metamodel/__init__.py +0 -0
- flamapy_z3-2.6.0.dev12/flamapy/metamodels/z3_metamodel/operations/z3_backbone.py +0 -70
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/README.md +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/models/__init__.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/models/z3_model.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/__init__.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/interfaces/__init__.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/interfaces/attribute_optimization.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_all_feature_bounds.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_attribute_optimization.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_configurations.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_configurations_number.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_core_features.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_dead_features.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_false_optional_features.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_feature_bounds.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_satisfiable.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_satisfiable_configuration.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/operations/z3_variable_bounds_complex.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/transformations/__init__.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/transformations/fm_to_z3.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy_z3.egg-info/dependency_links.txt +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy_z3.egg-info/top_level.txt +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/setup.cfg +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/setup.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/tests/test_tseytin.py +0 -0
- {flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/tests/test_z3_metamodel.py +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flamapy-z3
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.0.dev0
|
|
4
4
|
Summary: z3-plugin for the automated analysis of feature models
|
|
5
5
|
Author-email: Flamapy <flamapy@us.es>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
7
7
|
Project-URL: Homepage, https://github.com/flamapy/z3_metamodel
|
|
8
8
|
Requires-Python: >=3.11
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
|
-
Requires-Dist: flamapy-fw~=2.
|
|
11
|
-
Requires-Dist: flamapy-fm~=2.
|
|
10
|
+
Requires-Dist: flamapy-fw~=2.9.0.dev0
|
|
11
|
+
Requires-Dist: flamapy-fm~=2.9.0.dev0
|
|
12
12
|
Requires-Dist: z3-solver~=4.14.1.0
|
|
13
13
|
Provides-Extra: dev
|
|
14
14
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -16,6 +16,8 @@ Requires-Dist: pytest-mock; extra == "dev"
|
|
|
16
16
|
Requires-Dist: prospector; extra == "dev"
|
|
17
17
|
Requires-Dist: mypy; extra == "dev"
|
|
18
18
|
Requires-Dist: coverage; extra == "dev"
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest; extra == "test"
|
|
19
21
|
|
|
20
22
|
# flamapy-z3
|
|
21
23
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from flamapy.core.manifest import OperationCapability, PluginManifest
|
|
2
|
+
from flamapy.core.models.language_level import LanguageLevel, MajorLevel, MinorLevel
|
|
3
|
+
|
|
4
|
+
# The SMT backend for typed/attributed feature models (TYPE major level). Costs are estimated
|
|
5
|
+
# milliseconds from the 2026-11-06 calibration (betty synthetic models at 1% and 30% constraint
|
|
6
|
+
# density, 20-10,000 features, plus JHipster and busybox; worst case, never decreasing): building
|
|
7
|
+
# the solver and the satisfiability/implication queries scale to 10,000 features, false-optional
|
|
8
|
+
# detection reaches 11 s there, and listing or counting configurations enumerates the models one
|
|
9
|
+
# by one (0.9 s already on the 20-feature calibration model).
|
|
10
|
+
_IMPLICATION_QUERIES = ((100, 1), (200, 3), (500, 9), (1000, 20), (5000, 41), (10000, 100))
|
|
11
|
+
_SAT_QUERY = ((200, 1), (500, 4), (1000, 6), (2000, 16), (10000, 40))
|
|
12
|
+
|
|
13
|
+
MANIFEST = PluginManifest(
|
|
14
|
+
name='z3',
|
|
15
|
+
calibration='2026-11-06',
|
|
16
|
+
extension='z3',
|
|
17
|
+
supported_level=LanguageLevel(MajorLevel.TYPE, {
|
|
18
|
+
MinorLevel.STRING_CONSTRAINTS, MinorLevel.AGGREGATE_FUNCTION,
|
|
19
|
+
MinorLevel.GROUP_CARDINALITY}),
|
|
20
|
+
transformation_cost_curve=((1000, 54), (2000, 88), (5000, 120), (10000, 250)),
|
|
21
|
+
operations={
|
|
22
|
+
'satisfiable': OperationCapability(cost_curve=_SAT_QUERY),
|
|
23
|
+
'satisfiable_configuration': OperationCapability(cost_curve=_SAT_QUERY),
|
|
24
|
+
'core_features': OperationCapability(cost_curve=_IMPLICATION_QUERIES),
|
|
25
|
+
'dead_features': OperationCapability(cost_curve=_IMPLICATION_QUERIES),
|
|
26
|
+
'false_optional_features': OperationCapability(
|
|
27
|
+
cost_curve=((50, 2), (100, 3), (200, 8), (500, 29), (1000, 100), (2000, 420),
|
|
28
|
+
(5000, 2100), (10000, 11000))),
|
|
29
|
+
'configurations_number': OperationCapability(max_features=30, cost=900),
|
|
30
|
+
'configurations': OperationCapability(max_features=30, cost=900),
|
|
31
|
+
'feature_bounds': OperationCapability(),
|
|
32
|
+
'all_feature_bounds': OperationCapability(),
|
|
33
|
+
# Single- and multi-objective (Pareto) optimization over typed attributes.
|
|
34
|
+
'attribute_optimization': OperationCapability(),
|
|
35
|
+
},
|
|
36
|
+
)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from typing import Any, cast
|
|
2
|
+
|
|
3
|
+
import z3
|
|
4
|
+
|
|
5
|
+
from flamapy.core.models import VariabilityModel
|
|
6
|
+
from flamapy.core.operations import Operation
|
|
7
|
+
from flamapy.metamodels.z3_metamodel.models import Z3Model
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Z3Backbone(Operation):
|
|
11
|
+
|
|
12
|
+
def __init__(self) -> None:
|
|
13
|
+
self._result: dict[str, list[Any]] = {"core": [], "dead": []}
|
|
14
|
+
|
|
15
|
+
def get_backbone(self) -> dict[str, list[Any]]:
|
|
16
|
+
return self.get_result()
|
|
17
|
+
|
|
18
|
+
def get_result(self) -> dict[str, list[Any]]:
|
|
19
|
+
return self._result
|
|
20
|
+
|
|
21
|
+
def execute(self, model: VariabilityModel) -> 'Z3Backbone':
|
|
22
|
+
z3_model = cast(Z3Model, model)
|
|
23
|
+
self._result = get_backbone(z3_model)
|
|
24
|
+
return self
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_backbone(model: Z3Model) -> dict[str, list[Any]]:
|
|
28
|
+
"""Core and dead features: the literals over the selection variables that the model implies.
|
|
29
|
+
|
|
30
|
+
`Solver.consequences` computes every implied literal among the given variables in one call,
|
|
31
|
+
inside the solver (models prune the candidates and unsatisfiable cores prove the rest), so no
|
|
32
|
+
per-feature check is needed. It also works on typed models, where the implications may
|
|
33
|
+
depend on the arithmetic and string constraints. An unsatisfiable model has no core
|
|
34
|
+
features and every feature dead, as in the SAT plugin.
|
|
35
|
+
"""
|
|
36
|
+
solver = z3.Solver(ctx=model.ctx)
|
|
37
|
+
solver.add(model.constraints)
|
|
38
|
+
selections = [info.sel for info in model.features.values()]
|
|
39
|
+
names = {info.sel.get_id(): name for name, info in model.features.items()}
|
|
40
|
+
status, implied = solver.consequences([], selections)
|
|
41
|
+
if status != z3.sat:
|
|
42
|
+
return {"core": [], "dead": list(model.features.keys())}
|
|
43
|
+
core: list[Any] = []
|
|
44
|
+
dead: list[Any] = []
|
|
45
|
+
for consequence in implied: # each one is Implies(And(<assumptions>), literal)
|
|
46
|
+
literal = consequence.arg(1)
|
|
47
|
+
if z3.is_not(literal):
|
|
48
|
+
dead.append(names[literal.arg(0).get_id()])
|
|
49
|
+
else:
|
|
50
|
+
core.append(names[literal.get_id()])
|
|
51
|
+
order = {name: index for index, name in enumerate(model.features)}
|
|
52
|
+
return {"core": sorted(core, key=order.__getitem__),
|
|
53
|
+
"dead": sorted(dead, key=order.__getitem__)}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flamapy-z3
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.0.dev0
|
|
4
4
|
Summary: z3-plugin for the automated analysis of feature models
|
|
5
5
|
Author-email: Flamapy <flamapy@us.es>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
7
7
|
Project-URL: Homepage, https://github.com/flamapy/z3_metamodel
|
|
8
8
|
Requires-Python: >=3.11
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
|
-
Requires-Dist: flamapy-fw~=2.
|
|
11
|
-
Requires-Dist: flamapy-fm~=2.
|
|
10
|
+
Requires-Dist: flamapy-fw~=2.9.0.dev0
|
|
11
|
+
Requires-Dist: flamapy-fm~=2.9.0.dev0
|
|
12
12
|
Requires-Dist: z3-solver~=4.14.1.0
|
|
13
13
|
Provides-Extra: dev
|
|
14
14
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -16,6 +16,8 @@ Requires-Dist: pytest-mock; extra == "dev"
|
|
|
16
16
|
Requires-Dist: prospector; extra == "dev"
|
|
17
17
|
Requires-Dist: mypy; extra == "dev"
|
|
18
18
|
Requires-Dist: coverage; extra == "dev"
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest; extra == "test"
|
|
19
21
|
|
|
20
22
|
# flamapy-z3
|
|
21
23
|
|
|
@@ -24,7 +24,9 @@ flamapy/metamodels/z3_metamodel/transformations/fm_to_z3.py
|
|
|
24
24
|
flamapy_z3.egg-info/PKG-INFO
|
|
25
25
|
flamapy_z3.egg-info/SOURCES.txt
|
|
26
26
|
flamapy_z3.egg-info/dependency_links.txt
|
|
27
|
+
flamapy_z3.egg-info/entry_points.txt
|
|
27
28
|
flamapy_z3.egg-info/requires.txt
|
|
28
29
|
flamapy_z3.egg-info/top_level.txt
|
|
29
30
|
tests/test_tseytin.py
|
|
31
|
+
tests/test_z3_backbone.py
|
|
30
32
|
tests/test_z3_metamodel.py
|
|
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "flamapy-z3"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.9.0.dev0"
|
|
8
8
|
description = "z3-plugin for the automated analysis of feature models"
|
|
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.
|
|
15
|
-
"flamapy-fm~=2.
|
|
14
|
+
"flamapy-fw~=2.9.0.dev0",
|
|
15
|
+
"flamapy-fm~=2.9.0.dev0",
|
|
16
16
|
"z3-solver~=4.14.1.0",
|
|
17
17
|
]
|
|
18
18
|
|
|
@@ -25,6 +25,14 @@ dev = [
|
|
|
25
25
|
"coverage",
|
|
26
26
|
]
|
|
27
27
|
|
|
28
|
+
# The suite needs no sibling plugin beyond flamapy-fm.
|
|
29
|
+
test = [
|
|
30
|
+
"pytest",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.entry-points."flamapy.plugins"]
|
|
34
|
+
z3 = "flamapy.metamodels.z3_metamodel"
|
|
35
|
+
|
|
28
36
|
[project.urls]
|
|
29
37
|
Homepage = "https://github.com/flamapy/z3_metamodel"
|
|
30
38
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Backbone (core and dead features) through z3's consequences API, on Boolean and typed models.
|
|
2
|
+
|
|
3
|
+
The expected values were produced by the previous implementation (one check per candidate
|
|
4
|
+
literal) and cross-checked by hand on the small models.
|
|
5
|
+
"""
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
from flamapy.metamodels.fm_metamodel.transformations import UVLReader
|
|
9
|
+
from flamapy.metamodels.z3_metamodel.transformations import FmToZ3
|
|
10
|
+
from flamapy.metamodels.z3_metamodel.operations import (
|
|
11
|
+
Z3Backbone,
|
|
12
|
+
Z3CoreFeatures,
|
|
13
|
+
Z3DeadFeatures,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
MODELS = 'resources/models/uvl_models/'
|
|
18
|
+
|
|
19
|
+
ELECTRICITY_CORE = ['DATE', 'DAY', 'DAY_NAME', 'DEMAND', 'Electricity_price', 'INFORMATION_TYPE',
|
|
20
|
+
'MONTH', 'Period', 'USEP', 'YEAR']
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@pytest.mark.parametrize('path, core, dead', [
|
|
24
|
+
(MODELS + 'Electricity.uvl', ELECTRICITY_CORE, []),
|
|
25
|
+
(MODELS + 'Electricity_with_deadfeature.uvl', ELECTRICITY_CORE, ['ok']),
|
|
26
|
+
(MODELS + 'Electricity_with_no_deadfeature.uvl', [*ELECTRICITY_CORE, 'ok'], []),
|
|
27
|
+
(MODELS + 'Pizza_z3.uvl',
|
|
28
|
+
['Dough', 'Normal', 'Pizza', 'Size', 'SpicyLvl', 'Topping'], ['Big', 'Name']),
|
|
29
|
+
(MODELS + 'fm03_integer_conditional_bounded.uvl', ['Container', 'Icecream', 'Scoops'], ['Stick']),
|
|
30
|
+
(MODELS + 'fm04_integer_dead_feature.uvl', ['Container', 'Icecream'], ['Scoops']),
|
|
31
|
+
(MODELS + 'fm13_feature_cardinality_bounded_refactored.uvl', ['R'], ['D']),
|
|
32
|
+
(MODELS + 'numerical_core_feature.uvl', ['Electricity_price', 'Period', 'ok'], []),
|
|
33
|
+
(MODELS + 'group_cardinalities.uvl', ['root'], []),
|
|
34
|
+
(MODELS + 'mutex.uvl', ['root'], []),
|
|
35
|
+
])
|
|
36
|
+
def test_backbone(path: str, core: list, dead: list):
|
|
37
|
+
z3_model = FmToZ3(UVLReader(path).transform()).transform()
|
|
38
|
+
backbone = Z3Backbone().execute(z3_model).get_result()
|
|
39
|
+
assert sorted(backbone['core']) == sorted(core)
|
|
40
|
+
assert sorted(backbone['dead']) == sorted(dead)
|
|
41
|
+
assert Z3CoreFeatures().execute(z3_model).get_result() == backbone['core']
|
|
42
|
+
assert Z3DeadFeatures().execute(z3_model).get_result() == backbone['dead']
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_backbone_follows_the_feature_order():
|
|
46
|
+
z3_model = FmToZ3(UVLReader(MODELS + 'Pizza_z3.uvl').transform()).transform()
|
|
47
|
+
order = list(z3_model.features)
|
|
48
|
+
backbone = Z3Backbone().execute(z3_model).get_result()
|
|
49
|
+
assert backbone['core'] == sorted(backbone['core'], key=order.index)
|
|
50
|
+
assert backbone['dead'] == sorted(backbone['dead'], key=order.index)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_void_model_has_no_core_and_every_feature_dead():
|
|
54
|
+
z3_model = FmToZ3(UVLReader(MODELS + 'Electricity_unsat.uvl').transform()).transform()
|
|
55
|
+
backbone = Z3Backbone().execute(z3_model).get_result()
|
|
56
|
+
assert backbone['core'] == []
|
|
57
|
+
assert backbone['dead'] == list(z3_model.features)
|
|
File without changes
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
from typing import Any, cast
|
|
2
|
-
|
|
3
|
-
import z3
|
|
4
|
-
|
|
5
|
-
from flamapy.core.models import VariabilityModel
|
|
6
|
-
from flamapy.core.operations import Operation
|
|
7
|
-
from flamapy.metamodels.z3_metamodel.models import Z3Model
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Z3Backbone(Operation):
|
|
11
|
-
|
|
12
|
-
def __init__(self) -> None:
|
|
13
|
-
self._result: dict[str, list[Any]] = {"core": [], "dead": []}
|
|
14
|
-
|
|
15
|
-
def get_backbone(self) -> dict[str, list[Any]]:
|
|
16
|
-
return self.get_result()
|
|
17
|
-
|
|
18
|
-
def get_result(self) -> dict[str, list[Any]]:
|
|
19
|
-
return self._result
|
|
20
|
-
|
|
21
|
-
def execute(self, model: VariabilityModel) -> 'Z3Backbone':
|
|
22
|
-
z3_model = cast(Z3Model, model)
|
|
23
|
-
self._result = get_backbone(z3_model)
|
|
24
|
-
return self
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def get_backbone(model: Z3Model) -> dict[str, list[Any]]:
|
|
28
|
-
solver = z3.Solver(ctx=model.ctx)
|
|
29
|
-
solver.add(model.constraints)
|
|
30
|
-
|
|
31
|
-
vars_to_features = {f_info.sel: name for name, f_info in model.features.items()}
|
|
32
|
-
|
|
33
|
-
# (out, C) <- SAT(phi)
|
|
34
|
-
if solver.check() != z3.sat:
|
|
35
|
-
return {"core": [], "dead": list(model.features.keys())}
|
|
36
|
-
|
|
37
|
-
m = solver.model()
|
|
38
|
-
# C <- filter(C)
|
|
39
|
-
core_candidates = {var for var in vars_to_features.keys() if z3.is_true(m[var])}
|
|
40
|
-
dead_candidates = {var for var in vars_to_features.keys() if z3.is_false(m[var])}
|
|
41
|
-
|
|
42
|
-
backbone_core = []
|
|
43
|
-
backbone_dead = []
|
|
44
|
-
|
|
45
|
-
while core_candidates or dead_candidates:
|
|
46
|
-
if core_candidates:
|
|
47
|
-
literal = next(iter(core_candidates))
|
|
48
|
-
check_lit = z3.Not(literal)
|
|
49
|
-
is_core = True
|
|
50
|
-
else:
|
|
51
|
-
literal = next(iter(dead_candidates))
|
|
52
|
-
check_lit = literal
|
|
53
|
-
is_core = False
|
|
54
|
-
|
|
55
|
-
# (out, S) <- SAT(phi U {not l})
|
|
56
|
-
if solver.check([check_lit]) == z3.unsat:
|
|
57
|
-
if is_core:
|
|
58
|
-
backbone_core.append(vars_to_features[literal])
|
|
59
|
-
solver.add(literal)
|
|
60
|
-
core_candidates.remove(literal)
|
|
61
|
-
else:
|
|
62
|
-
backbone_dead.append(vars_to_features[literal])
|
|
63
|
-
solver.add(z3.Not(literal))
|
|
64
|
-
dead_candidates.remove(literal)
|
|
65
|
-
else:
|
|
66
|
-
new_model = solver.model()
|
|
67
|
-
core_candidates = {var for var in core_candidates if z3.is_true(new_model[var])}
|
|
68
|
-
dead_candidates = {var for var in dead_candidates if z3.is_false(new_model[var])}
|
|
69
|
-
|
|
70
|
-
return {"core": backbone_core, "dead": backbone_dead}
|
|
File without changes
|
{flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/models/__init__.py
RENAMED
|
File without changes
|
{flamapy_z3-2.6.0.dev12 → flamapy_z3-2.9.0.dev0}/flamapy/metamodels/z3_metamodel/models/z3_model.py
RENAMED
|
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
|
|
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
|
|
File without changes
|