Пример #1
0
        public static MicC_Diagnosis FindMinC(ConflictSet conflicts)
        {
            int minc = infinity;

            if (MinC_Utils.isConflictSetEmpty(conflicts) == true)
            {  //1st base case
                return(new MicC_Diagnosis());
            }
            else if (MinC_Utils.containEmptySet(conflicts) == true)
            { //2nd base case
                MicC_Diagnosis infinityDiagnosis = new MicC_Diagnosis();
                infinityDiagnosis.cardinality = infinity;
                return(infinityDiagnosis);
            }
            // Dual Reduce
            MinC_Utils.DualReduce(conflicts);

            // compute conflicts
            Gate        s = MinC_Utils.getMostfrequentlyComp(conflicts);
            ConflictSet conflictsMinusS   = MinC_Utils.ConflictsMinusComponent(conflicts, s);
            ConflictSet conflictsWithoutS = MinC_Utils.ConflictsWithoutComponent(conflicts, s);

            MicC_Diagnosis mincDiagnosisNotContainS = FindMinC(conflictsMinusS);
            MicC_Diagnosis mincDiagnosisContaintS   = FindMinC(conflictsWithoutS);

            mincDiagnosisContaintS.AddCompToDiagnosis(s);
            if (mincDiagnosisContaintS.cardinality <= mincDiagnosisNotContainS.cardinality)
            {
                return(mincDiagnosisContaintS);
            }
            else
            {
                return(mincDiagnosisNotContainS);
            }
        }
Пример #2
0
        private static void FindMinCHelper(ConflictSet conflicts, MicC_Diagnosis mDiagnosis)
        {
            if (mDiagnosis.cardinality >= mincDiagnosis.cardinality || MinC_Utils.containEmptySet(conflicts) == true)
            { //1st & 3rd base case
                return;
            }
            else if (MinC_Utils.isConflictSetEmpty(conflicts) == true)
            {  //2nd base case
                mincDiagnosis = mDiagnosis;
                return;
            }
            // Dual Reduce
            MinC_Utils.DualReduce(conflicts);

            // compute conflicts
            Gate        s = MinC_Utils.getMostfrequentlyComp(conflicts);
            ConflictSet conflictsMinusS   = MinC_Utils.ConflictsMinusComponent(conflicts, s);
            ConflictSet conflictsWithoutS = MinC_Utils.ConflictsWithoutComponent(conflicts, s);

            mDiagnosis.AddCompToDiagnosis(s);
            MicC_Diagnosis diagnosisWithoutS = new MicC_Diagnosis(mDiagnosis);

            FindMinCHelper(conflictsMinusS, diagnosisWithoutS);
            FindMinCHelper(conflictsWithoutS, mDiagnosis);
        }