Coding and memorizing method for fuzzy logic rules and circuit architecture for processing such rules

Abstract: The invention relates to a method of coding and storing fuzzy logic rules, and to a circuit architecture for processing such rules. The method provides for at least one inference rule of the IF/THEN type, having a predetermined number of antecedent parts (A,B,C...) of fuzzy variables and at least one consequent part (Z), to be dismembered and stored into memory words (10) to allow of subsequent processing using logic operators of the AND/OR/NOT type. The coding of rules and variables is effected sequentially. Thus, the occupation of memory locations can be minimized. Specifically, the rules are coded through a multi-word description, such that the number of words coding each rule is a varying number dependent on the number of antecedent parts in the rule.

Description: Field of the Invention This invention relates to a method of coding and storing fuzzy logic rules, and to a circuit architecture for processing such rules. Specifically but not exclusively, the invention relates to a method of coding and storing fuzzy logic rules, wherein at least one inference rule of the IF/THEN type having a predetermined number of antecedent parts of the fuzzy variables, and at least one consequent part, is decomposed and stored into memory words for allowing subsequent processing with logic operators of the AND/OR/NOT type. As is well known, the structure of a fuzzy logic rule, or instruction, can be schematically expressed by the following relationship: IF condition THEN action, where the rule portion designated "condition" is also called the antecedent part, and "action" is called the consequent part. An example of a fuzzy logic rule coding is disclosed in European Patent No. 0 544 629 to this Applicant. As a further example, the following fuzzy rule can be considered which comprises two logic operations of the AND/OR type having two levels of priority: IF (ing1 is mf3 or ing is not mf0) and (ing2is not mf8 and ing0 is mf15) THEN consequent (1) In fuzzy logic-based architectures, an evaluation block is provided which is referred to as the "omega" operator and is to determine the so-called "ω" weight related to the antecedent part of the fuzzy rules. In essence, the weight ω i of the i-th rule is an indicator of the i-th action Z i to be effected, and contributes in the determination of the output value of the architecture. For example, in the known Centroid Method, the contribution from the various "ω" weights is given as: Σω i * Zi Σω i Background Art The state of the art currently proposes of coding and processing fuzzy variables in parallel, but processing the pertinent fuzzy rules in a serial mode. This solution has been adopted to produce fuzzy processors known by their trade designations W.A.R.P. 1.x and W.A.R.P. 2.0, but still shows some shortcomings, as outlined herein below. A second prior solution proposes, on the other hand, to code and process the fuzzy rules in parallel, but processing the respective variables in a serial mode. That is to say, the fuzzy inference rule is fully contained within one memory word. A method of this kind is that disclosed, for example, in the aforementioned European Patent No. 0 544 629 to this Applicant. Both solutions have shortcomings, such as a requirement for memories having words with different lengths for different fuzzy processors. Additionally, this involves the need for memories with very long words. Furthermore, with the fuzzy inference rule stored in a single memory word, a constraint is imposed on the number of antecedent parts, which can only be a fixed number. This results in a waste of memory locations when the inference rules have a smaller number of antecedent parts, the storing of which requires a smaller number of bits. A further solution of the prior art is seen in European Patent EP 0 538 470A1. This solution relates to the rearranging and storing of fuzzy rules. The disclosed solution analyses component parts of fuzzy interference rules and prioritises them based on frequency. The component parts are extracted and stored in order of frequency of use. However, this solution suffers from the problem that it is only applicable to fuzzy rules that only contain all AND logical operators, which greatly limits its applications for use. Also, the above solution does not afford the possibility to process inference rules that have different levels of parenthesis, or the ability to process the priority necessary between the logic operators of AND and OR. A software implementation that generally discusses a system of scanning rules, conditions, actions and data items is found in "Index: An Expert System Shell for the Real-Time Command of Industrial Processes", Journal A, vol. 30, no.4, 1 December, 1989, XP000087250, pages 37-46, by G. Libert. This reference is only generally related to the background of scanning rules for storage, but provides few or no details of the way the rules are stored, the codes used, and further, does not relate to fuzzy processing. The underlying technical problem of this invention is to provide a new methodology for coding and processing fuzzy logic inference rules, which can minimize the memory area requirements of rule coding, while affording reduced complexity of the electronic decoding circuits associated with that memory area. The achievement of this would enable the current limitations and shortcomings to be overcome as are besetting the prior art solutions to the problem of coding and processing fuzzy logic rules. Summary of the Invention The solution idea on which the invention stands is to provide for a serial coding of the fuzzy rules followed by a corresponding serial processing of both the rules and the variables. In this way, the occupation of memory locations can be minimized. Specifically, the rules are coded by a multi-word description whereby the number of words used to code each rule is a varying number tied to the number of antecedent parts in the rule. Based on this solution idea, the technical problem is solved by a method as previously indicated and defined in the characterizing portions of Claims 1 appended hereto. The technical problem is also solved by a circuit architecture as previously indicated and defined in the characterizing portion of Claim 10. The features and advantages of the method and architecture according to the invention will be apparent from the following description of an embodiment thereof, given by way of non-limitative example in relation to the accompanying drawings. Brief Description of the Drawings Figure 1 is a schematic representation of a memory word, as divided into fields according to the method of this invention. Figures 2 to 8 are respective schematic representations of memory word sequences, as required for coding different types of fuzzy rules, according to the method of this invention. Figure 9 shows schematically a flow diagram implementing the method of this invention. Figure 10 is a schematic view of a circuit architecture provided in this invention for coding and processing fuzzy logic rules. Figures 11 and 12 are respective schematic representations of memory words, as divided according to a specific embodiment. Detailed Description Referring to the drawing figures, specifically to the example of Figure 1, generally and schematically indicated at 10 is a memory word comprising a number of fields, to be explained. A clearer view of the invention aspects can be gained by first considering a fuzzy inference rule and the manner of coding the rule. A fuzzy rule will be assumed which includes two logic operations of the AND/OR type and two priority levels in such operations, as follows: IF (ing1 is mf3 or ing is not mf0) and (ing2is not mf8 and ing0 is mf15) THEN consequent (1) According to the method of this invention, this rule would be coded with: a memory word "word_ant" for each antecedent part; a memory word "word_cons" for each consequent part; this word may either contain a constant or "crisp" value or a fuzzy value, and in the latter instance, it would be coded with information for computing the consequent part, similar to what has been coded in "word_ant"; a memory word "word_num_out" if the set of rules relating to more than one output variable, and the coded inference operation is the last to carry weight in the computation of the fuzzy output. In this way, the largest number of outputs can be 2 n , with n being equal to the number of bits in the word. In accordance with the inventive method, each rule is constructed from a sequential reading of certain memory words. Thus, rule (1) above would be coded with four words "word_ant", one word "word_cons", and one word "word_num_out". The composition of each memory word will now be discussed in greater detail, with reference in particular to the example of Figure 1, beginning with the word "word_ant" for the antecedent parts. A first field, denoted by the RET acronym, defines the rule structure. This field may just comprise one bit. In dependence on the value of the first field RET, the rule would have the following structure: If A op B op C....Then Z wherein no priority exists as would be commanded by the presence of brackets; alternatively, the rule structure could be as follows: If (A op B) op (C op D op E....) op ....Then Z wherein the presence of brackets does command predetermined processing priorities. The bit of the field RET communicates the opening or closing of the brackets, and is also used to indicate the memory word which is related to the consequent part. A second field, denoted by the OP acronym, represents the type of the fuzzy operator, either AND or OR. This field too could comprise a single bit. In the memory word related to the last antecedent part, the field OP takes a different meaning, and tells whether there are more rules to determine the fuzzy output or if the rule being processed is the last one, or in a specific case, the only rule. A third field, denoted by the M_INPUT acronym, comprises m bits, i.e. as many as there are input variables. This field M_INPUT indicates the input variable whose value is to be intersected by the membership function indicated in the next field, so that an "alpha" weight can be determined for the antecedent part being processed. A fourth field N_MBFs indicates the membership function to be used in computing the "alpha" weight. This fourth field comprises n bits which correspond to the number of membership functions that can be defined for each input variable. A fifth field POL, comprising a single bit, represents the third NOT operator in fuzzy logics. The possibility of indicating presence or absence of the NOT operator affords a complete set of operators. Some exemplary codings/processings by the method of this invention can be illustrated with the aid of Figures 2 to 8. Assume the following coding stipulations: RET=0 -- meaning that a rule of type (2) is to be processed; OP=0 -- identifying the OR operator; and POL=1 -- indicating the natural (i.e. non-negated) "alpha" value. Of course, different stipulations could be made. Referring to Figure 2, it can be appreciated that a rule of the type of "If A op B Then Z", having two antecedent parts, may be coded with one memory word for each antecedent part, and one memory word for the consequent part, giving a total of as few as three memory words, indicated in Figure 2 by the numerals 2, 3 and 4. The first word 2 comprises a field RET having a logic value of 1 which provides for the sequential processing of the fuzzy rule. The second field OP having a logic value of 1 indicates that the first antecedent part A is linked to the second antecedent part by an AND operator. In the second word 3, the field RET has a logic value of 1 because there are only two antecedent parts in the rule, and accordingly, the next memory word will be that related to the consequent part. On rare occasions, fuzzy rules may have to be processed which have just one antecedent part. In this case, the fuzzy rule coding with two operands would be used, and the antecedent part repeated. For example, the rule "If A Then Z" should be written as follows: if A or/and A Then Z, which is always coded with three memory words, as shown in Figure 3. A rule having three antecedent parts will now be considered, such as: if not A and B or C Then Z. Figure 4 clearly illustrates the possibility in this invention of coding with no more than four memory words. In the first word 2, the field RET=1 provides for the sequential processing of the fuzzy rule. The second field OP, having a logic value of 1, indicates that the first two antecedent parts A and B are linked by an AND operator. In the second word 3, the field RET has a logic value of 0, since the antecedent parts are more than two in the rule. A third memory word 5 is associated with the last antecedent part C and comprises a field RET=1. The next memory word 4 is related to the consequent part Z. Having gone this far, an example with four antecedent parts, as shown in Figure 5, becomes a natural to consider. A rule of the following type: if (A or not B) and (not C or D) then Z is coded with five memory words, as shown in Figure 5. The field RET=0 in the first word 2 indicates that the rule includes several bracketed pairs, and therefore, the operations in brackets should be processed in priority. In the second word 3, the field RET has a logic value of 1 to indicate the closing of the first partial operation "A or not B", which should then be stored into a temporary register denoted by 11 in Figure 10. An AND operator is associated with this temporary value as indicated by the second field OP with a logic value of 1 in the same word 3. The third memory word 5 is associated with the third antecedent part C and comprises a field RET=1 and a field OP=0 for coding the operation "not C or". The result of the partial inference operation "not C or D" requires an additional register 12 for storing the value to be compared with the contents of the previous register 11. A fourth memory word 6 is associated with the last antecedent part D and comprises a field RET=1. The field OP=0 indicates that the output Z does not enter the computation. In fact, the next memory word 4 relates to the consequent part Z, involving here a computation of the various weights ω i of the i-th rule, and is an indicator of the i-th action Z i to be effected in order to determine the output value. A further example will now be considered wherein the output is determined by processing a rule with three antecedent parts and one consequent part, and a second rule with two antecedent parts and one consequent part. Schematically represented in Figure 6 is the number of memory words required for determining this output. The first rule [If not A and B or C Then Z1] is coded with four memory words, as in Figure 4, and the second rule [If A op B Then Z2] is coded with three memory words, as in Figure 2. One word is necessary for the output Z, giving a total of eight memory words. It is interesting to observe that the field OP=0 in the third word 5 related to the first rule is indicating that a second rule should be processed, while the field OP=1 in the second word 3 related to the second rule is indicating the need for processing a final computation to obtain a fuzzy output as indicated by the eighth word 4. Other examples may be given, with larger numbers of antecedent parts in one rule, and increased complexity of the operations between parts. For example, a rule with five antecedent parts "If (A or B and C) or (D and not E) Then Z" would be coded with six memory words, as highlighted by Figure 7. The field RET=0 in the first word 2 is indicating presence of several bracketed pairs. The field RET=0 in the second word 3 is indicating presence of two or more antecedent parts in the computation of the first partial value [A or B and C], since the bracket is yet to be closed. The field OP=0 in the third word 5 implies that the previous partial value should be subjected to an OR operation with the partial result of a following inference operation [D and not E]. The field RET=1 in the fourth word 6 is indicating that we are now at the last bracket. A last coding example is illustrated in Figure 8, where the sequence of memory words are schematized which, in accordance with the invention, are necessary for coding a rule having seven antecedent parts, of the following type: If (A or B and C) or (D and not E) and (F and G) then Z. The field RET=0 in the first word 2 is indicating presence of several bracketed pairs. The field RET=0 in the second word 3 is indicating presence of two or more antecedent parts which contribute in the computation of the first partial value [A or B and C]. The last antecedent part C is identified by the field RET=1 in the third word 5. The field OP=0 in the third word 5 implies that the previous partial value should be subjected to an OR operation with the partial result of a following inference operation [D and not E] . The second partial value is defined by the field RET=0 in the fourth word 6 indicating a second and non-last bracket level, and by the field RET=1 in a fifth word 7. The result of the OR operation is stored into the two registers 11 and 12, and held within register 11. The field OP=1 in the fifth word 7 is indicating that that value should be subjected to an AND operation with a partial value enclosed within the last brackets [F and G]. The last-mentioned partial value is determined by the last two words 8 and 9, and stored into register 12. The value of the field RET=1 in the sixth word 8 is indicating that we are now at the last bracket level. As can be appreciated from this excursive discussion of various examples, the method of this invention allows a varying format to be used for coding each fuzzy rule. Stated otherwise, the coding of each rule is made possible with a number of memory words that varies according to the rule type. This enables serial processing of the rules and their variables, to provide enhanced flexibility and significant savings in the memory area occupied. This serial processing is schematized in Figure 9 step-by-step, where a flow diagram illustrates the various steps of processing and computing the weights, "alpha" and ω i , and their storing into the registers 11 and 12 whose contents correspond to the values M and k in this figure. Such advantageous features bring about additional benefits in terms of reduction and optimization of the electronic circuitry for decoding the memory areas intended to store the fuzzy rules. In this regard, a circuit architecture 30 implementing the inventive method will now be described with particular reference to the example of Figure 10. An electronic processor 15 is associated with this architecture 30 for the purpose of integrating the fuzzy logic control to the processing of arithmetic/logic operations as are typical of conventional processors. This processor will be denoted by an acronym W.A.R.P.3 hereinafter. This device is designed to process four input variables and sixteen membership functions. To this aim, two bits are required for defining the number of inputs, and four bits for defining the number of membership functions associated therewith. Accordingly, with memory words of eight bits, there remain but two bits available for defining the first RET, second OP, and fifth POL fields described hereinabove. The fields RET and OP are vital to the proper operability of the device in accordance with the inventive method. It has been selected of providing the field POL, which defines the "polarity" of a given antecedent part, through the use of a dedicated memory word. Therefore, eight bits have been defined which correspond in the same order to the polarities of eight antecedent parts of a fuzzy rule. Thus, a constraint has been imposed on the use of rules having more than eight antecedent parts. However, this constraint is not a heavily penalizing one, and could be removed by assigning several polarity bytes to the start of each rule coding sequence, for example. In essence, an initial byte 13 has been selected for the W.A.R.P.3 whose bits represent the polarities of eight possible antecedent "alpha" parts. This arrangement is shown in Figure 11, which is virtually a duplicate of Figure 2 but for the distinction of the initial byte 13. The following bytes 2, 3 and 5 provide for the two most significant bits to correspond to the previously described fields REL and OP. In particular, the eighth bit REL defines the rule type, and the seventh bit OP defines the fuzzy operator. The remaining six bits of each byte define the address of the membership function, namely: the sixth to fourth bits define one of the four inputs, as provided for by the third field M_INPUT; the last three bits define one of the sixteen membership functions associated with the corresponding input, as provided for by the fourth field N_MBFs. Figure 12 illustrates schematically this division of the memory word into its various fields as provided by the invention. Of course, for coding the consequent part Z, there would be a one-byte memory word 4 for each rule. The processor W.A.R.P.3 is denoted by the numeral 15 in Figure 10, and is connected bi-directionally to a memory 14 having eight-bit memory words. The processor 15 will select, on an output 16, a memory address whence information is to be retrieved, and receive, to an input 17, the data contained at that memory location. The processor 15 is also in communication with a processing circuit portion 18 intended for computing the inherent "alpha" value to an antecedent part of a fuzzy rule. For the purpose, the processor 15 will supply the values of the input variable and its membership function to this portion 18 through own outputs 19 and 20. The "alpha" value is used in an evaluation circuit block 25, referred to as the "omega" operator, to compute the so-called ω weight related to the antecedent part of the fuzzy rules. The block 25 also includes the registers 11 and 12. The weight ω i of the i-th rule is an indicator of the i-th action Z i to be effected, and contributes in the determination of the output Z value of the architecture 30. A circuit portion 27 is provided downstream from the block 25 to process the contributions from the various w weights by the known Centroid Method, according to the following formula: Σω i * Zi Σω i The value Z i is supplied by an output 21 from the processor 15, and the weight ω i of the i-th rule is the outcome of the processing at block 25. Control signals are directed by the processor 15 to all the components of the architecture 30 through an output 23. From the foregoing, the skilled person in the art will appreciate that, with the method and the architecture according to the invention, memories 14 having a standard word length, e.g. of one byte, can be used, thereby enabling memories to be also utilized which were originally designed for processors of different types. Thus, the method of this invention does solve the technical problem, and provides a number of advantages, foremost among which is the fact that the length of each memory word is tied to the number of input variables and the number of membership functions associated with each variable. Further, the information for computing the antecedent part of each rule is contained within a number of words equal to the number of antecedent parts. Briefly stated, the number of words used for coding each rule is a varying number, and is in fact tied to the number of antecedent parts of the inference rule.

