## 4 Methodology
### Implementation Using 'SciKit-Fuzzy' Library  
We utilized _SciKit-Fuzzy_ (version 0.4.2), a fuzzy logic toolbox for Python. This package (also known as'skfuzzy') provides a variety of useful tools for projects involving fuzzy logic. We implemented this approach using the 'compute' method of a 'ControlSystemSimulation' object from the'skfuzzy' library. This method transforms inputs into fuzzy truth values, evaluates them against fuzzy logic rules, combines the results, and converts them back into crisp outputs. The'skfuzzy' library is designed for fuzzy logic controllers, which rely on fuzzy set theory, fuzzy if-then rules, and fuzzy reasoning.  
First, we created an instance of 'ControlSystemSimulation' with a specific 'ControlSystem' (e.g.,'sub_system2'), which includes fuzzy rules, membership functions, and relationships between input and output variables. We assigned precise values to the input variables, which were then fuzzified using the 'compute' method.  
The **fuzzification process** uses membership functions (explained in Section 4.2) to determine the truth values for each part of the fuzzy sets defined for the input variables. The system then evaluates the fuzzy rules, where each rule's antecedent (if-part) is checked against the fuzzified inputs to determine its truth value using fuzzy logic operators. The consequent (then-part) uses these truth values to influence the output variables' membership functions.  
After evaluating all the rules, the **aggregation process** combines the fuzzy outputs from each rule into a single fuzzy set for each output variable using the **maximum operator**. Finally, the 'compute' method **defuzzifies** these sets into precise outputs using methods like the **centroid method**. This precise value is the final output used by the fuzzy control system for decision-making.  
The centroid method computes the precise value as the center of gravity of the shape formed by the membership function of a fuzzy set. The formula for the centroid \(C\) of a  
Figure 5: The _decisionMade_ predictor after applying weight factors.  
fuzzy set \(A\) with a membership function \(\mu_{A}(x)\) defined over a universe of discourse \(X\) is given by:  
\[C=\frac{\int_{X}x\times\mu_{A}(x)dx}{\int_{X}\mu_{A}(x)dx} \tag{5}\]  
Here, \(x\) is a point in the universe of discourse, and \(\mu_{A}(x)\) is the membership value at \(x\). The numerator of the fraction computes the weighted sum of all points, where the weights are the membership values. The denominator computes the area under the curve of the membership function, which normalizes the result. For discrete systems, the formula is approximated as:  
\[C=\frac{\sum_{i=1}^{n}x_{i}\times\mu_{A}(x_{i})}{\sum_{i=1}^{n}\mu_{A}(x_{i})} \tag{6}\]  
where \(x_{i}\) are discrete points and \(\mu_{A}(x_{i})\) are their corresponding membership values.  
The computational complexity of the centroid method depends on several factors. In practical implementations, especially for computational purposes, the continuous membership functions are discretized. A finer discretization improves the accuracy of the centroid approximation but increases computational costs. Simple shapes with analytical forms can be integrated easily, whereas complex or piecewise functions require more computational effort. Each output variable with its own fuzzy output set requires separate defuzzification, multiplying the computational workload. The centroid method's computational time is predominantly influenced by the number of calculations involved in both the numerator and the denominator. For each segment or point in the discretized output fuzzy set, a multiplication and a summation operation are required. Thus, the time complexity in a discrete setting can be estimated as \(O(n)\) where \(n\) is the number of points in the discretized domain.