Skip to content

Commit

Permalink
Fix minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulaGarciaJimenez committed Oct 29, 2024
1 parent d4da18d commit 2531f0f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions flamapy/metamodels/bdd_metamodel/models/bdd_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ def bdd_file(self, dddmp_file: str) -> None:
self._temporal_bdd_file = False

def __del__(self) -> None:
if self._bdd_file is not None and self._temporal_bdd_file:
Path(self._bdd_file).unlink()
pass
#if self._bdd_file is not None and self._temporal_bdd_file:
# Path(self._bdd_file).unlink()

def _set_global_constants(self) -> None:
"""Private auxiliary function that configures the following global constants.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def feature_inclusion_probability(bdd_model: BDDModel,
probabilities = {}
for line in line_iterator:
parsed_line = re.compile(r'\s+').split(line.strip())
print(f'Feature: {parsed_line[0]}')
original_feature_name = bdd_model.features_names.get(parsed_line[0])
probabilities[original_feature_name] = round(float(parsed_line[1]), precision)
return probabilities
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def transform(self) -> BDDModel:
) as file:
SPLOTWriter(path=file.name, source_model=self.source_model).transform()
bdd_model = SPLOTReader(file.name).transform()
print(f'here is my BDD: {bdd_model}')
bdd_model.variables = [f.name for f in self.source_model.get_features()]
bdd_model.features_names = {f.name.replace(' ', ''): f.name
for f in self.source_model.get_features()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ def build_bdd(model_file: str, bdd_model: BDDModel) -> None:
raise FlamaException(message) from exc

# Run binary logic2bdd's execution
#print("Synthesizing the BDD (this may take a while)...")
print("Synthesizing the BDD (this may take a while)...")
bdd_model.run(BDDModel.LOGIC2BDD, file_name)
print("Synthesizing of the BDD finished.")
# Check that logic2bdd's execution was successful
try:
bdd_model.check_file_existence(file_name, "dddmp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def fm_to_splot(model: FeatureModel) -> str:
lines.extend(add_features(model.root, 1))
lines.append('</feature_tree>')
lines.append('<constraints>')
lines.extend(add_constraints(model.ctcs))
lines.extend(add_constraints(model.get_logical_constraints()))
lines.append('</constraints>')
lines.append('</feature_model>')
return '\n'.join(lines)
Expand Down

0 comments on commit 2531f0f

Please sign in to comment.