Reducing Computational Overhead by Improving the CRI and IRI Implication Step

In conventional SISO fuzzy expert systems (n-element input, m-element output), the implication step requires the O(n × m) operations using compositional rule-based inference (CRI) and individual rule-based inference (IRI). However, this introduces excessive complexity. This paper proposes two methods, sort compositional rule-based inference (SCRI) and sort individual rulebased inference (SIRI) aiming at reducing both temporal and spatial complexity by changing the operation of the implication step to O((n + m)log 2 (n + m)). We also propose a divide-and-conquer technique, called Quicksort, to verify the accuracy of SCRI and SIRI algorithms deployment to easily outperform the CRI and IRI methods.


Introduction
The inference compositional rule (CRI) was first proposed by Zadeh [1] to solve the fuzzy modus ponens (FMP) and fuzzy modus tollens (FMT) models.Later Dubois and Prade [2] introduced two approaches to present the inference of a set of parallel rules for solving the local inference approach, known as IRI, and the global inference approach, which is known as CRI.Many researches have been conducted on CRI and IRI.The first topic is "aggregation operator" [3] introducing two methods to deal with aggregation operator issues.The first infer then aggregate (FITA) is known as IRI, and the first aggregate then infer (FATI) is known as CRI.They attempt to find an operator for CRI and IRI aggregation.Assilian [4] used the max-min method.A "min" operator is selected as a conjunction in the rule premise and the implication function while a "max" operator is used for aggregation.Dubois [5] used a "min" operator for aggregation in decision-making.To reduce the computational time, the authors [6,7] replaced a MISO fuzzy rule with an equivalent collection of SISO rules with two kinds of aggregation operators.
The second topic involves fuzzy logic application in many fields using the CRI method, the second topic.Mamdani [8] applied fuzzy logic in designing controllers for industrial plants.Reference [9] applied an adaptive fuzzy inference scheme to stock data and showed that the adaptive fuzzy rule-based schemes provide clean decision to buy, hold, and sale.Reference [10] proposed a fuzzy interval reasoning (FIR) and [11] introduced a fuzzy logic controller to serve web shopping.The third topic is new algorithms based on the CRI context.Reference [12] presented a new feedback method based on CRI (FBCRI) to improve the robustness of CRI fuzzy reasoning methods.Reference [13] introduced a CMI (compatibility modification inference), which is reduced by CRI.References [14][15][16][17][18][19][20][21] developed the Triple I method, based on CRI imperfections.Accordingly, [14] proposed the full implication Triple I method (a hybrid method based on implication and composition), designed as a supplement for the CRI method.Reference [15] proposed the Triple I FMP and FMT for generalized -triple I method.An investigation into a formalized Triple I method is reported in [16] where the authors tried to set a sound logical foundation for the unified TI algorithms.Accordingly, other researchers developed new implications, the fourth topic.Reference [22] proposed a new implication: "nilpotent minimum implication." Other researchers studied Mamdani and Sugeno type fuzzy model applications, the fifth topic.Reference [23] showed the advantage of Sugeno type fuzzy inference system in that it can be integrated with neural networks and genetic algorithms or other optimization techniques.In [24] the Mamdani and Sugeno models are used to compute the resonant frequency of rectangular microstrip antennas (MSAs) with thin and thick substrates.Finally, [25] implemented a supervised learning method based on membership function training in the Mamdani fuzzy model context.Specifically, the autozoom function of a digital camera is modeled adopting the Mamdani technique.
We have shown five research topics to view that the improvement of CRI and IRI has never been done.SCRI and SIRI are used to reduce the computational time and space complexity of CRI and IRI in this research.Suppose that there are  rules in a fuzzy expert system rule base and they are defined as where   and   ,  = 1, 2, . . ., , are fuzzy sets defined in the universe of discourses  and , respectively.Two basic methods are used to obtain a meaningful inference for a given observation   .The first method, CRI, includes three steps: (1) implication, (2) aggregation, and (3) composition.The second method, IRI, includes three steps: (1) implication, (2) composition, and (3) aggregation.The two methods include the same implication step, which includes two substeps: cylindrical extension and calculating relational matrix using a space of (×) and an operation of (×).The main contributions of this paper are as follows.
(i) This paper clearly showed the advantages of CRI comparing to IRI in SISO fuzzy system.(ii) This paper proposes two methods, sort compositional rule-based inference (SCRI) and sort individual rulebased inference (SIRI), aiming at reducing the operation of the implication step from ( × ) to (( + )log 2 ( + )).

