FM to PySAT

This transformation converts a feature model into a PySAT representation, enabling advanced SAT-based analysis of the feature model.

The cross-tree constraints are converted to CNF with the encoding given by cnf_method: auto (the default), distributive or tseytin; see CNF encodings. SAT reasons only over Boolean constraints: arithmetic, aggregate and string constraints are left out with a UserWarning, so the results are those of the Boolean part of the model. Use the Z3 plugin for such models.


Code Examples

from flamapy.metamodels.fm_metamodel.transformations.featureide_reader import FeatureIDEReader
from flamapy.metamodels.pysat_metamodel.transformations.fm_to_pysat import FmToPysat

# Load the feature model from a FeatureIDE file
feature_model = FeatureIDEReader('path/to/feature/model.xml').transform()

# Transform the feature model into a PySAT representation
pysat_model = FmToPysat(feature_model).transform()

# Or force one CNF encoding
pysat_model = FmToPysat(feature_model, cnf_method="tseytin").transform()

print(pysat_model)