# A Proposal for IoT Dynamic Routes Selection Based on Contextual Information
## 3 Proposed Approach
### Proposed Approach
#### 3.2.2 Fuzzy System-Based Route Classifier  
According to [21], several techniques of Computational Intelligence (CI) have been used to solve routing problems in WSNs. Intelligence techniques reinforce the efficiency of routing protocols in decision making to optimize the network performance. In order to decide efficiently on the choice of the best route among those available, fuzzy logic was used to provide a rigorous algebra to deal with inaccurate information, since it is a convenient method of combining conflicting objectives and specialized human knowledge and allowing implementation in low complexity algorithms. To ensure greater consistency in decision making during the routing process, this paper proposes a route classifier based on fuzzy systems, as shown in Figure 2, capable of estimating the degree of quality of the routes, in order to classify them, with the purpose of assisting the selection of routes in IoT scenarios. The route classifier uses as input the values assigned to the metrics (present in the objective functions) specified in Expressions (14)-(16) to rank the routes in order of quality. The trapezoidal form was chosen for the pertinence functions, since it is widely used in fuzzy logic systems [22]. \[NETX\cdot FETX\ (ni) \tag{14}\]  
\[NNS\cdot FNS\ (ni) \tag{15}\]  
\[NEC\cdot FEC\ (ni) \tag{16}\]  
where:  
* \(NETX\) is the ETX priority level;
* \(FETX\) is the value assigned to the ETX function;
* \(NNS\) is the priority level of \(NS\);
* \(FNS\) is the value assigned to the \(NS\) function;
* \(NEC\) is the priority level of \(EC\);
* \(FEC\) is the value assigned to the \(EC\) function;
* \((ni)\) corresponds to the network node. The fuzzification interface has the function of mapping the precise inputs to the input fuzzy sets by determining the membership degree, i.e., it transforms quantitative information into qualitative information. Thus, the fuzzification interface can be seen as a function that guarantees a degree of imprecision to a numerical value, mapping the physical value of a process variable into a normalized universe of discourse [22]. For the determination membership degree of each entry, the pertinence functions are used. Several profiles of pertinence functions are found in fuzzy system implementations. The most common and easy to generate pertinence functions are triangular and trapezoidal, although there are other functions such as Gaussian, sigmoid and cubic spline [23]. The knowledge base considers two components, database and rule base. The database contains the primary terms (linguistic terms, natural language terms) for each variable and the membership function of each primary term. The rule base relates (or maps) the system inputs to their outputs, thereby implementing the policies for the estimation, control and decision making of language rules. The rule base performs the mapping of the input domain to the output domain, thus, plays an important role in generating the results produced by the fuzzy inference system. Figure 2: Structure of the Fuzzy System-Based Route Classifier. The inference system is responsible for evaluating the input variables, applying the production rules of the knowledge base and assigning responses to the processing. This response is derived from three steps: evaluation of antecedent, implication and aggregation of the consequent [24]. In the stage of antecedents' evaluation, the activation of rules occurs, it is in this stage that the degree of pertinence of each proposition present in the antecedent of each rule is calculated. The implication consists in calculating the consequence of the rules that have degree of activation greater than zero. Most of the time, multiple rules are fired at the same time resulting in multiple output sets. Therefore, it is necessary to generate a unique response for each output variable, containing information about all fired rules. The last phase is responsible for aggregating all output sets into a single set.