Multiple Fuzzy Reasoning Schemes
2.1.Quicksort.This study adopted a method referred to as Quicksort, a divide-and-conquer method, which proceeds through four steps: (1) arbitrarily select an element in the array (the pivot), (2) divide the array into two subarrays of uneven size (the partition phase), (3) sort the subarrays recursively, and (4) position the pivot between the two sorted subarrays to obtain the final sorted array.The Quicksort performance depends on the pivot elements in the array, as outlined below.
2.1.1.The Worst Case.The worst case scenario occurs when the pivot element is the largest or smallest element in the array.In Figure 1, the pivot element is the smallest element in the array.The total number () of comparisons performed by Quicksort in sorting an array of size  is calculated as where (0) = (1) = 0 is assumed,  is the final position of pivot element, and () is the total number of comparisons performed by Quicksort in sorting an array of size , which is the number of comparisons that any partitioning algorithm can perform.Accordingly, the reason is that every element other than the pivot must be compared to the pivot.Moreover, ( − 1) in ( 2) is the number of comparisons of left subarray by recursive call to Quicksort, and ( − ) is the number of comparisons of right subarray by recursive call to Quicksort.In the worst case, the parameter, , can be assigned as 1 or .
For example, when assuming that  is equivalent to 1, then (2) becomes and while  ≫ 1, the last equation becomes Several appropriate pivot selection methods have been devised: (a) first element, (b) last element, (c) median-ofthree elements, and (d) random element.It is worth noting that Quicksort generally chooses a pivot at random, which greatly reduces the likelihood for the worst case occurring and tends to work very well.The other means of avoiding the worst case is the median-of-three elements.

The Best Case.
As shown in Figure 2, the best case has the pivot element with the middle element in the array.To know the total number () for the best case,  = ( + 1)/2 is considered and the results from (2) are obtained as () =  + 2(( − 1)/2).It can be approximately examined as It should be noted that, after the th calculation step, this recurrence will continue only until  = 2  (otherwise we have /2  < 1), that is, until  = log 2 .Thus, by putting  = log 2  into the previous equation, the equation can be obtained as follows: 2.1.3.The Average Case.The average case occurs when the pivot element is near the middle element in the array (random pivot).As shown in Figure 3, random pivots are used to generate the average case in the recursion tree for Quicksort.In summary, three cases are used to understand the calculation complexity for the Quicksort algorithm.Currently, there is an axiom that could be decided.
Theorem 1.The average case in Quicksort has the expected run time of (⋅log 2 ), with  as the number of elements in the array.
Proof.The Harmonic numbers are given as It is assumed that each possible pivot  is selected with equal probability, therefore, (2) can be averaged over all , that is given as By substituting  = −1 and  = − into the last equation, the averaged equation can be determined as If the last results are taken into account, the developed recurrence becomes (see Appendix A) By dividing the last equation with ( + 1), it is written as After the assignment of () = ()/(+1), the recurrence becomes as follows: where the (1) = 0 is considered in the previous equation.In the advanced method, the recurrence is able to be performed as moreover, when  ≫ 1 is considered, then The worst case has the biggest or smallest pivot element in the Quicksort array, as discussed in Section 2.1.1.Table 1 shows that merge sort and Quicksort have the same time complexity of ( log 2 ).Quicksort is the best one of the four algorithms because its space overhead is only (1).

SISO Multirule System.
Suppose that  rules exist in the fuzzy expert system rule base as follows: where   and   ,  = 1, 2, . . ., , are fuzzy sets defined in the universe of discourses  and , respectively.

