Skip to content

Commit

Permalink
fix: solving prospector errors on colosal bdd and creating version
Browse files Browse the repository at this point in the history
  • Loading branch information
jagalindo committed Jul 28, 2024
1 parent ad45396 commit fa3006d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
20 changes: 13 additions & 7 deletions flamapy/metamodels/bdd_metamodel/models/bdd_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,25 @@ def expand_assignment(bdd_file: str, feature_assignment: list[str]) -> list[str]
# Get all feature names
with open(bdd_file, 'r', encoding='utf8') as file:
bdd_code = file.read()
varnames = re.search('varnames\\s+(.*)', bdd_code).group(1).split()
varnames_match = re.search(r'varnames\s+(.*)', bdd_code)
if not varnames_match:
raise FlamaException('No varnames found in the BDD file.')
varnames = varnames_match.group(1).split()

expanded_assignment = []
for feature in feature_assignment:
feat = None
if re.match('not\\s+', feature):
feat = re.search('not\\s+(.*)', feature).group(1)
if varnames.count(feat) == 0:
raise FlamaException(f'{feat} is not a valid feature of {bdd_file}')
feat += "=false"
if re.match(r'not\s+', feature):
feat_match = re.search(r'not\s+(.*)', feature)
if feat_match:
feat = feat_match.group(1)
if varnames.count(feat) == 0:
raise FlamaException(f'{feat} is not a valid feature of {bdd_file}')
feat += "=false"
else:
if varnames.count(feature) == 0:
raise FlamaException(feature + " is not a valid feature of " + bdd_file)
feat = feature + "=true"
expanded_assignment.append(feat)
if feat:
expanded_assignment.append(feat)
return expanded_assignment
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def configurations_number(bdd_model: BDDModel,
return result


def count(bdd_model: BDDModel, feature_assignment: list[str] = None) -> int:
def count(bdd_model: BDDModel, feature_assignment: Optional[list[str]] = None) -> int:
"""
Computes the number of valid configurations.
:param feature_assignment: a list with a partial or a complete features' assignment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def execute(self, model: VariabilityModel) -> 'BDDFeatureInclusionProbability':

def feature_inclusion_probabilities(bdd_model: BDDModel,
precision: int,
partial_configuration: Optional[Configuration] = None) -> int:
partial_configuration: Optional[Configuration] = None
) -> dict[Any, float]:
"""
Computes the featue inclusion probabilities.
:param feature_assignment: a list with a partial or a complete features' assignment
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
flamapy-fw==2.0.0.dev6
flamapy-fm==2.0.0.dev6
flamapy-fw==2.0.0
flamapy-fm==2.0.0
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def read_requirements(file):
dev_requirements = read_requirements("requirements-dev.txt")

setuptools.setup(
name="flamapy-bdd",
version="2.0.0.uned.dev1",
name="flamapy-bdd-colosal",
version="2.0.0",
author="Flamapy",
author_email="flamapy@us.es",
description="bdd-plugin for the automated analysis of feature models",
Expand Down

0 comments on commit fa3006d

Please sign in to comment.