FM to Z3

This transformation converts a feature model into a Z3 (SMT) model. Unlike the SAT and BDD transformations, it keeps every constraint of the model: typed features (Integer, Real, String), arithmetic and aggregate constraints are translated into Z3 expressions, which is what the Z3 operations reason over.

By default (cnf_method='direct') the constraints are translated straight from their syntax tree. cnf_method='tseytin' applies the Tseytin encoding to the purely propositional constraints (the others keep the direct translation); see CNF encodings.


Code Examples

from flamapy.metamodels.fm_metamodel.transformations import UVLReader
from flamapy.metamodels.z3_metamodel.transformations import FmToZ3

# Load the feature model from a UVL file
feature_model = UVLReader('path/to/feature/model.uvl').transform()

# Transform the feature model into a Z3 model
z3_model = FmToZ3(feature_model).transform()