Diagnosis
Description: Repairs a configuration that is not valid: it finds the minimal diagnoses, the minimal subsets of the configuration’s decisions whose removal makes the rest consistent with the feature model’s constraints (FastDiag). The result is two messages, the diagnoses first and then the conflicts.
Application: Useful for debugging and improving the reliability of feature models by diagnosing issues and suggesting corrective actions.
Example: Diagnosing a feature model of a software application to identify and resolve conflicting constraints or dependencies.
Code Examples
Python easy to use facade usage
from flamapy.interfaces.python.flamapy_feature_model import FLAMAFeatureModel
# Load the feature model
fm = FLAMAFeatureModel("path/to/feature/model")
result = fm.diagnosis("path/to/configuration", "path/to/test_case")
print(result)
Python flamapy framework usage
from flamapy.core.discover import DiscoverMetamodels
# Initialize the discover metamodel
dm = DiscoverMetamodels()
# Diagnosis requires a configuration; pass it with configuration_file.
# Transformations will be automatically executed.
result = dm.use_operation_from_file(
"PySATDiagnosis",
"path/to/feature/model",
configuration_file="path/to/configuration",
)
print(result)
Python flamapy framework ADVANCED usage
from flamapy.core.discover import DiscoverMetamodels
# Initialize the discover metamodel
dm = DiscoverMetamodels()
# Get the fm metamodel representation using the transformation required to get to the fm metamodel
feature_model = dm.use_transformation_t2m("path/to/feature/model", 'fm')
# Manually call a M2M transformation to the diagnosis metamodel
sat_model = dm.use_transformation_m2m(feature_model, "pysat_diagnosis")
# Read the configuration and the test case to diagnose
configuration = dm.use_transformation_t2m("path/to/configuration", "configuration")
test_case = dm.use_transformation_t2m("path/to/test_case", "configuration")
# Get the operation and set the configuration and test case
operation = dm.get_operation(sat_model, 'PySATDiagnosis')
operation.set_configuration(configuration)
operation.set_test_case(test_case)
# Execute the operation
operation.execute(sat_model)
# Get and print the result
result = operation.get_result()
print(result)
Facade signature: diagnosis(self, configuration_path: str, test_case_path: str = None, max_diagnoses: int = None)
Inputs:
| name | type | required | default |
|---|---|---|---|
configuration_path |
str | yes | — |
test_case_path |
str | no | None |
max_diagnoses |
int | no | None |
Default backend: pysat_diagnosis
Implemented by:
| plugin | exact | scale limit |
|---|---|---|
| pysat_diagnosis_metamodel | yes | — |