The Comparison of CRI and IRI
(1) CRI and IRI Schemes.In order to achieve a meaningful inference result based on Zadeh's compositional rule of inference (CRI) [2], for a given system observation there are two basic methods adopted as important illustrations.
The first one is called CRI or FATI (first aggregate then infer) [3].In this first method, for a given observation of   , the implication is the first step performed to calculate the relational matrix given as where   is the fuzzy implication relation for rule  and  denotes the implication method.All of the rules are then aggregated by structuring an overall fuzzy relation  which is the combination of all relational matrixes and written as where  indicates an overall fuzzy relation and ∪ is defined as a combination operator of all the fuzzy implication relations.The last equation is with a final result based on a given observation   and shown as where ∘ represents composition within the CRI context and   is an inference result.The second one is called individual rule-based inference (IRI) or FITA (first infer then aggregate) [3].For a given observation   , we first perform the implication step to calculate the relational matrix as follows: where   denotes the fuzzy implication relation for rule  and  is the implication method.
A result for every rule based on a given observation   is then inferred as where    is the inference result based on rule .Finally, all of these intermediate results are combined and determined as Table 2 showed the CRI and IRI schemes.(2) Time Complexity.In Table 3,  represents the number of rules,  is the number of elements in the input, and  indicates the number of elements in the output.Assume that minimum and maximum operations require the same effort.Applying (16) to each rule, every   requires  operations and results in the implication step with  rules requires  operations.Based on (17), the aggregation of  relation matrixes requires ( − 1) operations.The CRI composition requires  operations for intersection and ( − 1) operations for projection.Both intersection and projection are calculated using (18).To infer a conclusion from a SISO  rules with CRI method, the total time can be easily determined as where  CRI denotes the CRI method time complexity.Using the result for every rule based on a given observation shown in (19), the IRI implication requires  operations for every relational matrix   , and so with  relational matrixes it is just  operations.The IRI composition requires  operations for intersection and ( − 1) operations for projection.Both intersection and projection are calculated using (20).Adopting (21), the IRI aggregation of  conclusions    will obtain ( − 1) operations.A conclusion from SISO  rules can be derived with the IRI method, with the total time measured as where  IRI is the IRI method time complexity.The advantage of CRI compares to IRI in SISO rules expressed analytically in terms of gain  as By substituting ( 22) and ( 23) into the last equation, the gain becomes The formula shows that gain  is always bigger than 1.We pointed out that the CRI method time complexity is less than the IRI method time complexity in the SISO rules expert system.
(3) Space Complexity.In Table 4, the same definition expressed in Table 3 is used for , , and , assuming that every element requires one cell.Applying (16) to each rule, each   requires  cells and results in the implication step with  rules requires  cells.Based on (17), it is clear that the aggregation of  relation matrix requires  cells.Using (18), it is known that the composition of CRI requires  cells for intersection and  cells for projection, respectively.In general, to infer a conclusion from SISO  rules with the CRI method, the required space is determined using the biggest space from all steps and obtained as

