A Comprehensive Study of the Efficiency of Type-Reduction Algorithms

Improving the efficiency of type-reduction algorithms continues to attract research interest. Recently, there has been some new type-reduction approaches claiming that they are more efficient than the well-known algorithms such as the enhanced Karnik–Mendel (EKM) and the enhanced iterative algorithm with stopping condition (EIASC). In a previous paper, we found that the computational efficiency of an algorithm is closely related to the platform, and how it is implemented. In computer science, the dependence on languages is usually avoided by focusing on the complexity of algorithms (using big O notation). In this article, the main contribution is the proposal of two novel type-reduction algorithms. Also, for the first time, a comprehensive study on both existing and new type-reduction approaches is made based on both algorithm complexity and practical computational time under a variety of programming languages. Based on the results, suggestions are given for the preferred algorithms in different scenarios depending on implementation platform and application context.

particular interval type-2 fuzzy logic systems [1]. Interval type-2 fuzzy logic systems have been demonstrated to have better abilities to handle uncertainties than their type-1 counterparts in many applications [2]- [8]. However, the high computational cost of type-reduction algorithms makes it more expensive to deploy interval type-2 systems, especially for certain cost-sensitive real-world applications.
There have been a lot of type-reduction approaches proposed in the literature [9]- [21]. While some of the recent work on type-reduction approaches is based on continuous algorithms or general type-2 fuzzy systems [22], [23], this article focuses on discrete type-reduction approaches which are based on computing the centroid of an interval type-2 fuzzy set. The Karnik-Mendel (KM) algorithm is an iterative approach to determine the switch points when computing the centroids of IT2 fuzzy sets [9]. Type-reduction based on the KM algorithm is usually computationally intensive. Many attempts have been made to improve the efficiency of the KM algorithm. For example, the enhanced KM (EKM) algorithms have better initializations, which "on average ... can save about two iterations" [11]. They have been the most well-known algorithms for type-reductions and are still being widely used. Another well-known algorithm is the enhanced iterative algorithm with stopping condition (EIASC), which was proposed in [13]. The EIASC algorithm was reported to be superior to the KM and EKM algorithms when N , the number of discrete points in the universe of discourse for an IT2 fuzzy set, is small (e.g., N < 100).
Both EKM and EIASC are iterative-based algorithms. A direct approach (DA) for determining the switch points in the KM algorithm was introduced in [16]. It was shown by simulations in the R programming language that DA clearly outperformed other algorithms regardless of the shapes of fuzzy sets. An optimized version of the DA algorithm, termed the DA* algorithm, was later introduced in [20]. A recent algorithm called center-of-sets (COS) type-reducer without sorting requirement (COSTRWSR) was proposed in [17]. As highlighted in the name, this algorithm does not utilize sorting, which is required by the other abovementioned algorithms. It was illustrated in [17] that COSTRWSR is more efficient than six other enhanced variants of the KM algorithm.
Almost all of the abovementioned algorithms were proposed by claiming better performance based on only time comparisons. It has been mentioned in [20] that the computational efficiency of an algorithm is closely related to the platform, and how it is implemented. In computer science, the dependence on languages is usually avoided by focusing on the complexity of algorithms (using big O notation).
In this article, as a continuation of our previous work in [16] and [20], two novel type-reduction approaches are proposed. Also, a comprehensive study is made based on both algorithm complexity and practical computational time in order to give explicit recommendations on type-reduction algorithms. The rest of the article is organized as follows. Section II summarizes four existing related algorithms. Section III presents two new algorithms. Section IV compares the algorithm complexity and the practical running time efficiency of the well-known algorithms described in this article. After a brief discussion in Section V, Section VI concludes this article.

