Skip to content

Commit

Permalink
fix: integrating diagnosis tasks and removing error detection so it i…
Browse files Browse the repository at this point in the history
…s not duplicating code
  • Loading branch information
jagalindo committed Nov 7, 2023
1 parent 9989939 commit 619e7ba
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from .glucose3_abstract_identifier import Glucose3AbstractIdentifier
from .glucose3_conflict import Glucose3Conflict
from .glucose3_diagnosis import Glucose3Diagnosis
from .pysat_abstract_identifier import PySATAbstractIdentifier
from .pysat_conflict import PySATConflict
from .pysat_diagnosis import PySATDiagnosis


__all__ = [
'Glucose3AbstractIdentifier',
'Glucose3Diagnosis',
'Glucose3Conflict'
'PySATAbstractIdentifier',
'PySATDiagnosis',
'PySATConflict'
]
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _execute_hsdag(model: DiagnosisModel, hsdag: HSDAG) -> Tuple[str, str]:
return cs_mess, diag_mess


class Glucose3AbstractIdentifier(Operation):
class PySATAbstractIdentifier(Operation):
"""
An abstract operation for computes conflicts or diagnoses.
Four optional inputs:
Expand Down Expand Up @@ -66,7 +66,7 @@ def set_test_case(self, test_case: Configuration) -> None:
def get_result(self) -> List[str]:
return self.result_messages

def execute(self, model: VariabilityModel) -> 'Glucose3AbstractIdentifier':
def execute(self, model: VariabilityModel) -> 'PySATAbstractIdentifier':
model = cast(DiagnosisModel, model)

checker, labeler = self.prepare_hsdag(model)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from typing import Tuple

from flamapy.metamodels.pysat_diagnosis_metamodel.models import DiagnosisModel
from . import Glucose3AbstractIdentifier
from . import PySATAbstractIdentifier
from .diagnosis.checker import ConsistencyChecker
from .diagnosis.hsdag.hsdag import HSDAG
from .diagnosis.hsdag.labeler.quickxplain_labeler import QuickXPlainParameters, QuickXPlainLabeler


class Glucose3Conflict(Glucose3AbstractIdentifier):
class PySATConflict(PySATAbstractIdentifier):
"""
An operation that computes conflicts and diagnoses
using the combination of HSDAG and QuickXPlain algorithms.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from typing import Tuple

from flamapy.metamodels.pysat_diagnosis_metamodel.models import DiagnosisModel
from . import Glucose3AbstractIdentifier
from . import PySATAbstractIdentifier
from .diagnosis.checker import ConsistencyChecker
from .diagnosis.hsdag.hsdag import HSDAG
from .diagnosis.hsdag.labeler.fastdiag_labeler import FastDiagParameters, FastDiagLabeler


class Glucose3Diagnosis(Glucose3AbstractIdentifier):
class PySAT3Diagnosis(PySATAbstractIdentifier):
"""
An operation that computes diagnoses and conflict sets
using the combination of HSDAG and FastDiag algorithms.
Expand All @@ -29,12 +29,7 @@ def prepare_hsdag(self, model: DiagnosisModel) -> Tuple[ConsistencyChecker, HSDA
# transform model to diagnosis model
model.prepare_diagnosis_task(configuration=self.configuration, test_case=self.test_case)

# print(f'C: {model.get_c()}')
# print(f'B: {model.get_b()}')

set_c = model.get_c()
# if self.configuration is None:
# C.reverse() # reverse the list to get the correct order of diagnosis

checker = ConsistencyChecker(self.solver_name, model.get_kb())
parameters = FastDiagParameters(set_c, [], model.get_b())
Expand Down
2 changes: 0 additions & 2 deletions flamapy/metamodels/pysat_metamodel/operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from .pysat_core_features import PySATCoreFeatures
from .pysat_dead_features import PySATDeadFeatures
from .pysat_false_optional_features import PySATFalseOptionalFeatures
from .pysat_error_detection import PySATErrorDetection
from .pysat_metrics import PySATMetrics

__all__ = [
Expand All @@ -22,5 +21,4 @@
'PySATCoreFeatures',
'PySATDeadFeatures',
'PySATFalseOptionalFeatures',
'PySATErrorDetection',
]

This file was deleted.

0 comments on commit 619e7ba

Please sign in to comment.