Improved Algorithms for Deriving All Minimal Conflict Sets in Model-Based Diagnosis Xiangfu Zhao and Dantong Ouyang Key Laboratory of Symbolic Computation and Knowledge Engineering of Ministry of Education, School of Computer Science and Technology, Jilin University, Changchun 130012, China
[email protected]
Abstract. Model-based diagnosis is one of the active branches of Artificial Intellgence. Conflict recognition, aiming at generating all minimal conflict sets (MCSs), and candidate generation, aiming at generating all minimal hitting sets (MHSs), are of the two important steps towards to the final diagnosis results. Firstly an SE-tree based algorithm (CSSE-tree) for deriving all MCSs is given. Then a concept of inverse SE-tree (ISE-tree) is put forward, and an ISE-tree based algorithm (CSISE-tree) for deriving all MCSs is presented as well. Considering the similarity of generation of all MCSs and all MHSs for the collection of all MCSs, a uniform framework for deriving all MCSs and MHSs is proposed, too. Experimental results show that our algorithms have better efficiency than others in some situations. Keywords: model-based diagnosis, conflict set, hitting set, set enumeration tree (SE-tree).
1 Introduction Model-based diagnosis is one of the active branches of Artificial Intelligence [1-3]. Conflict recognition, aiming at generating all MCSs, and candidate generation, aiming at generating all MHSs, are of the two important steps towards to final diagnosis results. de Kleer firstly introduced the important concept of a conflict set [4], which we have appropriated for model-based diagnostic algorithms. Afterwards, he proposed a widely used inference engine ATMS [5]. Algorithms of using theorem prover (TP), such as DART [6], etc., can also be used for conflict recognition. In this paper, we suppose that the inference engine has been given, just like ATMS, TP, etc. As it is an NP-hard problem [7], conflict set recognition must be avoided as possible. How to derive all MCSs? Hou proposed an algorithm named CS-tree [8]. However, the results derived from Hou’s algorithm depend on the order of node generation in CS-trees. As a result, some MCSs would be lost by pruning. And there may be many duplicate redundant nodes in CS-trees. Han improved Hou’s algorithm, proposed an algorithm of an inverse CS-tree and an algorithm of a CS-tree with Mark Set, both of which do not need redundant tests [9], [10]. However, there are many backtracks by an inverse CS-tree, and it is more complex as Mark Set is introduced by a CS-tree D.-S. Huang, L. Heutte, and M. Loog (Eds.): ICIC 2007, LNCS 4681, pp. 157–166, 2007. © Springer-Verlag Berlin Heidelberg 2007
158
X. Zhao and D. Ouyang
with Mark Set. In order to overcome the shortcomings, an SE-tree [11] based algorithm (CSSE-tree) for deriving all MCSs is proposed in this paper. In addition, an inverse SE-tree (ISE-tree) is put forward which can also be used as a universal irredundant subset search algorithm. Moreover, an ISE-tree based algorithm (CSISEtree) for deriving all MCSs is presented. Considering the similarity of generation of all MCSs and all MHSs, a uniform framework for deriving all MCSs and MHSs is discussed accordingly.
2 CSSE-Tree 2.1 Description of the Algorithm The set-enumeration tree (SE-tree) was proposed by Rymon [11]. A complete SE-tree can systemically enumerate all the elements of the power-set by a pre-imposed order, such as the alpha-beta order, numerical order, etc. We propose a concept of CSSEtree based on SE-tree as follows. Definition 1. A CSSE-tree T of an ordered conflict set (CS) S is defined as follows. (1) Each node n of the tree T is composed of a label set Sn, a parent edge label
E pn , and a children edge label set E cn . And the root of the tree T is composed of ST= {}, { E pT } = {},
E cT = S.
(2) For each node n, suppose
∈E
E cn = {e1, e2, …, ek}, then for each ei
from 1 to k), there is a child node
∪
cn
(i is
nei , and S ne = Sn {ei}, E pn = ei, E cn = i
ei
ei
{ei+1, …, ek}. To derive all MCSs of a CS S, we generate a pruned CSSE-tree T by the following procedure. Procedure 1. Deriving all MCSs of an initial ordered CS S by a CSSE-tree T. (1) Generate T width-first, i.e., generate the brothers of a node before generating its descendants. (2) Pruning rules: Invoking CS checker, such as ATMS, TP, etc., from right to left at the same level, i ) If the label set of the node n is a CS, then mark it with “ ”, not to be extended latter. ii) If the label set of the node n is not a CS, then: for (every CS node m generated which is marked with “ ” at n’s right hand) E cn Sn ⊇ Sm-{ E pm }) if ( E pm
√
∈ ∧
√
E cn = E cn -{ E pm }; As a result, all the MCSs of S are all the label sets of the nodes which are marked with “√”. And all the proper supersets of all MCSs have been avoided to be generated by pruning rule ii).
Improved Algorithms for Deriving All MCSs in Model-Based Diagnosis
159
Let’s show the soundness and the completeness of this algorithm. (1) Soundness: We mainly show the soundness of the two pruning rules as follows. On one hand, if the label set of a node is a CS, then all of its children nodes must be proper supersets of it. Therefore, it is marked with “√”, not to be extended latter. On the other hand, if the label set of the node n is not a CS, then for every CS node m
√
generated which is marked with “ ” at n’s right hand, if n can be further extended by child edge label node would be labeled by Sn
∪{ E
labeled by Sn
pm
∪{ E
pm
E pm ∈ E cn , then the node
E pm , and the corresponding new child
}; but if Sn
⊇ Sm-{ E pm }, then the new node
} will be a proper superset of Sm, therefore, we can prune
E pm from E cn , i.e., E cn = E cn - { E pm }, to avoid the generation of the new node. (2) Completeness: As an SE-tree can enumerate all the elements of the power-set by a pre-imposed order, so all the possible sets, each of which is not a proper superset of some MCSs can be generated. All the MCSs will be generated in the end.
Fig. 1. Deriving all MCSs by CSSE-tree (6 nodes always)
Fig. 2. Deriving all MCSs by Han’s inverse CS-tree (8 nodes on average, 7 nodes at least)
160
X. Zhao and D. Ouyang
The complexity of the algorithm is O (2k) in the worst situation, where k is the length of the initial CS S. However, many nodes have been pruned by pruning rules, and hence the complexity is much less than O (2k) in general. 2.2 Example and Result Example 1. Let an initial ordered CS S = {A, B, C, D} and suppose all MCSs we can drive from S are {A} {C} and {B, D}. The procedure of generating all MCSs of S is shown in Fig.1.(a) (b) (c) (d) with 4 different order. And the procedure of generating all MCSs of the same S is shown in Fig.2.(a)(b)(c)(d) by Han’s inverse CS-tree. By comparison of Fig.1 and Fig.2, we can see clearly that:
√
(1) All the MCSs are clearly labeled by “ ”, and each non-minimal CS is never be generated at all, such as {B, C} {B, A} {D, A} in Fig.2 (b), not appear in Fig.1, thus the efficiency of CSSE-tree would be better than the algorithm of inverse CS-tree. (2) The number of nodes of the different styles of CSSE-tree is fixed. And the nodes pruned are all the proper supersets of all MCSs by the pruning rule ii). 2.3 Some Simplification Rules for Some Special Cases For a node n, if there are MCS nodes in its right brothers, then collect all the parent edge labels of them to a set Sr, then E cn can be reduced to E cn - Sr without comparisons between Sn and Sm-{ E pm }, where node m is one of n’s right brothers. It can enhance the efficiency greatly in such situations.
3 CSISE-Tree 3.1 Description of the Algorithm An SE-tree is a tree, where the sets of nodes generated are from shorter to longer, and it can enumerate all subsets of a given set. We can also enumerate the subsets of a set inversely according some order (such as alpha-beta etc.) from longer sets to shorter ones. We call the tree as inverse SE-tree (ISE-tree for short). For example, a full ISEtree of an ordered set S = {A, B, C, D} is shown in Fig.3. We can also generate an inverse CSSE-tree based on an ISE-tree, namely CSISEtree. A definition of CSISE-tree and a pruned CSISE-tree for generating all MCSs are described as follows.
Fig. 3. The ISE-tree of the set {A, B, C, D}
Improved Algorithms for Deriving All MCSs in Model-Based Diagnosis
161
Definition 2. A CSISE-tree TI of an ordered CS S is defined as follows. (1) Each node n of the tree TI is composed of a label set Sn, a parent edge label
E pn , and a children edge label set E cn . And the root of the tree TI is composed of S TI =S, { E pT }={}, EcT =S. I
I
E cn ={e1, e2, …, ek}, then for
(2) For each node n, if |Sn|=1, then stop; else suppose
∈E
each ei
cn
nei , and the corresponding
(i is from 1 to k), there is a child node
parent-child edge is labeled by ei, and
S nei =Sn-{ei}, E pne =ei, E cne ={ei+1, …, ek}. i
i
To derive all MCSs of an ordered CS S, we generate a pruned CSISE-tree by the following procedure. Procedure 2. Deriving all MCSs of an initial CS S by an algorithm of CSISE-tree TI. (1) Generate TI width-first, i.e., generate the brothers of a node before generating its descendants. (2) Pruning rules: From right to left at the same level, i ) if the label set of the node n is not a CS, then mark it with “×”, not to extend it latter. ii ) if the label set of the node n is a CS and E cn ≠{}, then: for (every node m generated which is marked with “×” at n’s right hand) E cn Sn-{ E pm } ⊆ Sm) if ( E pm
∈ ∧
E cn = E cn -{ E pm }; (3) Marking rules: If a label set of a node n is a CS, then mark it with “ ” and delete the mark of its parent node; for (every node m generated which is marked with “√” at n’s top-right hand) if (Sn ⊂ Sm) Delete the mark of node m; After generating a CSISE-tree TI, all MCSs of S are clearly marked with “ ”. Furthermore, all the proper subsets of all non-CSs are avoided by the pruning rule ii). Let’s simply show that the pruning rules and the marking rules are correct as follows. For pruning rule i), when a set is a non-CS, any of its children nodes will be a proper subset of it, thus each will be a non-CS. For pruning rule ii), if a node n has an E cn , which contains E pm , then there will be a child node labeled by Sn-{ E pm },
√
√
but if Sn-{
E pm } ⊆ Sm, then Sn-{ E pm }must be a non-CS, as Sm is a non-CS.
Therefore, we can prune the generation of the node, i.e., let
E cn = E cn -{ E pm }. And
for the marking rules, if Sn of a node n is a CS, then its parent node is not an MCS, and we prune the tree from right to left at the same level, if a node m marked with “ ”
√
162
X. Zhao and D. Ouyang
Fig. 4. Deriving all MCSs by CSISE-tree method (9 nodes always)
Fig. 5. Deriving all MCSs by CS-tree with Mark Set (10 nodes on average, 8nodes at least)
at n’s top-right hand, then all the children nodes of node m must be non-CSs if they exist, but if Sm contains Sn, then Sm will be not minimal, so delete the mark of node m. Just like CSSE-tree, the complexity of CSISE-tree is O(2k) in the worst situation, where k is the length of the initial CS S. However, many nodes have been pruned by pruning rules, and hence the complexity is much less than O(2k) in general.
Improved Algorithms for Deriving All MCSs in Model-Based Diagnosis
163
3.2 Example and Result Example 2. Let a CS S = {A, B, C, D} and suppose all MCSs we can drive from S are {A, B}, {B, C} and {B, D}. The procedure of generating all MCSs of S by CSISE-tree is shown in Fig.4. And the procedure of generating all MCSs of the same S is shown in Fig.5 by Han’s CS-tree with mark set. From Fig.4, we can see that all MCSs of S are clearly marked with “ ”, and none of the proper subsets of the non-CS {A, C, D} are generated in trees. Just like CSSEtree, the number of nodes of the different styles of CSISE-tree is fixed. And the nodes pruned are all the proper subsets of all non-CSs by the pruning rule ii).
√
3.3 Some Simplification Rules for Some Special Cases For a node n, if there are non-CS nodes in its right brothers, then collect all the parent edge labels of them to a set Sr, E cn can be reduced to E cn - Sr without comparisons between Sn-{ E pm } and Sm, where node m is one of n’s right brothers. It can enhance the efficiency greatly in such situations.
4 A Uniform Framework for Deriving All MCSs and All MHSs After all MCSs are generated, the next important step in model-based diagnosis is candidate generation, i.e., to generate all MHSs for the collection of all MCSs. We proposed an algorithm of combing SE-tree to generate all MHSs, named HSSE-tree [12], where an algorithm named IsHS was proposed to judge whether a set is a hitting set by the number of conflict sets corresponding to components. From the generation of all MHSs and the generation of all MCSs, we can see that they are a very similar procedure. The difference is only that the algorithm of judging whether a set is an HS with the algorithm of judging whether a set is a CS. Therefore, all the algorithms of generating all MCSs can be used for generating all MHSs, with the algorithm IsHS replacing the algorithms judging whether a set is a CS, such as ATMS, TP etc. Therefore, we can construct a uniform framework for deriving all MCSs and all MHSs shown in Fig.6, where the generator P can be any algorithm mentioned above.
Fig. 6. A uniform framework for deriving all MCSs and all MHSs
164
X. Zhao and D. Ouyang
And in Fig.6 (a) and (b), the two generators P may be not the same as each other, each of which can be selected from the four algorithms according to a certain situation.
5 Experimental Results All the four algorithms have been implemented in VC++ 6.0. We compared the nodes generated and the time during generating the result. As generating all MHSs and generating all MCSs can be seen as a uniform framework, we use IsHS instead of TP or ATMS to generate all MHSs for the collection of all MCSs in order to show that all the algorithms can be applied to derive all MHSs for a collection of all MCSs. We have 2 group data of MCSs to test (Intel Pentium 4 CPU 2.60GHz , 512 M RAM, Windows XP). One group data are inclined to generate all the MHSs, the length of each of which is shorter. The other group data are inclined to the MHSs, each of which is longer. For example, we let the former group data are like {1, 2, …, k}, {2, 3, …, k + 1}, …, {n, n + 1, …, n + k - 1} (here we let n = 10). The result is shown in Fig.7.(a). The latter group data are like {1, 1 + n}, {2, 2 + n}, ... , {n, 2n}. And the result is shown in Fig.7.(b). From Fig.7.(a), we can see that CSSE-tree and inversed CS-tree are very suitable for generating shorter MHSs, as the depth of the tree is lower. On the other hand, we can see that CSISE-tree and CS-tree with Mark Set are very fit to generating longer MHSs from Fig. 7. (b), the corresponding depth of the tree is also lower as it extends the tree from longer sets to shorter ones.
Fig. 7. (a) All MCSs are like {1, 2, …, k}, {2, 3, …, k+1}, …, {10, 10+1, …, 10+k-1}
Improved Algorithms for Deriving All MCSs in Model-Based Diagnosis
165
Fig. 7. (b) All MCSs are {1, 1+n}, {2, 2+n}, … , {n, 2n}
6 Conclusions In this paper, two algorithms of deriving all MCSs are proposed firstly. By comparison with Han’s algorithms of generating all MCSs, our algorithms have the following improvements. (1) We can avoid all the proper supersets of all MCSs by the algorithm of CSSEtree, whatever the order of the elements of the CS S is. However, the algorithm of inverse CS-tree proposed by Han, can not always eliminate all the proper superset of all MCSs, and the number of nodes pruned is related to the order of elements. (2) Just like (1), we can avoid all the proper subsets of all the maximum non-CSs by the algorithm of CSISE-tree, whatever the order of the elements of the CS S is. However, the algorithm of CS-tree with mark set proposed by Han can not always eliminate all the proper subsets of all the maximum non-CSs, and the number of nodes pruned in different styles of CSISE-trees is related to the order of elements. Finally, a uniform framework for deriving all MCSs and MHSs is proposed. Therefore, we can reuse the module in implementing a practical diagnostic system. Experimental results show that our algorithms have better efficiency in some situations. Acknowledgement. This paper is supported by NSFC Major Research Program 60496321, Basic Theory and Core Techniques of Non Canonical Knowledge;
166
X. Zhao and D. Ouyang
Program for New Century Excellent Talents in University; the Chinese National High Technology Research and Development Plan (Grant No. 2003AA118020); and Jilin Province Science and Technology Development Plan (Grant No. 20060532).
References 1. Kleer, J. D., Kurien, J.: Fundamentals of Model-Based Diagnosis. In Proceedings of the Fifth IFAC Symposium on Fault Detection, Supervision and Safety of Technical Processes (Safeprocess), (2003) 25–36 2. Jiang, Y. , Lin, L.: The Computation of Hitting Sets with Boolean Formulas. Chinese Journal of Computers, 26 (8)(2003) 919–924 3. Ouyang, D., Ouyang, J., Liu, D.: The Research and Development on Model-Based Diagnosis. Acta Scientiarum Naturalium Universitatis Jilinensis (2001) 38–45 4. Kleer, J.D.: Local Methods for Localizing Faults in Electronic Circuits. Cambridge, MA, MIT AI Memo 394 (1976) 5. Kleer, J.D.: An Assumption-Based TMS. Artificial Intelligence, 28 (2) (1986) 127–162 6. Genesereth:The Use of Design Descriptions in Automated Diagnosis. Artificial Intelligence, (24) (1984) 411–436 7. Garey , Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NPCompleteness. Murray Hill, NJ: Bell Labs (1979) 8. Hou, A: A Theory of Measurement in Diagnosis from First Principles. Artificial Intelligence, 65 (2)(1994) 281–328 9. Han, B. , Lee, S.J.: Deriving Minimal Conflict Sets by CS-trees with Mark Set in Diagnosis from First Principles. IEEE Transactions on Systems, Man, and Cybernetics, 29 (2) (1999) 281–286 10. 10.Han,B.: Diagnosis of Combinatorial Digital Circuits from First Principles. Master's Thesis, Institute of Electrical Engineering, National Sun Yat-Sen University, Kaohsiung, Taiwan, 1996. 1st rev, Nov (1997) 11. 11.Rymon, R.: Search Through Systematic Set Enumeration. In Proceedings of the 3rd International Conference on Principles of Knowledge Representation and Reasoning, Cambridge, MA (1992) 539–550 12. 12. Zhao, X. , Ouyang, D.: A Method of Combining SE-Tree to Compute All Minimal Hitting Sets. Progress in Natural Science, 16 (2) (2006) 169–174