II. EXISTING RELATED ALGORITHMS
In this section, we briefly summarize related existing algorithms to establish terminology and notation.
Let an IT2 fuzzy setÃ be based on where x i is the primary variable in the discrete universe of discourse X (note that x i is in the ascending order for i from 1 to N ), J i represents the membership grade interval for the primary variable x i , and N is the number of discrete points in the universe of discourse of the IT2 fuzzy set. For any given embedded type-1 fuzzy set, 1 with membership grades u i ∈ J i for all i, of such an IT2 fuzzy setÃ, the centroid is defined as The centroid interval ofÃ is defined to be [c l , c r ], where c l and c r are the minimum and maximum possible values of c, respectively. The EKM [11], EIASC [13], and DA [16] algorithms are used to compute such a centroid interval as L and R, which are integer indices in the range of [1, N − 1], are known to be the switch points to minimize and maximize c l and c r , respectively. EKM and EIASC are iterative algorithms for determining the switch points. In contrast, DA (or the optimized version DA*) is a DA based on derivatives. Due to the space limitation, these algorithms are only briefly reviewed below. Detailed summarization can be found in the supplemental materials of this article.
Note that in the commonly used COS type-reduction, which concerns more general interval weighted average, x i may also be an interval denoted by [x i ,x i ]. In such cases, x i andx i should be used for computing c l and c r , respectively. However, in this 1 The definition of an embedded type-1 fuzzy set can be found in [24]. article, we do not distinguish between x i andx i for the sake of simplicity.

A. EKM Algorithm
As mentioned in [13], there could be numerical issues or potential infinite loops for the EKM algorithm. It was clarified that these issues can be prevented by preprocessing steps or extra checks (see [13,Appendix A]). However, it should be noted that these extra steps, especially when they are not well implemented, may make the EKM significantly slower. In this article, we have taken out the inefficient checks that were added in the implementation of EKM in [16].

B. EIASC Algorithm
A key difference between EIASC and EKM is that of how to select the next potential solution to the switch point for each new iteration. EKM requires a search that obviously costs more time. In contrast, EIASC is a brute force method that iterates all the solutions one by one. Note that such strategy of EIASC is a "double-edged sword." It reduces the complexity in finding the next solution, but makes EIASC an algorithm that heavily relies on loops. In fact, the use of loops is commonly not the first choice for efficient programming. As clarified in [20], loops are much less efficient in R than they are in MATLAB. This is the key reason for the unsatisfactory performance of EISAC in [16].

C. DA* Algorithm
It was found in [16] that the partial derivatives of c with respect to u j are in the ascending order with j from 1 to N . As illustrated in [16], the switch points are located at the indices where the sign of partial derivatives changes. Based on this, DA is a direct approach to find the switch points for type-reduction. In [20], the implementation of DA is optimized by eliminating some unnecessary computations and more efficient vectorizations. The optimized implementation is called DA*.

D. COSTRWSR Algorithm
COSTRWSR, which was proposed in [17], has a different basis to the abovementioned algorithms, not being based on the switch points. A table that summarizes the COSTRWSR algorithm can be found in the supplemental material of this article. Note that a key property of this algorithm is that there is no need to sort x i in any case. This can save a lot of computations compared to other algorithms (e.g., EKM) for which sorting is required in some cases. It has to be mentioned that the original COSTRWSR algorithm in [17] can be easily and clearly enhanced (e.g., by moving Step 3 out of the loop declared in Step 6). Given that another more efficient but simplified algorithm will be proposed in this article below, details of the enhanced COSTRWSR (ECOSTRWSR) algorithm will only be presented in the supplemental materials.

III. NEW ALGORITHMS
In this section, we propose two new algorithms.

A. Simplified COSTRWSR Algorithm
This section introduces a simplified COSTRWSR algorithm (SC). Note that, for the COSTRWSR proposed in [17], an extra parameter λ i ∈ [0, 1] was added to c. The algorithm COSTRWSR is based on a property of the derivatives. That is, for example, when the derivative of c with respect to λ j is positive, λ j must be 1 in order to get c r , or 0 to get c l .
In fact, such a property of the derivatives, as described above, can be used to obtain c l and c r without the need to add the extra parameter λ i . Specifically, the derivative of c with respect to u j calculated as ∂c can be used directly. Note that the denominator N i=1 u i is always positive, and, hence, it will not affect the sign of ∂c ∂u j . Let A j = x j − c, then when A j is positive, u j must be 1 in order to get c r , or 0 to get c l ; when A j is negative, u j must be 0 in order to get c r , or 1 to get c l .
A j and c can be rewritten as The SC algorithm is summarized in Table I.