𝑂 (𝑟𝑛𝑚) .
( To determine the implication that IRI requires  cells for every relational matrix   using (19), that is, with , relational matrixes  cells are necessary.Based on (20), the IRI composition requires  cells for intersection and  cells for projection, respectively.Therefore, with (21) the aggregation of  conclusions    requires  cells.Hence, to infer a conclusion from SISO  rules with the IRI method, the required space can be determined using the biggest space from all steps and written as  () . ( For the purpose of optimization, CRI combines step (1) (implication) with step (2) (aggregation); thus, it is easily understood that CRI needs a space of ().IRI requires a space of () to store  relational matrixes in the implication step.It is worth noting that the CRI method space complexity is less than the IRI method space complexity in the SISO rules expert system.
Filling all of the columns in the related matrix using the -projection is cylindrical extension from -projection which is shown in (28).Similarly, cylindrical extension from -projection means filling all of the rows in the relation matrix using the -projection as shown in (29).Calculating relation matrix is the second substep to be defined and it is written as where   is the relation matrix for rule  and    = min(   ,    ),  = 1, 2, . . .., ;  = 1, 2, . . ., .The implication is "min" as Mamdani fuzzy model.Aggregation, the second CRI method step, is defined as where  is the overall relation matrix, which is calculated by combining all of the relation matrix   with  = 1, 2, . . ., .
Composition is the final CRI step and it is defined as (see Appendix B) where   ex is extended by   ,   is the inference result which is calculated by compositing the observation   with the overall relational matrix , and ∘ represents the composition method.
(2) SCRI (Sort CRI).In this subsection, the SCRI method is introduced.It includes three steps.The first step is implication which has two substeps.The first substep is sorting program and the second substep is getting relational matrix.The second step is aggregation defined as  = ⋃  =1   .Composition is the third step and given as   (V) =   ∘  = sup min(  ex, ), where   ex is extended by   .Moreover, let us discuss the SCRI method implication step in detail.The SCRI implication has two substeps.The matrix   is necessary for processing the first sorting program step, which can be expressed as where the elements in the first row of (33) are a combination of   and   with   = [  1 ,   2 , . . .,    ],   = [  1 ,   2 , . . .,    ].In addition, the second row of (33) has two arguments for every cell in the first row.The first argument could be "1" or "2" depending on whether the cell in the first row belongs to   or   , respectively.Moreover, the second argument for the second row in (33) could be    or    ; that is, . ., and    = ,    = , where    and    belong to   and   , respectively.
To sort the matrix   based on the 1st row is the second step which is obtained as The Quicksort algorithm then sorts the   as where   1 is minimum of the 1st row,   + is maximum of the 1st row, and  + is 1 or 2 to indicate that the value   + (3) CRI and SCRI Schemes.Table 5 showed the CRI and SCRI schemes.In the implication step, the main CRI operation is "calculating relational matrix" and the main SCRI operation is "sorting program." (4) Time Complexity.SCRI is an improvement method from correcting the CRI implication step.The time complexity of the implication step for these two methods is compared and the results are shown in Table 6.The same , , and  parameters and the Quicksort are adopted for the SCRI sorting program.Following Theorem 1, the time complexity of an array with ( + ) elements is (( + )log 2 ( + )).With SISO -rule fuzzy system, the time complexity of the implication step of SCRI method is denoted as Based on (30), the time complexity of the implication step for CRI method can be determined as The input dimension equals the output dimension in Figure 4 and the number of rules is 10.The red line (curve for CRI) shows the relation of  (dimension of input and output) and  (operations), and the blue line (dash curve for SCRI) shows the relation of  (dimension of input and output) and  (operations), respectively.Moreover, the green line shows a reference line with the input dimension as 40 and the output dimension as 40.The red point in the red line with input dimension = 40, output dimension = 40, and the number of rules = 10 shows CRI = 16000 operations.The blue point at the blue line with input dimension = 40, output dimension = 40, and number of rules = 10 shows CRI = 5058 operations.It is clear to see that the CRI method time complexity is greater than the SCRI method time complexity.
(5) Space Complexity.In this subsection SCRI is discussed as an improvement in the CRI implication step.The implication step space complexity of the CRI and SCRI methods is shown in Table 7.By substituting , , and  of the output elements into (30) for every relational matrix, the CRI needs a space of ().With SISO  rules the CRI needs a space of ().Thus, based on (34), for every relational matrix, it is known that SCRI needs a space of ( + ).With SISO  rules, SCRI needs a space of () to store  relational matrixes.
Based on (34), for every relational matrix, SCRI just needs a space of ( + ) but applying (30) CRI needs a space of ().
The second substep is calculating relation matrix defined as where   is the relation matrix of rule .The implication is "min" as Mamdani fuzzy model.The second step of IRI method is composition which is defined as  where    is the inference result of rule  and it is calculated by composing observation   with the relational matrix   of rule  and ∘ represents the composition method.The third step of IRI is aggregation defined as where   is the final inference result.It is calculated by combining all of the inference results    with  = 1, 2, . . ., .
(2) SIRI (Sort IRI).Containing three steps for SIRI method, the first step is implication which involves two substeps.The first substep is sorting program and the second substep is getting relational matrix.The second step is composition defined as    =   ∘   , and the third one is aggregation defined as   = ⋃  =1    .Furthermore, the SIRI implication has two more substeps.The first substep is sorting program.The matrix   is generated as where the elements in the first row of ( 43  Sort the matrix   based on the 1st row and obtained as After taking the Quicksort algorithm, the final   is sorted as where   1 is minimum of the 1st row and   + is maximum of the 1st row and  + is 1 or 2 to indicate the value   + belonging to   or   , respectively. + in (45) is used to define the position of the value   + in   or   depending on  + which is 1 or 2, respectively.The second substep is getting relational matrix, which has  +  steps.In the first step, let us consider the condition of  + as if  + = 1, then all values in the  + th row of   are equal to   + ; if  + = 2, then all values in the  + th column of   are equal to   + .In the next step, consider the condition of  +−1 , and keep on the algorithm until  1 .
(3) IRI and SIRI Schemes.The main IRI operation is "calculating relational matrix" and the main operation of the SIRI belongs to "sorting program." The operation schemes of IRI and SIRI are listed in Table 8.
(4) Time Complexity.The comparison results are shown in Table 9.Three parameters , , and  and Quicksort are used for the SIRI sorting program to verify the time complexity.The time complexity of an array with (+) elements is ((+ )log 2 ( + )) which can be determined from Theorem 1 again.With SISO -rule fuzzy systems, the time complexity of the implication step of SIRI method is  ( ( + ) log 2 ( + )) .
(46) Furthermore, the time complexity of the implication step of IRI method can be obtained from (40) and expressed as  () .
(47)   In order to understand the operation complexity of these methods, the results from time complexity comparison are shown in Figure 5.The input dimension is considered equal to the output dimension.The number of rules is set to 10. Red line (curve for IRI) shows the relation of  (dimension of input and output) and  (operations).On the contrary, the blue line (dash curve for SIRI) represents the relation of  (dimension of input and output) and  (operations).On the other hand, the green line is a reference line which with the input dimension is 50 and the output dimension is 50.Red point, at the red line with input dimension = 50, output dimension = 50, number of rules = 10, shows operations of IRI = 25000 operations.Blue point, at the blue line with input dimension = 50, output dimension = 50, and number of rules = 10, showed operations of SIRI = 6644 operations.As previously described, it is clear that the IRI operations are definitely larger than the SIRI operations.
(5) Space Complexity.In this subsection, the space complexity of the SIRI implication step is shown.This is an improvement in the IRI implication step.In Table 10, the space complexity of IRI and SIRI is illustrated with the , , and  parameters again.By taking account of every relational matrix into (40), the space complexity of () is for IRI; on the contrary, with SISO  rules the IRI requires space of ().
Based on (44) for every relational matrix, SIRI just needs a space of ( + ) but applying (40) IRI needs a space of ().

Conclusion
The SCRI and SIRI schemes for improving CRI and IRI operation performance for the fuzzy control theoretical approach are proposed in this paper.The previous methods were proven to reduce the time and space complexity for fuzzy expert systems by improving the most important step (implication).It was shown that the time consuming, for example, the implication step, needs an operation of (×), in the traditional methods with compositional rule-based inference (CRI) and individual rule-based inference (IRI) will be significantly decreased as ((+)log 2 (+)).With SISO multirule systems the two SCRI and SIRI schemes are proven to perform much better than CRI and IRI in time and space complexity.This paper generated better SCRI (Sort CRI) and SIRI (Sort IRI) performance in which two can replace the traditional CRI and IRI using the Mamdani implication, respectively.We are going to extend these results for MISO and MIMO fuzzy systems in the future works.

Figure 1 :
Figure 1: The worst recursion tree case for Quicksort.

Figure 2 :
Figure 2: The best recursion tree case for Quicksort.

Figure 3 :
Figure 3: The average recursion tree case for Quicksort.

Table 3 :
CRI and IRI time complexity comparison.

Table 4 :
CRI and IRI space complexity comparison.

Table 6 :
CRI and SCRI time complexity comparison results.belongs to   or   , respectively. + in (35) is used to specify the position of the value   + in   or   depending on whether  + is 1 or 2, respectively.The second substep is getting relational matrix, which has  +  steps.In the first step, consider the condition of  + as if  + = 1, then all values in the  + th row of   are equal to   + ; if  + = 2, then all values in the  + th column of   are equal to   + .In the second step, consider the condition of  +−1 , and keep on continuing until  1 .

Table 7 :
CRI and SCRI space complexity comparison.

Table 9 :
Comparison of the time complexity of IRI and SIRI.