Abstract:
A method for generating a network to cope with a conditional part or an IF part having a comparison between variable data and a logical sum between comparisons which appear in a Rete network adopted in a production system using the knowledge technology scheme. In association with an intra-node, a candidate node is disposed in another conditional clause referencing a variable, and a data which was previously accepted but which did not satisfy the conditions or a data most likely to pass through the network is stored in the candidate node in advance. For the intra-node in the object processing, the value of the candidate node is loaded for judging the conditions.

Description:
This application is a continuation of application Ser. No. 883,959 filed Jul. 10, 1986, now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     The present invention relates to a system for judging whether or not a plurality of conditions are satisfied, and in particular, to a high-speed rule processing system for processing rules suitable for a forward inference in a knowledge base using knowledge technology. 
     As a method for judging whether or not a plurality of conditions are satisfied, there has been known a method in which a disrimination net is used. For example, Charles L Forgy has proposed, in Rete: A Fast Algorithm for the Many Pattern/Many Object Pattern Match Problem, ARTIFICIAL INTELLIGENCE Vol. 19, No. 1, 1982, 17-37, a system wherein conditions are converted into a network and objects called tokens each including a name of an object and at least a pair of an attribute or an attribute name and an attribute data are supplied to the network so as to compare the objects and patterns, thereby storing the states satisfying the conditions in storage locations associated with the respective nodes of the network. Since the network portions corresponding to the respective condition clauses are related to each other, to compare attribute data between different objects, these objects must be directly linked by use of a branch, and hence conditions become complicated. If the description of conditions includes a lot of &#34;OR&#34; operations selectively linking a plurality of conditions or a lot of compare operations comparing attribute variables between different network portions, there appear such problems that the size of the network exponentially increases, the processing speed is lowered, and the amount of information to be stored in the network is increased at the same time. In other words, these problems are caused by a method for representing a discrimination net in which a network must be directly linked by use of inter-nodes when attribute data is desired to be compared between objects by using variables. Such a system for processing complex conditions at a high speed has long been desired. 
     SUMMARY OF THE INVENTION 
     It is therefore an object of the present invention to provide a method for generating and processing a network in a system judging whether or not a plurality of conditions are satisfied which enables to achieve a high-speed processing of production rules containing complex conditions such as a comparison between attribute variables. 
     Another object of the present invention is to provide a knowledge base system with a pattern/object matching method implementing a network in which a comparison between different objects is linked by use of &#34;OR&#34;. The problems that when the condition part or if part becomes complicated, the size of the network and the amount of the information to be stored therein rapidly increases and the execution speed is lowered at the same time have been found to be caused by that handling of conditional clauses comprising conditions in the network that are not independent. To solve these problems, the conditional clauses must be manipulated independently of each other; however, the conditions are related to each other, and hence the solution cannot be easily obtained. 
     According to the present invention, to overcome these problems, each group of conditional clauses constituting a network is virtually represented as an independent subnetwork and the relationships between the conditional clauses are expressed by use of virtual nodes, namely, candidate nodes and merge nodes, which enables the conditional clauses constituting the conditions to be handled independently of each other. In other words, instructions related to the conditions of objects are not clearly linked by use of inter-nodes; instead, each conditional clause of an object is expressed as an independent subnetwork corresponding to a condition clause in the LHS and a candidate node, CAN-NODE is provided to keep a candidate data item, thereby storing in a memory of the network the resultant states of Matching up to the latest matching for use in judging the current conditions. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The present invention will be apparent from the following detailed description taken in conjunction with the accompanying drawings in which: 
     FIG. 1a is a schematic diagram illustrating an example of a system configuration of an embodiment according to the present invention; 
     FIG. 1b is a flowchart showing a processing flow of the system of FIG. 1a; 
     FIG. 2A is a schematic diagram depicting an example of a method for representing tokens; 
     FIG. 2B is a schematic diagram depicting an example of a method for representing tokens; 
     FIG. 3 is a diagram illustrating an example of a method for representing conditions; 
     FIG. 4 is a schematic diagram showing an example of conditions; 
     FIG. 5 is a diagram depicting an example of a method for converting conditions into a network; 
     FIG. 6 is an explanatory diagram illustrating an actual example of complex rules; 
     FIG. 7 is a diagram showing an example of an operation for converting the rules of FIG. 6 into a network; 
     FIG. 8 is a schematic diagram depicting an example of an operation to link subnets into a condition; 
     FIG. 9 is a diagram illustrating an example of an operation to generate a network from subnetworks; 
     FIG. 10 is a schematic diagram showing an example of a network; 
     FIG. 11 is a diagram illustrating an example of an IF section having complex combinations of conditions; 
     FIG. 12 is a schematic diagram depicting an example in which one of 81 combinations derived from FIG. 11 is described in the IF part; 
     FIG. 13 is a diagram showing a network generated from the conditions of the IF part of FIG. 12; 
     FIG. 14 is a schematic diagram demonstrating a network for effecting the 81 combinations derived from FIG. 11; and 
     FIG. 15 is a diagram of a network generated by use of candidates nodes in place of the 81 combinations of FIG. 11 wherein the network is divided into four subnetworks, which is integrated into the network. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     A description will be given of an embodiment of the present invention with reference to FIGS. 1a-1b. 
     Referring to FIG. 1a, there is shown a system configuration of an embodiment of the present invention. The system comprises a monitor 1 for displaying the matching or unmatching of conditions, namely, the results of comparison between patterns and objects, a computer 2 for computing the matching or unmatching of conditions, and a reader 3 connected to an external unit via a cable for reading objects. 
     FIG. 1b is a flowchart showing a processing flow of the system of FIG. 1a. First, the units of the system and data areas of programs are initialized (step 4) and conditions to be judged, namely, the conditions described in an IF part of the production rules are read from a data file storing the conditions in advance (step 5). The conditions are then converted into a network represented by a tree structure including a plurality of nodes to be sequentially judged Namely, when the complex conditions appear, step 6 converts the conditions into subnetworks which includes virtual nodes and which are independent of each other, and then step 7 integrates the subnetworks into the network so as to enable an efficient matching. 
     From the steps 5-7, a network representing the conditions to be judged is obtained. In the subsequent processing, the conditions are judged to determine whether or not to be matched by use of the obtained network. 
     Step 8 checks the reader 3 to determine whether or not there exists another object to be inputted. If this is the case, steps 9-12 are executed to determine whether or not the conditions are satisfied. When there exists no object to be inputted, the processing is terminated. 
     In the step 9, data of an object is read through the reader 3, and then the data is compared with an element of a pattern defined at the top node or root node of the network (step 10). Since the object is subjected to a compare or judge operation at the next node connected to the current node, it seems that the data of the object flows from the root node of the network to the nodes located downstream thereof. In step 11, the condition matching is effected by use of the network and the information stored therein and the matching result is stored in the network. In step 12, a name of a condition determined to be matched, that is, a name of an executable rule is displayed on the monitor 1. 
     This system is characterized by a method for generating a network incorporated with virtual nodes and the like so as to effectively judge the matching and unmatching of conditions including complex descriptions (steps 6-7) and by a system for determining the matching of conditions by use of the network thus generated by introducing the virtual nodes (step 11). The method for generating and processing the network will be described herebelow. 
     The specific terms used in this context are defined as follows. 
     1. Object data 
     An object data describes the current state of an objective world with respect to an object. As shown in FIG. 2A, the object data comprises an object name 13 and pairs of an attribute (name) 14 and attribute data (value) 15. An actual example of description about a pump A 21 is shown in FIG. 2B wherein the attributes are the model 22, pressure 23, and revolution frequency 24 and the respective data items are M --  U105, 1.5, and 2600. An object is called token and is caused to flow from the root node to the COND-TERM node in the network. 
     2. Condition 
     As shown in FIG. 3, a condition is described in an IF part of the production rules with respect to a state of an objective world. A condition comprises a condition name 31 and a description 30 related to at least a present state. The description 30 about a present state includes an object name 32, an attribute 33, a logical operator 34, and a value 35. A description of a present state is called a conditional clause. A conditional portion may include two or more clauses. 
     An actual example is shown in FIG. 4. A complex condition of FIG. 4 comprises a condition name of pump C revolution frequency abnormality 41 and a conditional clause related to two present states. In a first conditional clause 42, it is declared for the pump C 42 that the model is M --  U105, that the condition is that the pressure is less than 1.5, and that the revolution frequency is x. Symbol &#34;→&#34; 45 indicates substitution and is used to substitute a variable, x enclosed with symbols &lt; and &gt; by a value. In a second conditional clause, the object name 46 is a variable, and hence an object satisfying a condition that the model is M --  U105, the pressure is at least 2.5, and the revolution frequency is less than the variable x is searched and the object name of the resultant object is used to substitute the variable &#34;pump X&#34; 46. 
     That is, the condition of FIG. 4 is satisfied if an object of which the model is M --  U105, the pressure is less than 1.5, and the name is pump C exists and if an object of which the model is M --  U105, the pressure is more than 2.5, and the revolution frequency is less than that of the pump C exists. (The condition can be considered to include two conditions linked by &#34;AND&#34;.) 
     As described above, complex conditions which are independent of each other and which include variables can be described. Moreover, conditional elements linked by &#34;OR&#34; can be contained in a conditional clause. 
     Next, a method for representing conditions by use of a network will be described. The types of nodes in the network include ROOT, FORK, OR --  IN, OR --  OUT, SUB --  ROOT, SUB --  TERM, MERGE, COND --  TERM, INTRA --  A, INTRA --  B, and INTER, furthermore, there is provided a node called CAN --  NODE which is a virtual node used to link associated conditional clauses. 
     If a plurality of conditional clauses in a description of an object, each conditional clause is independently converted into a subnetwork. A subnetwork begins with SUB --  ROOT and ends with SUB --  TERM and includes nodes such as INTRA, INTER, OR --  IN, and OR --  OUT. 
     A subnetwork generated for each conditional clause in a condition is linked by use of a MERGE node and ends with COND --  TERM denoting the matching of the condition. 
     SUB --  ROOT is connected by a ROOT node and thereby forms a network. Meanings of the nodes and the network generating method will be described. 
     Meanings of nodes 
     ROOT: Indicates the root node at the top point of a network. ROOT has n branches, where n=1, 2, . . . . 
     FORK: Is a node having two branches. FORK nodes are necessary to simplify the procedure which integrates two or more subnetworks into a network. Both branches of a FORK node are processed. 
     OR --  IN: Indicates two branches associated with a logical sum. 
     OR --  OUT: Indicates the confluence (termination) of two branches of the logical sum. It is possible that pass results for only one branch while the other branch is not processed. 
     SUB --  ROOT: Indicates a root node of a subnetwork. 
     SUB --  TERM: Indicates the end of a subnetwork. 
     MERGE: Indicates a node for linking the end of subnetwork (FIG. 8). 
     COND --  TERM: Indicates a node for denoting the matching of a condition (FIG. 8, FIG. 10). 
     INTRA --  A: Indicates a node for comparing an attribute data with a constant. 
     INTRA --  B: Indicates a node for comparing an attribute data with another attribute data in an object. 
     INTER: Indicates a node for comparing values of attribute data between objects 
     CAN --  NODE: Indicates a virtual node for comparing attribute data between different objects (FIG. 10, 222). 
     Network Generating Method 
     A method for generating a subnetwork will be described with reference to FIG. 5. 
     A conditional clause 50 is converted into a subnetwork 60 according to the following procedure. 
     1 Node SUB --  ROOT 61 is generated as the root node of the subnetwork. 
     2 If an object name has been described, a special attribute name, $ name is used to convert an object 51 into a node 62, namely, INTRA --  A ($ name=Object A). (See FIG. 5 for details.) 
     3 When comparing attributes 1-3 with constants 1-3, descriptions 52, 54, and 56 are converted into nodes 65, 64, and 67, respectively. 
     4 A node need not be added for AND 55. For a logical sum 53, two branches are provided by use of OR --  IN 63 so that two terms of the logical sum operation are represented by nodes 64 and 65, respectively. The end of the two branches is linked by OR --  OUT 66. 
     5 Finally, SUB --  TERM 68 is assigned to terminate the subnetwork. 
     Next, a conversion method for converting a more complex condition will be described with reference to FIGS. 6-7. 
     In an example of a condition illustrated in FIG. 6, there are included a comparison 72 between attribute data in an object data using variables and comparisons 73, 74, 82, and 94 of attribute data between different object data. When all conditional clauses 70, 80, and 90 are satisfied, the condition of the IF part is satisfied, which is then outputted. The comparison 72 between attribute data in an object is converted into a node INTRA --  B which effects a comparison for Attribute Al=Attribute A2. 
     For the conditional clauses 70 and 90 in which variables are substituted by values for comparisons of items or attribute data between different object data, CAN --  NODE 101 and CAN --  NODE 121 are generated as shown in FIG. 7 (subnetworks 100 and 120) so that the comparisons with the variables are achieved through these CAN --  NODE&#39;s. For example, the description 73 indicates a comparison between the values of the attribute A3 and the variable W. However, W can be executable only after the substitution takes place in the conditional clause 90, that is, the description 73 cannot be immediately executed. In place of the wait imposed by this situation, the attribute A3 is compared with a virtual or candidate value kept in CAN --  NODE 121 generated in the subnetwork 120 converted from the conditional clause 90, thereby obtaining INTER node 103. 
     The procedure above enables the transformation of the conditional clauses into subnetworks which are independent of each other without nodes for referring and comparing data between different conditional clauses. 
     Next, each subnetwork is linked according to the associated condition. 
     The condition of FIG. 6 is converted into three subnetworks or subnets, 100, 110, and 120 as shown in FIG. 7; and Subterms 104, 111, and 122 thereof are linked by use of MERGE nodes 131 and 132 to be terminated by COND --  TERM 133. 
     Finally, SUB --  ROOT&#39;s of the three subnetworks are linked by use of a ROOT node. In this linking operation, nodes commonly used in the subnets are assigned as common nodes for the linkage, and then branches are formed by use of FORK nodes. An example of this operation to derive the common node is shown in FIG. 9. In the schematic diagram of FIG. 9, the pairs of attribute and attribute data are assumed to be the same, and hence description thereof is omitted. Nodes 142, 146, and 149 are to be subjected to the same check. When INTRA --  X&#39;s 146 and 149 are moved to locations preceeding INTRA --  Y 145 and INTRA --  Z 148, respectively, these three INTRA --  X&#39;s can be treated as common items, thereby forming INTRA --  X 152. 
     For subnetworks in which such common items are not found, the elements are grouped for each root node so as to supply data therethrough. A method for generating a network has been described. 
     Next, a description will be given of a method for determining whether or not a condition is satisfied by use of the generated network. 
     The object data is fed through a root node into the network so as to be checked at each node. When the object data reaches COND --  TERM, the conditions located in the nodes constituting the path from the ROOT node to the COND --  TERM are determined to be satisfied. 
     In the network, at input branches of the INTER node (for example, those of nodes 103 and 103&#39; of FIG. 7), input branches of the SUB --  TERM node (for example, those of nodes 104, 111, and 122 of FIG. 7), two input branches of the MERGE node (for example, two input branches of nodes 131 and 132 of FIG. 8), and an input branch of the COND --  TERM node (for example, the input branch of the COND --  TERM 133 of FIG. 8), the object data thus delivered through the network is stored. 
     At the CAN --  NODE, the attribute data of an object which has just passed through the subnetwork or which may possibly pass therethrough is stored. The attribute data of &#34;object data which has just passed or which may possibly pass through the subnetwork&#34; includes 1 an object data for which the check is failed in the INTER node and 2 an object data that reaches the SUB --  TERM. 
     Referring now to FIG. 10, a method for executing a network processing will be described. 
     This network is obtained by converting two conditions on pumps A and B whose model numbers are M --  U105 and F --  U105, respectively, namely: 
     Condition A: The revolution frequency of the pump A is more than 2600. 
     Condition B: The revolution frequency of the pump A is less than 2600 or that of the pump B. 
     In the initial state, no data has been stored in this network. Assume that an object data or a token of the pump A of which the model number is M --  U105 and the revolution frequency is 2800 is fed into the root node of the network. At the ROOT 201, one of the branches, namely, SUB --  ROOT 217 is stored in the stack and processing of the INTRA --  A 202 node is executed. Since the object data name is pump A, the processing of this nodes completes successfully, and hence the subsequent node, INTRA --  A 203 is processed. Since the model number is M --  U105, the processing of this node is successfully achieved. In the next FORK node 204, like in the root node, one of the branches, namely, SUB --  ROOT 209 is stored in the stack. SUB --  ROOT 205 reads the subnetwork number stored in the input branch of the branch destination node, SUB --  ROOT 209 of the FORK node 204 and stores the subnetwork number. The check of the INTRA --  A 206 is successfully finished, and in SUB TERM 207 and COND --  TERM 208, the subnetwork number 0(#0) and pump A are stored in the form of (0 pump A). The object data reaches the COND --  TERM 208, which means that the condition A is determined to be satisfied. 
     Since the branch destination SUB --  ROOT 209 of the FORK 204 is stored in the stack, processing is resumed from the SUB --  ROOT 209. In this node, the subnetwork number #1 is retrieved, and then the other branch destination INTER 212 is stored in the stack at OR --  TN 210. Since the comparison, 2800&lt;2600 conducted in INTRA 211 results in a fail, the processing is resumed from the INTER 212 stored in the stack at the OR --  IN 210. In this node, for the object data delivered, the subnetwork number #1 and pump A are stored in the form of (1 pump A) in an input branch 221. Although a comparison of the value with respect to CAN --  NODE 222 is instructed to the INTER 212, no data has been stored in the CAN --  NODE 222; consequently, the processing results in a fail and is resumed from the SUB --  ROOT 217 stacked in the ROOT 201. In the SUB --  ROOT 217, the subnetwork number #2 is read. The next INTRA --  A 218 fails because the attribute data of the object data is not pump B. Since the stack contains no data, the processing to feed &#34;pump A&#34; through the network results in a fail and is thus terminated. 
     Next, assume that an object data of which the model number is F --  U105 and the revolution frequency is 3000 is delivered into the network. Like in the case of pump A, the processing is achieved as follows: ROOT 201, INTRA --  A 202 resulting in a fail, SUB --  ROOT 217, INTRA --  A 218, INTRA --  A 219, and SUB --  TERM 220 where (2 pump B) is stored. Next, MERGE 215 is activated and the same information, (2 pump B) is also stored in the input branch 224 to be checked for its integrity against the information stored in the input branch 225. However, no data has been stored in the input branch 225, the processing fails. Since this subnetwork #2 has CAN --  NODE, the processing of CAN --  NODE 222 is executed. First, the name, pump B of the object data that has passed the SUB --  ROOT 217 is stored in the CAN --  NODE 222, and then the processing of INTER 212 is achieved via an input branch 223. Here, the check of Revolution frequency of pump A 2800&lt;Revolution frequency of the object data 3000 results in a pass, an information item, (1 pump A, 2 pump B) is generated and transferred to the next node. This information is stored in SUB TERM 2; moreover, MERGE 215 stores the information in an input branch 225. Information (1 pump A, 2 pump B) has been stored in the input branch 225, which indicates that the pump B of the subnetwork 2 is necessary for the pump A to pass through the subnetwork 1. On the other hand, (2 pump B) has been stored in the input branch 224, which indicates that the pump B has passed through the subnetwork 2. As a consequence, the integrity between the pump A and pump B is maintained, and hence the information (1 pump A, 2 pump B) is delivered to the next node and this information is stored in COND --  TERM 216, which means that the condition B is determined to be satisfied. 
     In a case where the object data is changed, the original object data is fed into the network in the completely same fashion so as to delete all information about the object data from the branches containing such information, and thereafter new object data is supplied to the network. 
     The embodiment of the present invention described above will be further understood through the following discussion. FIG. 11 is a diagram showing an example of a complex condition including a logical sum between comparisons. Numbers 1-8 indicate the subconditions, respectively of the condition. (Refer to the IF part of FIG. 12 for details.) In this case, (3 2 ) 2  =81 subconditions will be established. 
     FIG. 13 is a diagram illustrating a network generated from the subconditions. 
     FIG. 14 is a schematic diagram depicting an overall network including all subnetworks as shown in FIG. 13. To generate such a large network, a large-sized memory and a long processing time will be necessary. 
     FIG. 15 is a diagram illustrating a network representing the condition of FIG. 11 in which candidate nodes 241-242 are disposed according to the embodiment of the present invention. 
     In FIG. 15, the broken lines indicate paths through which candidate data kept in the CAN --  NODE are delivered in a network where OR nodes and intranodes are complicatedly incorporated. 
     In such a complex network, the token processing in four subnetworks A, B, C, and D can be executed independently of each other, which consequently enables to minimize the network and the working memory and to speed up the overall processing. 
     For the system performance, it is desirable to keep in the candidate nodes the data which is quite likely to satisfy the pertinent condition.