B. Nonderivative-Based DA Algorithm
Recall that the DA algorithm is a direct approach to find the switch points for obtaining c l and c r based on the sign change of derivatives. This section introduces a new DA, which is not based on derivatives (DAND) for obtaining c l and c r .
Essentially, DAND is a brute force method to get c l and c r . There is no need to find the switch points. For example, by (2), we use all possible values of the switch point L from 1 to N to calculate and find the minimum value of c l . Similarly, by (3), c r can be found with all possible values of the switch point R from 1 to N . Note that (2) and (3) can be rewritten as follows: By using cumulative summation for some of the abovementioned terms (e.g., , the computational cost to obtain c l and c r can be reduced.
The DAND algorithm is summarized in Table II.

IV. COMPARATIVE STUDY
In this section, we compare the algorithms described above based on both algorithm complexity and practical 2 computational time.

A. Algorithm Complexity
Four existing algorithms (EKM, EIASC, DA*, and COSTR-WSR) and two new algorithms (DAND and SC) are compared based on the computational complexity. In this article, the complexity of each algorithm is determined by the number of calculations and comparisons for obtaining c l . The results are presented in Tables III-VI, and summarized in Table VII.
Note that Step 1 of COSTRWSR and SC is not considered since it is also used by other algorithms. Also note that the total numbers are approximations. Constant values are omitted when calculating the totals. For example, 2N − 1 is considered to be 2N .
As can be observed in Table VII, the results can be summarized as follows.
1) All these algorithms have a similar number of calculations and comparisons, except that SC seems clearly better than COSTRWSR (SC only needs approximately one sixth of the calculations of COSTRWSR).     Pseudocode is taken from [20], where more details can be found. The total number of calculations and comparisons are 10 N and N , respectively. Note that Steps 2-9 here, which are optimized for better performance in R, add an extra N calculations (in Step 3) compared to original steps of DA. This is not necessary if DA* is implemented in C or Java, where the total number of calculations can be reduced to 9 N by just using the original Steps 2-9 of DA. The number of calculations for Steps 4 and 5 can be reduced to 2 N and N , respectively. This can be achieved by adding a and b to the first element of XU and U , respectively, before calculating the cumulative sum. Hence, the total number of calculations is 10 N , or can be reduced to 8 N . The total number of comparisons is N .

B. Experimental Comparison
As discussed in [20], regardless of the algorithm used, the computational time difference between programming languages is very large. Results in one programming language cannot be simply extended to all languages. Hence, computational time comparisons were made under five commonly used programming languages (R, MATLAB, C, Java, and Python). Two example fuzzy sets from [16] and one control surface example from [25] are used for comparisons.
The test platform was a Macbook Pro (13- In our experiments, we start with the six algorithms described above in the complexity analysis. It was found that DAND is always more efficient than DA*, which is supported by the complexity analysis. Similarly, SC is always more efficient than COSTRWSR. Hence, to make the results more concise, only four algorithms (EKM, EIASC, DAND, and SC) are included in the time comparisons in this section. The results including the original COSTRWSR and DA* algorithms are presented in the Supplemental Material in Figs. S-1-S-3.

1) Generalized Bell-Shaped IT2 Fuzzy Sets:
The fuzzy sets used in this comparison are the same as those used in [16]. The vector X, containing x i , is uniformly distributed from 0 to 10. u i and u i are defined by generalized bell-shaped function as 3 where a and b are randomly selected between 1 and 2;ā is the multiplication of a with a random number between 1 and 2; c is a random number between 0 and 10.
To investigate the performance of algorithms under fuzzy sets of different size, N (the length of discretized X) is set to be 4, 16, 36, 64, 100, 144, 196, 256, 324, and 400 (10 different values). For each value of N , 5000 Monte Carlo simulations were made and the computational time costs were aggregated to be compared for each algorithm.
2) Generalized Randomly Shaped IT2 Fuzzy Sets: This experimental comparison is designed to be similar to the first comparison in [13]. As mentioned in Chapter 8 of Mendel's book [26], all kinds of type-reductions are related to computing the interval-weighted average, which requires solutions to two optimization problems, one of which leads to c l and the other to c r . Hence, this experiment is associated with center of sets type-reduction.
It is assumed that vectors X andŪ , containing x i andū i , respectively, are uniformly distributed from 0 to 1. u i is the multiplication ofū i with a random number between 0 and 1. Similar to the fact mentioned above for generalized bell-shaped IT2 fuzzy sets, N (the length of discretized X) is set to be 4, 16, 36, 64, 100, 144, 196, 256, 324, and 400 (10 different values). For each value of N , 5000 Monte Carlo simulations were made and the computational time costs were aggregated to be compared for each algorithm.
3) Control Surface Computation: In this comparison, twoinput and single-output IT2 fuzzy logic controllers (FLCs) using Gaussian membership functions (MFs) are considered [25]. Note that these FLCs are based on Takagi-Sugeno-Kang (TSK) models. Each input domain of a FLC has n MFs, and hence there are n 2 rules, where n = 2, 4, 6, . . ., 20. Each of the n 2 rule consequents is represented by a crisp number. Then, a type-reduction algorithm is required to compute the output of the IT2 FLC. The set of crisp consequents of all the rules can be considered as X. Hence, for the defuzzification of the fuzzy controller, N (the length of discretized X) is equal to n 2 .
The parameter settings of the fuzzy controller described above are as follows. The center of each MF is given by a random number uniformly distributed from −1 to 1. The uncertain standard deviations of each MF are uniformly distributed from 0.1 to 0.5. The crisp consequent values of each rule for the FLC are uniformly distributed from −2 to 2.
To generate the control surface, each input domain is discretized into ten points from −1 to 1. Hence, computing a complete control surface for one FLC requires 100 (10 × 10) defuzzifications (computations of centroids). For each N , 50 FLCs based on the settings described above are generated for the comparison of algorithms. This means, for each N , there are 5000 (100 × 50) type-reductions to be performed by each algorithm in the comparisons.

