METHOD AND APPARATUS FOR PROCESSING A REQUEST TO A BOOLEAN RULE

Abstract: There is provided a method of processing a request to a boolean rule having variables, by the use of an input signal having elements representing states of the variables, a stored rule base having elements arranged in terms, and an output signal having elements representing states of the variables; the elements in the input signal and the output signal being two-bit pairs; wherein the elements in said rule base are two-bit pairs capable of representing a plurality of combinations of states for said variables and wherein a term in said rule base represent multiple combinations of variables; for terms in the rule base determining which two-bit pairs to write to elements in the output signal, by for an element in the rule base and an element in the input signal both representing a given variable comparing the two bits of the input signal and the two bits of the terms in the rule base by means of logical operations.

Description: Method and Apparatus for Processing a Request to a Boolean Rule. Field of the Invention The invention relates to the field of processing a request to a rule by the use of an input signal, rule information, and an output signal. Background of the Invention Special applications of processing a request to a rule are configuration systems. General problems of configuration have three basic components: variables, values and rules. The goal is to find all assignments of the values to the variables such that all assignments are valid according the rules. This is called a constraint satisfaction problem, which is ubiquitous in the field of configuration. In configuration systems the variables represent selectable objects which may be included in a product upon a users selection if the constraints/rules are satisfied. Other often used terms for rules are e.g. Constraints' and ^Relations' . The configuration problem is solved when the set of all selectable objects is completely divided into two disjunctive sub-sets representing objects that are included in the configuration and objects that are excluded from the configuration, respectively, without violating any of the rules between the selectable objects . A selectable object is anything that can be included or excluded. It can be a physical object (e.g. a car or a specific kind of engine), an attribute (e.g. the color red or the texture pattern of a carpet) or something abstract (e.g. a specific number of trips between home and work or a particular type of contract) . A rule involves one or more selectable objects. The purpose of the rule is to constrain the selection of objects to obey some requirements. A rule can be based on a physical limitation (e.g. if a car needs a large engine to support a large number of selected electrical accessories), or a discretionary decision (e.g. if marketing management decides that all cars having a particular large engine are produced only in red colour to give them a more sporty look) . Often the term Constraint' is used to refer to a rule limiting how elements can be combined. Typically the rule is stored in an expedient format in a rule base, i.e. some type of table or database. Access to the rule base is obtained by means of a configuration engine. The configuration engine is responsible for verifying whether selections made by the user are valid according to the rule and reporting this to the user. Further, the configuration engine can be capable of deducing further knowledge from the rule, i.e. logically to conclude about values of objects that the user not has decided upon yet. The configuration engine can be implemented in numerous ways, however typically inspiration is obtained from the fields of search, comprising the fields: Constraint Logic Programming, Constraint Synthesis, Relational algebra, Propositional Logic, Integer programming, Graph theory, Predicate Calculus etc. The characteristics of a search problem is proven to be NP-Hard, i.e. its run-time complexity is exponential meaning that time the algorithm execution times are exponential to the size of the problem for non-trivial problems. This is a very unfortunate property of the problem, which have sparked the large interest in the algorithms . Typically, in configuration systems there is involved a large number of variables and the rule base should be consulted each time a user makes a selection in order to support and aid the user during the process of configuration. Further, today users expect very fast response times when using different types of computer programs (e.g. a program for doing configuration) they do not care about the underlying problem of configuration or any other type of technical aspect. Prior Art This invention relates to the European patent EP 0 456 675. EP 0 456 675 discloses a method and an apparatus for enhancing the information content of an input signal by the use of stored rule information, an input signal and an output signal. The rule information is obtained by converting a boolean rule having a number of variables into a plurality of terms representing all the possible combinations of the variables i.e. combinations of binary values assigned to the variables such that the boolean rule is not violated. This is also known as the positive index form. Other representations disclosed are negative index form (combinations of the variables where the rule is violated) and array form (all combinations of the variables plus for each combination an indication of whether the rule is violated or not) . For each term in the rule base the binary values assigned to the variables are compared with assignments to variables in the input signal thereby providing an output signal. The input and output signal may represent two possible states e.g. Crue' and λ False' , ^Tautology' (undefined state) , and Contradiction' (in-allowable state) . Terms involving variables that is in a possible state in the input signal are identified. If all of these terms have the same value for a particular variable, the variable is determined to have that value in the output signal. Thereby it is possible to deduce or retrieve information from the rule base. Thereby, there is provided a method and an apparatus which makes it possible deduce information about assignments of variables contained in the rule without having to carry out time consuming search in search trees for the boolean rule. By using a search tree for deducing information the computational effort for searching the tree is exponential to the number of allowable combinations of variables in the boolean rule whereas the computational effort for scanning the terms in e.g. a positive index form for the same rule is linear to the number of allowable combinations of variables in the same boolean rule. Thus, considerable reduction of the computational effort is obtained, especially when the rule contains a large number of variables. However, the method disclosed in EP 0 456 675 consumes memory for storing the rule base which is exponential to the number of variables in the rule base. Generally, the method requires storage of N/2* (2 Λ N) terms, where N is the number of variables in the formula. This means that a rule like: A => B or C or D or E or F or G or H or I or J or K or L or M or N or 0 or P results in 32768 terms taking up 64kbyte 16-bits words in memory. Especially, when a large number of variables are included in the rule base this method may result in an unacceptable large computationally effort regarding examining all the terms each time the rule base is consulted. Further, the memory consumption is unacceptable. Within the field of Constraint Logic Programming' also known as ^Boolean Unification' a number of methods have been proposed for converting a number of boolean rules into a number of terms (also denoted the Most General Unifier' or MGU) indicating whether specific combinations of boolean variables in the boolean rules are valid according to the boolean rules or not. Such methods are e.g. described in λ Boolean Unification, an efficient algorithm' by Antoine Rauzy, 1989, LaBri, Universite de Bordeaux and in Constraint Logic Programming' , edited by Frederic Benhamod and Alain Colmerauer, Cambridge, MIT, pages 237-251 Csing Enumerative Methods for Boolean Unificatio' , Antoine Rauzy. These methods are all involved with combining the boolean rules into a common representation which can be stored in the memory of a computer and wherein a request in the form of a combination of all the variables in the common representation can be verified. The methods are especially developed for the use in Constraint Logic Programming languages such as the PROLOG language. In Constraint Logic Programming languages boolean rules or terms are generated successively and the object is therefore to add a representation of a new rule to an existing representation without having to generate a completely new representation each time a new rule is generated. However, these methods also have the problem of exponential memory consumption which is traded off for the ability to continuously being able to add new rules. Thereby it is impossible to obtain fast scanning times of the rules i.e. a fast verification of a request against the rule. Further, these methods are not concerned with verification of requests in the form of a combination of just some of the variables in the common representation. Thus it is not sufficient to provide only partial knowledge of all the variables. Cross References Reference is made to the following patent applications, filed the same day as this application and assigned to the same assignee, Beologic A/S: (1) A Method of Configuring a Set of Objects in a Computer (2) A Method and Apparatus for Inference of Partial Knowledge in Interactive Configuration (3) Configuration via Network (4) A method of enabling Invalid Choices in Interactive Configuration Systems which are hereby incorporated as references to be understood in connection with the present invention. Summary of the Invention A first object of the invention is to provide a method which allows for fast processing of a request to rule, such that it is verified whether the request is valid according to the rule. A second object of the invention is to provide a method which allows to compress the representation of rule subject to a request for verifying whether the request is valid according to the rule. A third object of the invention is to provide a method which allows for deducing information from the rule base, such that unknown information in the request may be, but not necessarily is determined. There is provided a method of processing a request to a boolean rule having variables, by the use of an input signal having elements representing states of the variables, a stored rule base having elements arranged in terms, and an output signal having elements representing states of the variables; the elements in the input signal and the output signal being two-bit pairs; wherein the elements in said rule base are two-bit pairs capable of representing a plurality of combinations of states for said variables and wherein a term in said rule base represent multiple combinations of variables; for terms in the rule base determining which two-bit pairs to write to elements in the output signal, by for an element in the rule base and an element in the input signal both representing a given variable comparing the two bits of the input signal and the two bits of the terms in the rule base by means of logical operations. Consequently, it is possible to execute a request to a rule base very fast and, further, provide the result of the request to the rule base as an output signal very fast, while it is possible to store the rule base in a very efficient representation in a computer. For the formula introduced above, it is possible to compress the representation of the rule such that it takes up only 32 16-bits words in memory and such that is can be scanned about 2000 times faster in run time on a computer . Further, there is provided a computer system, having a memory, for processing a request to a boolean rule having variables . Brief Description of the Drawings The invention will be explained more fully below in con- nection with a preferred embodiment and with reference to the drawing, in which: fig. 1 shows a flow chart for a method of generating a compressed rule representation; fig. 2 shows a parse tree for the formula: (X or Y) => Z; fig. 3 shows four state vectors and indicates scanning of compressed and uncompressed terms according to the inven- tion; fig. 4 is the overall structure of a preferred embodiment of the present invention; fig. 5 shows a flow chart for a method of generating a local input state vector from a global input state vector; fig. 6 shows a flow chart for a method of scanning uncom- pressed terms; fig. 7 shows a flow chart for a method of scanning compressed terms; fig. 8 shows a flow chart for a method of extracting information. Detailed Description of a Preferred Embodiment In European Patent EP 0 456 675, which is hereby incorporated as a reference, a boolean formula is represented by the positive index form of that formula. This is illus ¬ trated by means of the following formula and table 1. Example 1: For the formula A or !B => !C which reads λ if A or not B, then not C , with the boolean variables A, B, and C, the positive index form is given in table 1. Table 1. The five terms in table 1 represent exactly all the com- binations of the variables where the formula is valid (not violated) . In a computer the contents of table 1 could conveniently be represented by means of one bit per variable per term in the memory. According to a first aspect of the invention this boolean rule representation can be changed from the use of the two states true and false to the three states true, false, and don't care. The don't care state represents tautology which implies that a don't care state may take the value true as well as false without violating the represented rule. The don't care state is indicated by a star (*) in the representation of the positive index form of a formula. The formula A or !B !C may thereby be represented as given in table 2 Compared with table 1, table 2 comprises two rows less than table 1. It is clear from table 2 that the first row can be expanded to the terms 1 and 4 in table 1 and that the last row can be expanded to the terms 3 and 5 in table 1. A compressed rule representation is hereby introduced. According to a second aspect of the invention the compressed positive index form can be used to obtain faster execution speed and to consume less memory on a computer. One term that includes a don't care (*) can be represented with a two bit representation for each variable. The three symbols {0,1,*} used for the compressed representation are shown in table 3 along with the binary assignment of the bits SI and S2 in the two bit representation. Table 3. The object of selecting the specific bit combinations is to make it possible to implement the rule scanning algorithm by means of simple logic and/or operations. The bit combinations may be chosen such that those operations which are assumed to be executed most frequently are the fastest operations to execute. The compressed positive index form in table 2 may conveniently be represented by 5 bytes in the memory i.e. two bytes per compressed term and one byte per uncompressed term. For rules with a larger number of variables significant memory savings can be achieved. Example 2: For the rule: A or B or C or D or E or F or G or H or I or J K The positive index form is given in table 4 Table 4. The uncompressed terms in table 4 requires two bytes times 1025 terms, equal to 2050 bytes. The compressed term representation is given in table 5. Term No . A B c D E F G H I J K 2-1025 * * * * * * 1 1 , 2 0 0 0 0 0 0 0 0 0 0 * Table 5 This compressed representation requires two bytes times two bytes per term times two terms, equal to eight bytes. For this rule, a significant saving is obtained in memory consumption, even though the compressed term representation uses twice as much memory per term, i.e. two bits per variable. The generation of compressed terms is well known from the field of digital design. Karnaugh cards are one method and a method such as the Quine-McCluskey method (1965) can be found in Morris Mano ' s book Digital Design. An overlapping set of terms is generated by the Quine- McCluskey method. However, we use a method by Antoine Rauzy "Boolean Unification, an efficient algorithm" 1989, LaBri, Universite de Bordeaux. This method generates a non overlapping set of terms. Boolean unification is also described in "Constraint Logic Programming", edited by Frederic Benhamod and Alain Colmerauer, Cambridge, MIT, pages 237- 251 "Using Enumerative Methods for Boolean Unificatio"" , Antoine Rauzy. It should be noted that boolean unification is concerned with the field of generating a single representation of boolean rules that can be examined in linear time opposite to e.g. search trees that is searched, more or less intelligent, with an exponential time consumption. The term Constraint Logic Programming' is also known as ^Boolean Unification' . Fig. 1 shows a flow chart for a method of generating a compressed rule representation. In step 1, the method begins with a symbolic boolean formula which is subject for a compressed representation. In step 2 an initialization process comprises assigning of the variables ActiveList and ResultList to the empty set and T to the empty set. When the initialization is done, a variable Q in the formula f, which is not in the term T at present, is selected in step 3. If several variables are possible, then the topmost one in the associated parse tree (see fig. 2) is selected, i.e. the variable governed by the fewest operators is selected. In case of ties, a variable is chosen at random. In step 4 the two terms Tl and T2 are generated, where Tl is T with Q added and T2 is T with the negated Q added. Each term respectively represents one side of the parse tree. Furthermore a counter i is initialized. Then a loop is entered, and the first step 5 of the loop is to increment the counter, i.e. i is set equal to i + 1. The next step 6 in the loop is to compute the truth value of the function f with respect to the known variable values in Tl or T2 that is the value of f(Ti) . The truth value is calculated by means of a calculator which uses the rewrite rules given in table 6. The symbol A may represent both a variable and a sub-formula. Table 6. The rewrite rules are derived directly from the Boolean algebra. If all variables are known then it is easy to determine the truth value of the formula f, however with only partial assignment the truth value may be undetermined in some cases. It is only necessary to compress a rule once, since the rule representation may be stored. Fig. 2 shows a parse tree for the formula: (X or Y) => Z . The top node of the tree corresponds to the x =>' or implication in the formula. The other node corresponds to the or-operator. X, Y, and Z are the variables of the parse tree. Example 3: For the formula (X or Y) => Z where Z is equal to True (Z := true), the formula is (X or Y) => True according to Rll the formula is "True", i.e. the truth value is True irrespective of the assignment of X and Y. For another term T = !XY, the formula is (False or True) according to R9 "True => Z" and according to RIO "Z", and therefore the truth value cannot be determined in this case. In the event that the truth value of the formula cannot be determined, the result of the computation in step 6 is v unkonwn' , and then Ti is added to the Active- List in step 7 for further processing in loop comprising the steps 3 to 11. In the event that the truth value of the formula is evaluated to be Crue' in step 6, then the term T is added to the ResultList as a valid compressed term in step 8. In the event that the truth value of the formula is evaluated to be x False' in step 6, or Ti is added to either the ResultList in step 8 or the Active- List in step 7, then it is tested in step 9 whether the counter i is equal to 2. If both Tl and T2 have been co - puted, it is tested in step 10 whether the ActiveList is empty, otherwise, if Tl and T2 have not been computed, the loop is resumed at step 5, where the counter i is incremented. In step 10 it is tested whether the ActiveList is empty. If it is empty, then the processing is termi- nated, otherwise a term T is subjected to further processing by taking T out of the ActiveList and resuming the loop in step 3. If the ActiveList is empty at step 10, the result list contains a set of terms representing the positive index of the formula in compressed form. The terms are translated into the index form by means of table 7. Table 7. Generally, this compressed formula representation takes up memory in the order of N times 0 bits, where N is the number of variables and 0 is the number of operators. Examples of compression: Example 4: In this example, the formula (X or Y) = Z is subjected to a compressed term representation. The succesive updates of the ResultList and ActiveList are shown in table 8 below. Active List (AL) Result List (RL) ] [] {Z}, {!Z}] [] {!Z}] [{Z}] {Y, !Z}, {!Y, !Z}]] [{Z}] {!Y, !Z}]] [{Z}] {X, !Y, !Z}, {!X, !Y, !Z}] [{Z}] {!X, !Y, !Z}] [{Z}] ] [{!X, !Y, !Z}, {Z}] Table 8. Therefore, the compressed positive index form is given as shown in table 9. Table 9. Example 5: In this example, the formula X (Y or z: is subjected to a compressed term representation. The succesive updates of the ResultList and ActiveList are shown in table 10 below. Table 10 . Therefore, the compressed positive index form is given in table 11. Table 11. To optimize the use of memory, the terms that do not have any don't cares (*) will be kept in a list separate from those that have don't cares (*) . A Boolean formula is henceforth represented as a structure with three elements Formula = (VL, PIL, CPIL) where VL is Variable List, PIL is an uncompressed Positive Index List, and CPIL is a Compressed Positive Index List, containing a list of pairs {SI, S2}. Example 5 (continued): Remembering the Boolean rule: X => ( Y or Z ) , the contents of the ResultList in table 10 and the trans- lations given in table 3 and 7, give the data representation of the formula Formula =( [X,Y,Z], [101], [ { 001 , 111 } , { 111, 011 } ] ) Example 2 (continued): Remembering the Boolean rule: A or B or C or D or E or F or G or H or I or J = K, the term representation in table 5 gives the data repre- sentation of the formula: Formula =( [A, B, C, D, E, F, G, H, I , J, K] , [000000 00000] , [{11111111110,11111111111}]) Thus it is clear that this representation is very effi ¬ cient . Fig. 3 shows four state vectors and indicates scanning of compressed and uncompressed terms according to the inven- tion. The overall structure of the scanning algorithm is divided into four stages. At stage one a request to a rule is prepared. The request is in the form of a state vector, and the rule is in the form of a formula represented by the compressed and uncompressed terms. That is, a local input state vector (ISV) 303 with elements 304 is generated by extracting information from the global state vector 301 with elements 302. The information is extracted such that only the variables involved in the formula are extracted. This minimizes the computational ef- fort required in the processing of the request to the rule. The processing comprises two stages: scanning of compressed and uncompressed terms. At stage two 305 the local input state vector is scanned through all uncompressed terms of the formula to test for Λ match' or no λ match' , and the relevant elements 307 of the local output state vector (OSV) 306 are updated with the result of the uncompressed scanning. At stage three 310 the local input state vector (ISL) 303 is scanned through all the compressed terms of the formula to test for λ match' or λ no match' . The information retrieved by the scanning is contained in the local out ¬ put state vector (OSV) . At stage four the contents of the local output state vector are transferred to the global output state vector 308 with elements 309. A request in the form of an input state vector comprises information about known aspects of an element, for exam- pie the state of sensors or configuration selections, but generally other elements of the state vector will be un ¬ known. The information may be contained in elements of a state vector having variable values. The request processing at stage two and four scans a Boolean formula with the knowledge of the current assignments of variables found in the state vector. One object of the invention is to determine some or all of the unknown elements where the rule enables this. The result of the request is updated in the output state vector. If a contradiction between the request and the rule is detected, i.e. the formula is violated, then the algorithm ends, and if the formula is valid, it is determined whether any further variables may be deduced, i.e. as- signed a value in the state vector. The state vector can physically be any data repository such as a data base or a set of objects with associated values about a set of Boolean items occurring in the formula. The input state vector and the output state vector comprise the variable values which occur in the formula. Each variable in the state vector is stored in the form of one of four possible two-bit combinations. Table 12. Table 12 shows the possible variable values of the two bits SI and S2 in the state vector. It should be noted that this is the same convention as used for representing the compressed terms for the states Crue' , 'False' , and 'Tautology' (don't care). However, according to the invention the bit-representations of the states can be swapped, e.g. 'True' can be represented by the bit-values Sl=l; S2=l, 'False' can be represented by the bit-values S1=0; S2=0, 'Tautology' ('Don't Care') can be represented by the bit-values Sl=l; S2=0, and Contradiction' can be represented by the bit-values S1=0; S2=l . In a preferred embodiment the bit- representations of the states in the request state vector, the rule base and the response state vector are the same, however other combinations can implemented according to the invention. In order to gain the benefits according to the invention proper modifications of the disclosed algorithms must be made. However, this is within the skills of a person skilled in the art. The scanning process can be seen as looking at the terms of the formula one by one. If there is a match between the variables bound in the input state vector and the terms (i.e. the rule representation), then the unbound variables may have the value represented in the term. Bounded variables may take the symbolic values 'True' or 'False' , whereas unbounded variables may take the symbolic value 'Tautology' or 'Don't Care'. The following table determines whether a match exists or not between a rule term and an input state vector variable. A match between a term and the input state vector is detected if all the variables of that term match with the input state vector. Table 13 Table 13 shows which combinations of '0' ('False'), '1' ('True'), and '*' ('Don't Care' /' Tautology' ) result in a 'Match' or 'No Match' . When looking at the actual chosen bit representation, both bits have to differ in order to detect a 'no match' . If other bit-representations of the states are used, other logical relations of the bits can be found. When a match has been detected, the knowledge about the matching term is stored in an output state vector using the following update table. Table 14. Table 14 shows the update of the output state vector responsive to the term variable and the previous output state vector. When looking at the chosen bit representation given in table 12 and the output update in table 14, it is now possible to update the output state vector by a simple boolean OR operation. Example 5 (continued I) : Remember the rule X => ( Y or Z ) , now with a request where external assignments have been made in the state vector. The assignment is that Z is set to false, X is set to true, and there is no knowledge about Y, i.e. tautology. The input state vector is [X Y Z] = [1 0] and the term representation is as given in table 11 term 1 —> 0 * * - No match term 2 - 1 1 * -» Match term 3 —> 1 0 1 -» No Match Table 15 Table 15 shows the input state vector, the representation of terms 1, 2, and 3 and the three succesive updates of the output state vector. The output state vector is by default initialized to 'contradiction' ( ! ) for all elements in the output state vector. Thus, because no match is found between the input state vector and term 1, the output state vector is not updated in step 1. In step 2 a match is detected, and therefore the output state vector is updated according to table 14. In step 3 there no match is found either, and the output state vector remains unchanged. 'Match' / 'No Match' is detected by means of table 13. Now when looking at the output state vector and eliminating those elements that were bound in the input state vector, it can be seen that Y must be true according to the rule terms. This implies that Y may take the value True and may now be transferred to the output state vector with that value. The bitwise determination of whether there is a match or not and the updating of the output variables can be done by the four operations "and, or, not, xor", if the representations given in table 3 and 12 is used. Generally, a computer executes these basic operations very fast. If the signal components SI and S2 are represented by means of e.g. two words, then a 32-bit computer can execute a term match process in two basic operations for formulas with less than 32 variables . In configuration systems rules with less than 32 variables are the most common rules. Fig. 4 is the overall structure of a preferred embodiment of the present invention. The structure is divided into four stages i.e. 414, 415, 416, and 417. The detailed method used in a preferred embodiment is presented in each of these four stages. Start 413 and end 418 indicates where the method is initiated and where no further processing takes place. Stage one 414 corresponds to the global to local input state vector conversion in fig. 3, and stage four corresponds to the local to global output state vector conversion. Description of variables in scanning algorithm: StateVector: Is a vector where all the variables are represented by their current value. The value of StateVector [A] is the current truth value of A (True, False, Unbound) . TV Is a bit mask indicating the True variables in input state vector with a binary '1' . BV Is a bit mask indicating the bounded variables in input state vector with a binary '1' . ISV Is the local input state vector. OSV Is the local output state vector. CH Is a bit mask indicating the changed vari ¬ ables in input state vector with a binary '1' . |X| means the length of X, e.g. |X| = |{a,b,s,d}| = 4. Formula = (VL, PIL, CPIL) , where VL is a variable list. PIL is a positive index list. CPIL = [{SI, S2}] is a compressed positive index list of pairs {SI, S2}. Fig. 5 shows a flow chart of a method of generating a lo- cal input state vector from a global input state vector. Start 519 is similar to start 413 of fig. 4. First, a counter i is initialized to zero in step 520 in order to count over the variables in the formula. Then a loop is entered, and the first step 521 in the loop is to incre- ment the counter i to i + 1. The counter is used as an index in the formula variable list VL to get the variable which is again used as an index in the StateVector to extract the actual value of the variable either True, False or Unbound. In step 522 the variable value of the element number i in Formula.VL is recognized as either true (T) , false (F) , or unbound (UB) . If the result of step 522 is true, then step 523 is entered, if the result is unbound, then step 524 in entered, and if the result is false, then step 525 is entered. In step 523 the bits SI and S2 of variable number i are updated with SI := 0 and S2 : = 1. In step 524 the bits SI and S2 of variable number i are updated with SI := 1 and S2 := 1. In step 525 the bits SI and S2 of variable number i are updated with SI := 1 and S2 := 0. The loop is repeated until the truth value of all the variables in the formula has be trans- ferred to the local input state vector (ISV) . This is tested in step 526. If the counter i has reached the length of the formula variable list Formula.VL, then the loop is terminated, otherwise the loop is resumed with a counter increment in step 521. If the loop is terminated, the method continues with the scanning of uncompressed terms via the step A, 527. Fig. 6 shows a flow chart of a method of scanning uncompressed terms. The method of fig. 5 continues via step A, 527. In step 627 initialization of variables regarding the scanning of uncompressed terms is performed. The local output state vector OSV is initialized to 'contradiction' by setting the two bits SI and S2 to '0' . That is OSV[i] .SI := 0, OSV[i].S2 := 0, corresponding to that all elements are set to 0. The bounded variables in the local input state vector ISV are indicated with a bit mask BV by a binary '1', that is BV: =not ( ISV. SI and ISV.S2) . The true variables of the local input state vector are also indicated by a bit mask TV:=BV and ISV.S2. And finally the variable AnyMatch is set to false, Any- match:=False . In step 628 the counter i is set to zero, i:=0. This counter is used to count over the uncompressed terms in the positive index list, PIL, of the formula. Step 629 increments the counter i and is the first step of a loop. The loop is terminated in step 630 if all the PIL terms have been scanned, here tested whether the counter i has reached the length of the formulas PIL list, that is, is i = | Formula. PIL | . Detection of whether there is a match or not is carried out in step 631, wherein the truth value of the statement TV = Formula. PIL [i] and BV is tested. If this statement is false, then the loop is resumed with a counter increment in step 629, otherwise the local output state vector is updated along with the variable AnyMatch, before the loop is resumed in step 629. The update is as follows: OSV. SI := OSV. SI or not ( Formula . PIL [i] ) OSV.S2 := OSV.S2 or Formula . PIL [i] AnyMatch := True If no match exists, then the OSV is not updated and a contradiction is detected. When the loop is finished, as detected in step 630, the method continues with scanning of the compressed terms via the step B, 633. Fig. 7 shows a flow chart of a method of scanning com- pressed terms. The method of fig. 6 continues via the step B, 633. In step 733 the counter i is set to zero, i:=0. The counter is used to count over the compressed terms in the compressed positive index list, CPIL, of the formula. Step 734 increments the counter i and is the first step of a loop. The loop is terminated in step 735 if all the CPIL terms have been scanned, here tested whether the counter i has reached the length of the formulas CPIL list, that is, is i = | Formula . CPIL | . Detection of whether there is a match or not is carried out in step 736, wherein the truth value of the statement 0 = ( (Formula. CPIL [i] .SI xor ISV. SI) and (Formula. CPIL[i] .S2 xor ISV.S2)) is tested. If this statement is false, then the loop is resumed with a counter increment in step 734, otherwise the local output state vector is updated along with the variable AnyMatch, before the loop is resumed in step 629. The update is as follows: OSV. SI := OSV. SI or Formula . CPIL [i] . SI OSV.S2 := OSV.S2 or Formula .CPIL [i] . S2 AnyMatch := True If no match exists, then the OSV is not updated and a contradiction is detected. When the loop is finished, as detected in step 735, the method continues with an information extraction via step C, 738. Fig. 8 shows a flow chart of a method of extracting in- formation. The method of fig. 7 continues via the step C, 738. If no match is detected in step 838, for either the compressed or uncompressed terms, then the request in the form of the input state vector is in contradiction with the rule representation and thereby the rule. This result is provided in step 839 if the variable AnyMatch is false. Alternatively the detection is performed by calculating the truth value of the statement: 0 = (OSV. SI or OSV.S2) The variable that has been changed due to the scanning process es extracted by comparing the local input state vector (ISV) to the output state vector (OSV) and removing all bound variables indicated by BV in the change vector CV. That is, a true variable could match a unbound variable. The changed variables are indicated in step 840 in the vector CH by means of the statement: CH:=(ISV.S1 xor OSV. SI) or (ISV.S2 xor 0SV.S2) and not (BV) If the change vector only contains zeros, then the scanning has reveiled no new information, and the algorithm may then report this. That is, the request is valid according to the rule. In step 841 it is tested whether CH is equal to 0, and if CH is equal to 0, then in step 842 it is concluded that nothing is deduced and the method terminates. The method ends, and it has deduced variables which are reported. In step 841 the counter i is incre ¬ mented in the beginning of the loop. This loop is re- peated until the truth value af all the deduced variables in the local output state vector (OSV) have been trans ¬ ferred to the StateVector SV, here tested in step 844 whether the counter i has reached the length of the formula variable list VL . That is, is i< I Formula .VL | ? . If the result is no, then the method terminates in step 849, otherwise the method continues in step 845. In step 845 it is tested whether the value of element i in the vector CH is true. If the value of the element is true, then it is tested, in step 846, whether bit SI in the element i of the local output state vector is true, that is is OSV[i].Sl=0 ?. If it is true, then the StateVector [Formula.VL[i]] is set to true in step 847, otherwise StateVector [Formula.VL [i] ] is set to false. When step 847 or step 848 is executed, then the loop resumes with a counter increment in step 843. Likewise, the loop resumes if the result of step 845 is false. Example 5 (continued II) : Remember the rule X = ( Y or Z ) where the formula representation is { [X,Y,Z], [101], [{111,011}, {001,111} ] }. Furthermore, it is known that X is assigned to true and Z is assigned to false. Start at stage one: Generate local input state vector (X) StateVector [1] = True (Y) StateVector [2] = Unbound (Z) StateVector [3] = False isv={011, 110}, osv = {000,000}, TV = [100], BV = [101] Stage two: Scan uncompressed terms Match ? (Formula. PIL [i] and BV) xor TV PIL[1]: (101 and 101) xor 100 = 101 xor 101 = 001 (No match) isv={011, 110}, osv = {000,000}, TV = [100], BV = [101] Stage three: Scan compressed terms Match ? ( (Formula. CPIL [1] . si xor isv.sl) and (Formula. CPIL [1] .s2 xor isv.s2)) [{111,011}, {001, 111} CPILtl]: (HI xor 011 ) and ( 011 xor 110) = 100 and 101 = 100 (No Match) Continue CPIL [2]: (001 xor 011) and (111 xor 110) = 010 and 001 = 000 (Match) osv. si := osv. si or Formula . CPIL [2] . si = 000 or 001 = 001 osv.s2 := osv.s2 or Formula. CPIL [2] .s2 = 000 or 111 = 111 isv={011, 110}, osv = {001,111}, TV = [100], BV = [101] Stage four: Extract information from scanning CH = ((isv.sl xor osv. si) or (isv.s2 xor osv.s2)) and !BV = ( 011 xor 001) or (110 xor ill ) and 1101 = (010 or 001) and 010= 011 and 010 = 010 Local StateVector [2] = {0,1} = True Therefore Y equals True, as expected. Example 6: This example is taken from the field of con- figuration. The relations between the selectable elements for a car, the rule, or constraint may be: Model [Turbo] or Model [Cabriolet ] => MetalicPaints and Trim[Leather] and CruiseControl Instead of using the above terms we abbreviate these to more readable variable names: Model [Turbo] = A Model [Cabriolet] = B MetalicPaints = C Trim[Leather] = D CruiseControl = E The above constraint abbreviates to the following formula: A or B => C and D and E We can now commence the Fast Boolean Scanning algorithm. Leftmost is the point at which the ActiveList and the ResultList are shown. p4_5 indicates the point between step 4 and step 5, likewise p9_10 indicates the point between step 9 and step 10. For each iteration it is shown what the terms T, Tl and T2 are assigned. Referring to fig. 1 'generating a compressed rule repre ¬ sentation' : Point: ActiveList: ResultList: p2 3 {} {} T=0, T1=A, T2=!A p4_5 { } {} p4_5 {A} {} p9 10 {A, !A} {} T=A, T1=AB, T2=A!B p4_5 { !A} p4_5 { !A, AB} p9 10 { !A, AB, A!B; {} T=!A, T1=!AB, T2=!A!B p4_5 {AB, A!B} p4_5 {AB, A!B, !AB} {} p9 10 {AB, A!B, !AB} { !A!B} T=AB, T1=ABC, T2=AB!C p4_5 {A!B, !AB} !A!B} p4_5 {A!B, !AB,ABC} !A!B} p9 10 {A!B, !AB,ABC} !A!B} T=A!B, T1=A!BC, T2=A!B!C p4_5 {!AB,ABC} { !A!B} p4_5 { !AB,ABC,A!BC} { !A!B} p9 10 { !AB,ABC,A!BC} { !A!B} T=!AB, T1=!ABC, T2=!AB!C p4_5 {ABC,A!BC} { !A!B} p4 5 {ABC,A!BC, !ABC} { !A!B} Point: ActiveList ; ResultList: p9 10 [ABC,A!BC, !ABC} !A!B} T=ABC, TOABCD, T2=ABC!D p4_5 {A!BC, !ABC} { !A!B} p4_5 {A!BC, !ABC,ABCD} { !A!B} p9_10 {A!BC, !ABC,ABCD} { !A!B} T=A!BC, T1=A!BCD, T2=A!BC!D p4_5 {!ABC,ABCD} { !A!B} p4_5 { !ABC,ABCD,A!BCD} { !A!B} p9 10 { !ABC,ABCD,A!BCD} { !A!B} T=!ABC, T1=!ABCD, T2=!ABC!D p4_5 {ABCD,A!BCD} { !A!B} p4_5 {ABCD,A!BCD, !ABCD} { !A!B} p9 10 {ABCD,A!BCD, !ABCD} { !A!B} T=ABCD, T1=ABCDE, T2=ABCD!E p4_5 {A!BCD, !ABCD} { !A!B} p4_5 {A!BCD, !ABCD} { !A!B,ABCDE} p9 10 {A!BCD, !ABCD} { !A!B,ABCDE} T=A!BCD, T1=A!BCDE, T2=ABCD!E p4_5 {!ABCD} { !A!B,ABCDE} p4_5 {!ABCD} {!A!B,ABCDE, AlBCDE} p9 10 { !ABCD} { !A!B,ABCDE, AlBCDE} T=ABCD, TOABCDE, T2=ABCD!E p4_5 { } { !A!B,ABCDE,AlBCDE} p4 5 {} { !A!B,ABCDE, AlBCDE, 1ABCDE} End {} { !A!B,ABCDE,AlBCDE, 1ABCDE} The result can now be translated into the two-bit representation given in table 16: Table 6. Resulting in the following representation Formula = ( [A, B, C, D, E] , [11111,10111,01111], [{11111,00111}] ) Referring to fig.5 'generating a local input state vector' : Now, in the formula A or B => C and D and E a user may have chosen B=False and E=True corresponding to having made the choices of discarding the Cabriolet model, but selecting Cruise Control. Initially, we have the following data structures from above : Formula.VariableList = [A,B,C,D,E] Formula. PositiveIndexList= [11111,10111, 01111] Formula. CompressedPositivelndexList = [{11111,00111}] At the point A (after the first loop) the InputStateVec- tor has been assigned. isv.sl = 11110 isv.s2 = 10111 After A the OutputStateVector is, BoundVariable, True- Variable and AnyMatch are initiallized to osv. si = 0 osv.s2 =0 BV = not (isv.sl and isv.s2) = not (11110 and 10111) = not 10110 = 01001 TV = BV and isv.s2 = 01001 and 10111 = 00001 AnyMatch = False Referring to fig. 6 'scanning of uncompressed terms': The following shows 631 and 632 at each iteration of the loop 629 to 632. i = 1: 631) TV = Formula.PIL[i] and BV 00001 = 11111 and 01001 00001 = 01001 False i = 2 631) TV = Formula.PIL[i] and BV 00001 = 10111 and 01001 00001 = 00001 True 632) osv. si := osv. si or not Formula . PIL [i] = 00000 or not 10111 = 01000 osv. s2 = osv.s2 or Formula. PIL [i] = 00000 or 10111 = 10111 i = 3 631) TV = Formula. PIL [i] and BV 00001 = 01111 and 01001 00001 = 01001 False At B the output state vector is thus assigned: osv. si = 01000 osv.s2 = 10111 Referring to fig. 7 'scanning compressed terms': The loop from 734 to 737 is only executed once as the Compressed Possitive Index List only contains one ele ¬ ment . 736) 0 = (Formula. CPIL [i] . si xor isv.sl) and (Formula . CPIL [i] . s2 xor isv.s2) 0 = (11111 xor 11110) and (00111 xor 10111 0 = 00001 and 10000 0 = 00000 True 737' osv. si = osv. si or Formula. CPIL [1] . si = 01000 or 11111 = 11111 osv. s2 = osv.s2 or Formula.CPIL[l]s2 = 10111 or 00111 = 10111 AnyMatch := True Now because AnyMatch was assigned True, the test at (38) is passed, and the algorithm proceeds to (40) where CH is initialized to: Referring to fig. 8 'extracting information': CH := ((isv.sl xor osv. si) or (isv.s2 xor osv.s2)) and not BV CH := ((11110 xor 11111) or (10111 xor 10111)) and not 01001 = (00001 or 00000) and 10110 = 00001 and 10110 = 00000 After the loop from 844 to 848 no elements of the state vector are changed (deduced to either true or false) . It is, however, verified that the state vector does not lead to any contradictions. It should be noted that although the positive index form have been used as an example in the description other representations of the rule base are possible. Other representations can be the negative index form (combinations of the variables where the rule is violated) and array form (all combinations of the variables plus an indication of whether the rule is violated or not) . Proper modifications of the disclosed algorithms must be made in order to gain the benefits according to the invention. However, this is within the skills of a person skilled in the art. The invention may be embodied as a computer program or a part of a computer program, which may be loaded into the memory of a computer and executed therefrom. The computer program may be distributed by means of any data storage or data transmission medium. The storage media can be magnetic tape, optical disc, compact disc (CD or CD-ROM) , mini-disc, hard disk, floppy disk, ferro-electric memory, electrically erasable programmable read only memory (EEPROM) , flash memory, EPROM, read only memory (ROM) , static random access memory (SRAM) , dynamic random access memory (DRAM) , ferromagnetic memory, optical storage, charge coupled devices, smart cards, etc. The transmission medium can be a network, e.g. a local area network (LAN) , a wide area network (WAN) , or any combination thereof, e.g. the Internet. The network may comprise wire and wire-less communication links. Via the network a software embodiment (i.e. a program) of the invention, or a part thereof, may be distributed by transferring a program via the network. Further, it should be stressed that the invention by no means is limited to the described preferred embodiment.

Claims: Claims 1. A method of processing a request to a boolean rule having variables, by the use of an input signal having elements representing states of the variables, a stored rule base having elements arranged in terms, and an output signal having elements representing states of the variables; the elements in the input signal and the output signal being two-bit pairs; wherein the elements in said rule base are two-bit pairs capable of representing a plurality of combinations of states for said variables and wherein a term in said rule base represent multiple combinations of variables; for terms in the rule base determining which two-bit pairs to write to elements in the output signal, by for an element in the rule base and an element in the input signal both representing a given variable comparing the two bits of the input signal and the two bits of the terms in the rule base by means of logical operations. 2. The method according to claim 1, wherein the input signal, the output signal, and the terms in the rule base have a common set of states, each state in the common set being coded with the same bit-values in the input signal, the output signal, and the terms. 3. The method according to claim 1-2, wherein the elements of the input signal and the terms represents one of the states: 'True', 'False' or 'Tautology'. 4. The method according to claim 1, wherein the elements of said output signal represents one of the states: 'True', 'False', 'Tautology', or Contradiction'. 5. The method according to claim 3-4, wherein said states have the following two-bit values: 0 1 'True' 1 0 'False' 1 1 'Tautology' 0 0 Contradiction' 6. The method according to claim 1-5, wherein said rule base further comprises a set of terms having binary elements and wherein each term in said set of terms represent a single combination of states for the variables . 7. The method according to claim 1-6, wherein said terms represent only combinations which do not violate the boolean rule, only combinations which do violate the boolean rule, or all combinations plus an indication of whether a term violates the boolean rule or not. 8. The method according to claim 1-7, wherein the method further comprises the step of generating said input signal as a subset of variables from a global input signal, and wherein said subset of variables is determined as those variables involved in said rule. 9. The method according to claim 1-8, wherein the method further comprises the step of generating a global output signal having variables wherein some of the variables are updated with variable states from said output signal. 10. The method according to claim 1-9, wherein all variables in said output signal are initialised with the symbolic representation Contradiction' . 11. The method according to claim 1-10, wherein a match is detected by comparing the elements of the input signal to the elements of the terms in the rule base, respectively, and if elements in the input signal represents a valid combination, then a match is detected. 12. The method according to claim 11, further comprising the following information retrieving strategy: if no match is detected, then said output signal contains contradiction information; if no variables are changed in said output signal, then nothing is deduced; otherwise, said output signal is updated with the symbolic representations 'True' or 'False' ; indicating the retrieved information to a user by means of a user interface. 13. A computer system, having a memory, for processing a request to a boolean rule having variables, by the use of an input signal having elements representing states of the variables and an output signal having elements representing states of the variables; the elements in the input signal and the output signal being two-bit pairs; wherein the memory comprises a rule base having elements arranged in terms, the elements in said rule base being two-bit pairs capable of representing a plurality of combinations of states for said variables and wherein a term in said rule base represent multiple combinations of variables; and wherein the memory further comprises a procedure for determining, for terms in the rule base, which two-bit pairs to write to elements in the output signal, by for an element in the rule base and an element in the input signal both representing a given variable comparing the two bits of the input signal and the two bits of the terms in the rule base by means of logical operations . 14. A computer system, having a memory, according to claim 13, wherein the input signal, the output signal, and the terms in the rule base have a common set of states, each state in the common set being coded with the same bit-values in the input signal, the output signal, and the terms . 15. A computer system, having a memory, according to claim 13-14, wherein the elements of the input signal and the terms represents one of the states: 'True', 'False' or 'Tautology' . 16. A computer system, having a memory, according to claim 13-15, wherein the elements of said output signal represents one of the states: 'True', 'False', 'Tautology' , or Contradiction' . 17. A computer system, having a memory, according to claim 15-16, wherein said states have the following two- bit values: 0 1 'True' 1 0 'False' 1 1 'Tautology' 0 0 Contradiction' 18. A computer system, having a memory, according to claim 13-17, wherein said rule base further comprises a set of terms having binary elements and wherein each term in said set of terms represent a single combination of states for the variables. 19. A computer system, having a memory, according to claim 13-18, wherein said terms represent only combinations which do not violate the boolean rule, only combinations which do violate the boolean rule, or all combinations plus an indication of whether a term violates the boolean rule or not. 20. A computer system, having a memory, according to claim 13-9, wherein the method further comprises the step of generating said input signal as a subset of variables from a global input signal, and wherein said subset of variables is determined as those variables involved in said rule. 21. A computer system, having a memory, according to claim 13-20, wherein the method further comprises the step of generating a global output signal having variables wherein some of the variables are updated with variable states from said output signal. 22. A computer system, having a memory, according to claim 13-21, wherein all variables in said output signal are initialised with the symbolic representation Contradiction' . 23. A computer system, having a memory, according to claim 13-22, wherein a match is detected by comparing the elements of the input signal to the elements of the terms in the rule base, respectively, and if elements in the input signal represents a valid combination, then a match is detected. 24. A computer system, having a memory, according to claim 23, wherein the procedure further comprises the following information retrieving strategy: if no match is detected, then said output signal contains contradiction information; if no variables are changed in said output signal, then nothing is deduced; otherwise, said output signal is updated with the symbolic representations 'True' or 'False' ; indicating the retrieved information to a user by means of a user interface.

Inventors: SKOVGAARD HANS JOERGEN, SKOVGAARD, HANS, JOERGEN
Applicants: BAAN FRONT OFFICE SYSTEMS A S, SKOVGAARD HANS JOERGEN, BAAN FRONT OFFICE SYSTEMS A/S, SKOVGAARD, HANS, JOERGEN
Application year: 1998
Main classification: G06F9
IPC codes: G06F9, G06F15, G06F17, G06N5