Claims: A method of coding and storing fuzzy logic rules, wherein at least one inference rule of the IF/THEN type having a predetermined number of antecedent parts (A,B,C...) of fuzzy variables and at least one consequent part (Z) is decomposed and stored into memory words (10) to allow of subsequent processing using logic operators of the AND/OR/NOT type, wherein the coding of rules and variables is effected sequentially, and the decomposing is into a number of words variable according to the rules type, characterized by including for each antecedent part a memory word with at least a first field (RET) defining the opening or closing of brachets in the rule structure, a second field (OP) representing the type of the fuzzy operator, a third field (M_INPUT) indicating an input variable whose value is to intersect a membership function identified by a following fourth field (N_MBFs). A method according to Claim 1, characterized in that coding each rule comprises coding: a "word_ant" memory word for each antecedent part; a "word_cons" memory word for each consequent part; a "word_num_out" memory word if the set of rules relate to more than one output variable and the coded inference operation is the last to carry weight in the computation of the fuzzy output. A method according to Claim 2, characterized in that said coding said word_ant memory word for each antecedent part comprises coding more than one field. A method according to Claim 1, characterized by determining an alpha weight for the antecedent part being processed by intersecting said third (M_INPUT) field by the membership function indicated in said following fourth field (N_MBFs). A method according to Claim 1, characterized in that said coding the first and second fields comprises coding a single bit. A method according to Claim 1, characterized in that said coding the third field (M_INPUT) comprises coding m bits which corresponds to the number of input variables. A method according to Claim 1, characterized in that said coding the fourth field (N_MBFs) comprises coding n bits which corresponds to the number of membership functions definable for each input variable. A method according to Claim 1, characterized by coding more than one field additionally, by coding a fifth, single-bit field (POL) representing the negating (NOT) operator in fuzzy logic. A method according to Claim 1, characterized in that , in the memory word related to the last antecedent part of the rule, the second field (OP) takes a different meaning to indicate the presence or absence of further rules determining the fuzzy output (Z), when the rule being processed is the last or only rule. A circuit architecture for coding and storing fuzzy logic rules, comprising a memory (14) structured to store memory words (10) of at least one scanned inference rule of the IF/THEN type having a predetermined number of antecedent parts (A,B,C...) of fuzzy variables and at least one consequent part (Z) to allow subsequent processing using logic operators of the AND/OR/NOT type, comprising a fuzzy processor (15) connected bi-directionally to said memory (14), said fuzzy processor (15) being adapted to sequentially evaluate said coded fuzzy logic rules, decomposed into a number of words variable according to the rules type, characterized in that said memory includes for each antecedent part a memory word with at least a first field (RET) defining the opening or closing of brachets in the rule structure, a second field (OP) representing the type of the fuzzy operator, a third field (M_INPUT) indicating an input variable whose value is to intersect a membership function identified by a fourth field (N_MBFs). An architecture according to Claim 10, characterized in that said memory (14) is able to store : a "word_ant" memory word for each antecedent part; and a "word_cons" memory word for each consequent part. An architecture according to Claim 10, characterized in that it further comprises a processing circuit portion (18) structured to compute an alpha value inherent to an antecedent part of said coded fuzzy rule, an evaluation circuit block (25) for computing the so-called omega weight related to the antecedent part of the fuzzy rules, and a Centroid Method processing circuit portion (27) provided downstream from the evaluation circuit block (25) to process the contribution from the various omega weights. An architecture according to Claim 12, characterized in that said circuit block (25) includes registers (11,12) adapted to contain the values of partial operations of fuzzy inference.

Inventors: ARCIDIACONO LILIANA, DI BELLA DARIO, GIACALONE BIAGIO, PAPPALARDO FRANCESCO, ARCIDIACONO, LILIANA, DI BELLA, DARIO, GIACALONE, BIAGIO, PAPPALARDO, FRANCESCO
Applicants: ST MICROELECTRONICS SRL, STMICROELECTRONICS S.R.L.
Application year: 1996
Main classification: G06N7
IPC codes: G05B13, G06F9, G06N7