C. Experimental Results
The results of the abovementioned three experimental comparisons are shown in Figs. 1-3, respectively. The comparisons for the specified value of N are also presented in Tables VIII-X. Here, one algorithm is considered to be more efficient than another if its computational time is smaller. Below, we briefly summarize the results observed.
For all the three cases, first, in MATLAB, EIASC performs mostly the best. We use the word "mostly" here since the computational time of EIASC is quite close to DAND and SC. For some values of N , EIASC does not give the shortest computational time. Second, in R and Python, DAND is shown to be the most efficient, while EIASC and SC are much worse than other algorithms.
For the first case where sort is not needed for all the four algorithms (see comparisons in Fig. 1): 1) in C, EIASC is the best except for small N (less than 200), where SC is the most efficient; 2) in Java, without considering the anomaly when N is 200, DAND is the quickest for most values of N ; 3) in MATLAB, SC performs as good as EIASC and they are both more efficient than other algorithms. For the other two cases where sort is needed for all algorithms except SC, the results are shown in Figs. 2 and 3. First, in C and Java, SC performs remarkably better than other algorithms. Second, in MATLAB, SC is more efficient than other algorithms when N is small (e.g., N < 100, as shown in Figs. 2  and 3).    Table VII, the number of calculations for DA* and DAND can be simplified to 9 N and 8 N , respectively. However, such simplifications do not reduce the practical computational time clearly since operations with indices are required for the simplifications. Furthermore, in practice, the computational complexity is not necessarily the only factor affecting the efficiency of algorithms, especially when they have the same computational complexity, which is O(N ). For example, the practical efficiency of an algorithm is closely related to its implementation. Also, the runtime environment is also important for the efficiency of algorithms. As can be observed from the results mentioned above, EIASC performs the best in MATLAB, but much worse in R and Python. Results could also be different when comparisons are made under various operating systems or hardware (i.e., the compute infrastructure on which the codes run). Also note that for real-time applications results in C are more crucial as C/C++ are normally used for such applications. The total number of calculations and comparisons are (19p + 9q)N and (2p)N , respectively. According to experiments, p is on average 3 with a maximum of 4, and q is on average less than 1.1. Hence, the total number of calculations and comparisons are on average less than 86 N and 8 N , respectively.

TABLE XII COMPUTATIONAL COMPLEXITY OF SC FOR OBTAINING c l
The total number of calculations and comparisons are (2p + 3r + 3s + 4)N and (2p + r + s)N , respectively. According to experiments, p is on average 3 with a maximum of 4, and (r + s) is on average less than 0.6. Hence, the total number of calculations and comparisons are on average less than 14 N and 9 N , respectively.
As illustrated in Tables III-IV, the number of calculations and comparisons for DAND only depends on N . For other algorithms, they also depend on the number of iterations. For example, EKM and EIASC also depends on L and m. Note that L and m vary for each specific case given a fixed number of N . As discussed in [20], DAND is more desirable for real-time control problems when the computational time of the algorithm needs to be known in advance.
In our experiments, the comparison based on generalized bellshaped IT2 fuzzy sets is representative of the type-reduction on ordinary IT2 fuzzy sets. For such type-reductions, sort is not needed for X. The experiments based on generalized randomly shaped IT2 fuzzy sets and the control surface computation can be considered as the same scenarios. For type-reductions in these scenarios, the sorting process for X is required. It has to be mentioned that sort only needs to be done one time in many cases. For example, for applications based on TSK fuzzy models where the rule consequents are fixed values, sorting only has to be done once and it can be normally achieved offline (e.g., during the design process).
Note that a key property of SC is that there is no need to sort x i in any case. This makes a clear difference for the comparisons made in C and Java. For example, as can be observed in Fig. 1, SC performs worse than other algorithms when sort is also not required for other algorithms. But, it is clearly more efficient than other algorithms, which need sort in Fig. 2. However, the sort process does not make too much difference for SC in MATLAB, R, and Python.
In summary, though there are some differences among the number of calculations and comparisons, the asymptotic time complexity of all algorithms is O(N ). The practical time efficiency of algorithms varies under different programming languages. There is no single best algorithm for all cases. An appropriate algorithm should be selected based on specific needs (e.g., for which application and on which platform). Based on our comparisons, it is suggested that the following hold.
1) EIASC is in general the best choice in MATLAB.
2) DAND is the best to use in R and Python.
3) In C and Java, SC should be the best choice when sort is needed for x i (e.g., the type-reduction and defuzzification process of FLCs); otherwise, EIASC is preferential (e.g., sort is not needed for the type-reduction of interval type-2 fuzzy sets). 4) DAND performs generally as good as EIASC in MATLAB, C, and Java. 5) Given that the complexity of DAND only depends on N , DAND is more desirable for real-time control problems when the computational time of the algorithm needs to be known in advance.

VI. CONCLUSION
In this article, two novel type-reduction algorithms (DAND and SC) have been proposed. A comprehensive comparison has been made with other existing algorithms. The comparisons were based on both algorithm complexity and practical time efficiency. Results showed that all the compared algorithms have the same asymptotic time complexity O(N ). On the other hand, the practical time efficiency of algorithms varies under different programming languages. All algorithm code and experiments are available online [27]. The results showed that there is no single algorithm, which is best for all cases. Suggestions for the algorithms to be used in different scenarios have been given based on our comparisons. For example, the algorithm to be used may be different depending on whether a sort for X is required. Generally, sorting is not needed for type-reductions on ordinary fuzzy sets. For type-reduction in computing the outputs of IT2 TSK fuzzy models, sorting is required. Note that for many applications (e.g., IT2 TSK fuzzy models where rule consequents are fixed values), sorting only needs to be done once offline. For such cases, algorithms can be selected based on the suggestions that are given for applications without sorting.
Though comparisons have been made under five commonly used programming languages, future work could be done with more languages. It has to be mentioned that current suggestions are given mainly based on programming languages. It may be worth a further exploration of the efficiency of these algorithms in different types of real-world applications or scenarios in future work. Also, this article focuses on discrete type-reduction approaches for interval type-2 fuzzy sets. In the future, study could be done with other approaches for general type-2 fuzzy systems.
Jamie Twycross received the B.Sc. (Hons.) degree in mathematical physics from Imperial College, London, U.K., in 1993, the M.Sc. degree in evolutionary and adaptive systems from the University of Sussex, Brighton, U.K., in 2002, and the Ph.D. degree in computer science from the University of Nottingham, Nottingham, U.K., in 2007.
He is an Assistant Professor of computer science with the University of Nottingham. He has expertise in computational and mathematical modeling, data analytics, machine learning, and software engineering. His main research interest is in computational biology, where he works at the interface of computer science and biology to develop and apply computational and mathematical approaches to address biological and digital problems.
Dr. Twycross is a member of the Intelligent Modelling and Analysis Group, and leads the Modelling Group with the Synthetic Biology Research Centre, University of Nottingham. He is currently an Emeritus Professor of electrical engineering with the University of Southern California, Los Angeles, CA, USA, where he has been since 1974. He is also a Tianjin 1000-Talents Foreign Experts Plan Endowed Professor, and Honorary Dean of the College of Artificial Intelligence, Tianjin Normal University, Tianjin, China. He has authored and coauthored more than 580 technical papers and is author and/or coauthor of 13 books, including Uncertain Rule-based Fuzzy Systems: Introduction and New Directions, 2nd ed. (Springer, 2017)