**Enhancing the RPL Protocol Using an Artificial Neural Network for Sustainable IoT Infrastructure**

#### **Sonia Kuwelkar and Hassanali G. Virani**

#### **1. Introduction**

The IoT is a giant communications network connecting billons of devices, such as smart phones, wearable devices, sensors, actuators, and home appliances, over the Internet. It is predicted that by 2025 there will be more than 27 billion IoT connections. The IoT will revolutionize the quality of human life by manifesting a plethora of applications in healthcare, industrial automation (Pister et al. 2009), weather monitoring, smart urban cities (Dohler et al. 2009), home automation (Brandt et al. 2010), logistics, building automation (Martocci et al. 2010), and smart metering (Atzori et al. 2010). The network here comprises of sensors that are battery-operated, use microcontrollers, such as the MSP430, and have limited storage capacity. In contrast to conventional networks, the traffic in these networks can be point-to-point, point-to-multipoint, or multipoint-to-point. The communication network also has several drawbacks, such as instability, low data rates, high packet loss, limited transmission range, frame size limitation, and dynamically varying network topology. Besides these aspects, the links connecting the devices can use a variety of technologies, such as Bluetooth, low-power WiFi, and wired PLC. Another aspect to be considered is that, in large-scale deployments, networks can scale to thousands of nodes. Due to these innumerable constraints on devices and underlying communication technology, the IoT network is characterized as a low-power and lossy network (LLN) (Clausen et al. 2011). All of these unique requirements make the design of an efficient routing protocol a very challenging task (Hui and Culler 2008). One major achievement by the IETF is the 6LoWPAN specification, which specifies how to carry IPv6 datagrams over LLNs (Hui et al. 2012). To devise a routing solution for LLNs, the IETF established the routing over low-power and lossy networks (ROLL) working group and assigned them the task. The working group evaluated existing protocols, such as AODV, DSR, OSPF, and OLSR. They realized that these are inefficient for LLNs with regard to power, latency, overhead, and reliability. As a routing solution, the IETF ROLL working group proposed the IPv6 routing protocol for LLNs (RPL) (Winter et al. 2012). The RPL provides IPv6

connectivity to battery-operated wireless embedded devices that use low-power radios to communicate. The RPL builds upon popular routing protocols, such as CTP and Hydro, used in the WSN domain, but is re-designed and extended to incorporate IPv6. Over a period, the RPL has attained maturity and been standardized as a routing protocol (Syarif et al. 2022). The IP stack of many operating systems, such as Contiki OS, TinyOS, T-Kernel, EyeOS, LiteOS, and RIOT, includes the RPL as a standard routing protocol (Seyfollahi et al. 2022).

As the IoT is going to play a major role in our lives in the near future, it is a must that this infrastructure is efficient in terms of energy, speed, and reliability. Improving the routing process is one essential step in this regard. The routing protocol, the RPL, solves major concerns but has certain gaps which need addressing (Darabkh et al. 2022). The standard RPL version makes a routing decision by considering a single metric, such as hop count. The paths created in this case cannot be optimal ones, since other factors, such as link quality or the energy of nodes, are not considered. This implies that certain design aspects of the RPL require revisions in order to further improve the network performance (Zaatouri et al. 2022). The main aim of this work is to overcome the limitations of single-metric-based routing in the RPL by considering three or four metrics when making the best path decision. A multicriteria decision-making approach must be devised to select the best routes based on multiple routing metrics. This posed a challenge, as traditional computation-intensive hard computing methods would be impossible to implement on IoT nodes that have limited memory and computing ability. Recently, soft computing has risen as a promising approach as it employs approximate models and reasoning, which are comparatively less rigorous. The devices can comfortably accommodate soft computing logic in memory, and microcontrollers, such as the MSP430, can execute it (Charles and Kalavathi 2022). Therefore, we decided to explore the soft computing techniques of fuzzy logic, EA, and ANNs, applying them to improve the RPL. In the initial part of this chapter, a fuzzy logic approach is discussed as a multicriteria decision-making method for choosing the best route based on multiple metrics. Later, the role of evolutionary algorithms, such as genetic algorithms, ant colony optimization, and the firefly algorithm, in enhancing the performance of the RPL is presented here. Finally, a novel version of the RPL, using an artificial neural network, is proposed, which performs better than the existing solutions.

The chapter is organized as follows: In the next section we provide an overview of the RPL. In following sections we discuss the current issues with the RPL and how the RPL has been enhanced by using fuzzy logic, evolutionary algorithms, and artificial neural networks. In the final section we conclude the chapter.

#### **2. RPL Overview**

The RPL is a proactive distance-vector-based routing protocol. The network is organized as a destination-oriented directed acyclic graph (DODAG), in which the destination is the root node or LLN border router (LBR). The LBR acts as the gateway for connecting a local network to the Internet. When a network is deployed, the root node initiates the construction of a DODAG (Vasseur et al. 2011). A node can join a DODAG by selecting a preferred parent node. A DODAG is depicted in Figure 1. Each node is assigned a rank, which is directly proportional to the distance from the root node. The LBR has the lowest rank, and the rank increases as we move away from the root. Every parent node will have a rank lower than its children's nodes.

**Figure 1.** A DODAG and control messages. Source: Reprinted from Kuwelkar and Virani (2021a), used with permission.

In an RPL-based infrastructure, one or more RPL instances can exist, where each instance is identified by a unique ID (RPLInstance\_ID). Each instance can have its own set of metrics and routing policy independent of its neighboring instance. Multiple DODAGs can exist within a single RPL instance. In order to distinguish between DODAGs, they are assigned a DODAG ID. Every node can participate in multiple DODAGs. In cases of any inconsistency in the network, the sink can trigger DODAGs to reconstruct themselves. An incremental DODAG Version\_Number is assigned to a DODAG by the sink every time it reconstructs itself. The exact version of a particular DODAG can be identified by the tuple of RPLInstance\_ID, DODAG\_ID, and DODAG Version\_Number. To make all of this functional and share routing-sensitive information, the RPL specifies four ICMPv6 control messages. These are as follows:

*DODAG information object (DIO):* This message contains routing-crucial information, such as objective function, rank, metrics, DODAG ID, trickle timer parameters, and RPL instance ID. This information helps a node to select a parent, identify an RPL instance, and join a DODAG (Tripathi et al. 2010). The DIO message body comprises two parts, a DODAG configuration option and a DAG metric container, where the important information is embedded as shown in Figure 2. DIO messages are essential for constructing upward routes and maintaining a DODAG.

**Figure 2.** DIO message format. Source: Reprinted from Hassani et al. (2021), used with permission.

*Destination advertisement object (DAO):* These messages are primarily used to propagate destination information in an upward direction towards the DODAG root. This information in used for construction of downward routes between DODAG root and associated nodes.

*DODAG information solicitation (DIS):* A node that wants to join a DODAG and has not received a DIO message can use a DIS message to solicit a DIO message from its neighboring nodes.

*Destination advertisement object acknowledgement (DAO-ACK):* Upon receiving DAO messages, a node can unicast a DAO-ACK to the DAO message sender to acknowledge the receipt of that DAO message.

The root node initiates network formation by broadcasting a DIO message. Whenever a node receives a DIO message, it is able to determine and join the RPL instance, add nodes to its candidate parent list, choose the best parent out of the candidates, and replace a previous parent. The DIO message contains an objective

function along with other information. The nodes select the best route by constraining or optimizing certain metrics specified by the objective function. Two objective functions, MRHOF and OF0, are standardized in the RPL. Both of these are briefly described below:

*Minimum rank hysteresis objective function (MRHOF):* Uses the path cost or expected transmission count (ETX) as a routing metric to select the preferred parent in a DODAG (Gnawali and Levis 2012). The ETX is the number of retransmissions required before a packet is successfully received at the destination. The MRHOF is designed with the aim of preventing frequent changes in the preferred parent. In the MRHOF the path cost of each candidate neighbor is calculated by summing up two components: the value of the neighbor's node or link cost and the selected metric value (e.g., rank) advertised in the metric container. Once the path cost is computed for all of the candidates in the list, the one with the lowest value is selected as the preferred parent node. The MRHOF defines a PARENT\_SWITCH\_THRESHOLD, which is taken into consideration before a parent switch is made. If the path cost of the new candidate parent exceeds the present parent node by this threshold, only then is the parent switched. This is the hysteresis part of the MRHOF. For example, if a present parent, A, has a link cost of 120 and a rank of 256, then its total cost is 376. Let the PARENT\_SWITCH\_THRESHOLD be set at 100. Now, if a second candidate node, B, is available, with a path cost of 82 and a rank of 256, then the total cost for this candidate B is 338. In spite of the lower cost, the preferred parent will not be switched to B since the difference in cost between A and B is 38, which is lower than the specified threshold of 100.

*Objective function zero (OF0)*: Depends on the hop count as a metric with which to make routing decisions. A candidate parent with the lowest hop count, which implies a node closest to the root, will be chosen as the preferred parent (Thubert 2012). The node will then compute its rank (Rnode) by adding a scalar Rank\_increase to the rank of the selected parent, Rank(parent):

$$\text{Rnode} = \text{Rank(parent)} + \text{Rank\\_increase} \tag{1}$$

The rank\_increase is computed as follows:

$$\text{Rank\\_increase} = (\text{Rf} \times \text{Sp} + \text{Sr}) \times MinHopRankIncrease \tag{2}$$

where Rf is the rank factor, Sp is step\_of\_rank, and Sr is stretch\_of\_rank. Rf and Sr are normalization factors with default values of 1 and 0, respectively. Sp has a default value of 3 and *MinHopRankIncrease* has a value of 256.

For instance, if a node, A, received a DIO message from a node, B, whose rank is 256, then an RPL implementation with the OF0 will choose B as the parent node; the rank of A will be computed as 1024.

Both of these objective functions have the shortcoming of only considering a single metric for routing decisions (Kuwelkar and Virani 2019). They lack the holistic approach essential for providing QOS. To overcome this, the RPL specification has provided designers with the flexibility to incorporate more metrics into the decision-making process, and we will see in later sections how this can be done.

The devices in IoT infrastructure have severe resource constraints. Hence, to mitigate the control traffic in a network, the DIO messages are transmitted after an interval that increases exponentially, as determined by the trickle algorithm described below:

*Trickle algorithm:* A trickle timer is used, which runs for a definite interval depending on three configuration parameters:


Besides these, three other parameters are involved: the current interval size, I, a counter, c, and the time, t, within the current interval. At the start of the execution, the current interval, I, is set to a value in-between the range of [Imin, Imax]. When the interval starts the counter, c, is reset to zero, and the time, t, is set to a random value between [I/2, I]. When trickle receives packets consistently, the counter, c, is incremented monotonically and, at time t, trickle transmits if the value of the counter, c, is less than k (Levis et al. 2011). Each time the interval, I, expires, its value is doubled till it reaches the value of Imax, after which it is maintained constant at Imax. If trickle senses an inconsistent transmission, then it resets the timer by setting I to Imin and starts a new interval.

#### *2.1. Open Issues in the RPL*

In the previous section we have seen the key functionalities of the RPL. Now we will discuss some open issues in the RPL which have been reported by researchers working in this domain.


(g) The RPL is subjected to security attacks, such as neighbor DIS, replay attacks, route table falsification, local repair, DAO inconsistency, version number, rank, worst parent, DIS, routing table overload, and DAG inconsistency (Farzaneh et al. 2020). Several mechanisms are proposed to tackle the security issues in the RPL.

#### *2.2. QOS Requirements for Sustainable Networks*

Let us first consider the properties of a sustainable network infrastructure essential for meeting quality of service. The main criteria are as follows:

*Energy efficiency*: A network is sustainable if it is energy-efficient. Deployed nodes are basically battery-operated. This being the case, minimal energy consumption should happen during network operation and communication to ensure a longer lifetime. Nodes that have higher residual energy must be involved in the construction of routes. Nodes with lower levels of energy should be avoided and not drained further. The routing process should be sensitive to the battery levels of nodes in order to extend the lifetime. For any given network, energy efficiency can be determined by computing residual energy, power consumption (average), and network lifetime (Kechiche et al. 2019)

*Reliability*: In a network, sensor nodes collect crucial information and transmit it to the sink. A good route should ensure that all of this information reaches the gateway or sink without any loss. The route has to be reliable, with a minimal number of packets getting dropped. The quality of links connecting the nodes in LLNs determines the reliability. It can be determined using link estimators such as the RSSI (received signal strength indicator), number of packets dropped, packet delivery ratio (PDR), and expected number of transmissions for successful delivery (ETX).

*Real time*: The time a message takes to reach the sink should be as small as possible. For applications which operate in real time, this is a crucial factor. A good route should have low end-to-end delay or latency.

In optimization, we generally observe a trade-off, which means that if we try to improve one factor then some other factor degrades. This makes routing optimization a challenging task. For example, a good reliable route may take more hops, which adversely affects the latency. For sustainable architecture, the main focus is to achieve a balance so that all of the above criteria are met.

Some of the key parameters chosen to determine the efficiency of a network's implementation are as follows:

*Packet delivery ratio (PDR)*: In wireless sensor networks, the sensed data are transmitted continuously to root nodes by individual motes. If data rates are high, then some packets are dropped owing to buffers being full and collisions. The ratio of packets actually received at the root node to the total packets sent is called the packet delivery ratio. The PDR is expressed via the following equation:

$$PDR = \frac{Total\text{ Packets Reicevered}}{Total\text{ Packets Sent}} \times 100\tag{3}$$

*Power consumption (average) (Pavg)*: Hundreds of sensor motes deployed within a network consume varying amount of power depending on their activity, placement, topology, and distance from root. The network lifetime is inversely proportional to the average energy consumed by all of the motes. The lower the power consumed, the longer the network lifetime will be. The power consumption, Pavg, is computed by measuring the LPM power, CPU power, transmit power, and listen power, in addition to averaging them for all of the nodes.

*Latency*: The time it takes for a data packet to travel from the sender node to the receiver sink node is called end-to-end delay or latency. If we average the delays of all of the nodes within a network, we obtain the average latency, as given below:

$$Average\text{ latency} = \frac{\text{Total latency}}{\text{Total Packets Recived}}\tag{4}$$

The total latency is obtained as follows:

$$\text{TotalLatency} = \sum\_{k=1}^{n} \left( \text{Recv time} \left( k \right) - \text{Sent time} \left( k \right) \right) \tag{5}$$

#### **3. Means and Methods of Soft Computing for RPL Enhancement**

Soft computing techniques deal with partial truth, uncertainty, imprecision, and approximation to provide solutions to complex real-life problems. The RPL specification is not rigid and allows designers the flexibility to acclimatize according to needs of a particular application within a defined framework. Adopting computationally extensive traditional methods with which to tune the RPL may not be the best alternative, since the devices have severe computing constraints. This makes soft computing a suitable option with which to enhance the RPL.

The term "soft computing" was coined by Dr. Lotfi A. Zadeh in 1980. It consists of a set of algorithms, including fuzzy logic, artificial neural networks, evolutionary algorithms, and expert systems. Soft computing finds applications in control

systems, consumer electronics, healthcare, weather forecasting, robotics, stock market prediction, facial pattern recognition, automotive systems, and manufacturing (Ibrahim 2016). In this section we discuss how evolutionary algorithms, fuzzy logic, and artificial neural networks can be applied to improve the RPL.

#### *3.1. RPL Enhancement Using Fuzzy Logic*

The concept of fuzzy logic was proposed by Lotfi Zadeh in 1965, and was applied in the control of steam engines by Mamdani in 1974. Fuzzy logic became practically useful in 1990s, where many leading companies started using fuzzy logic to design smart appliances. Fuzzy logic closely represents the reasoning or decision-making ability of a human mind. In contrast to a traditional computer, fuzzy logic deals with a range of possibilities between "TRUE" and "FALSE". A fuzzy logic system is shown in Figure 3.

**Figure 3.** Fuzzy inference system. Source: Reprinted from Kuwelkar and Virani (2021b), used with permission.

The fuzzy logic architecture consists of the following components:


3.1.1. Metrics in the RPL

Earlier, we discussed the limitations of the standard RPL which uses an objective function that depends on a single metric, such as the path cost or hop count, to make routing decisions. To overcome this limitation, several researchers have proposed combining two, three, or more metrics using fuzzy logic to make the preferred parent selection. Some of the metrics which have been used in combination are:

1. Node residual energy (RE or RER): This metric is a measure of the remnant battery level of a sensor node. By considering this metric it is possible to avoid the selection of parents with lower energy levels. This is most desirable in networks with energy efficiency concerns. The residual energy (RE) is given as follows:

$$RE = E\sigma - E\sigma\tag{6}$$


$$ETX = \frac{1}{df \times dr} \tag{7}$$

where *df* is the probability of the successful delivery of a packet in the forward direction and *dr* is the probability of successfully receiving an acknowledgement.


Rtmetric is a cost associated with every route within a network. The protocol will use this route metric to select a path with the least congestion (Shreyas et al. 2019).


$$RSSI = RSSI\_{VALUE} + RSSI\_{OFFSET} \tag{8}$$

where *RSSIOFFSET* is the front-end gain, computed analytically by manufacturers.

8. Mobility timer (MT): If a radio link within a mobile environment, responsible for forwarding packets to a DODAG root, suddenly becomes unavailable due to the movement of that node, then all of the forwarded packets will be dropped. This problem will persist until a new link is identified or the link failure is detected. A metric, termed mobility timer, MT, is introduced to address this issue. The value of mobility timer is calculated based on the distance between a mobile node and the candidate parent node (CPN), considering the maximum speed that this mobile node can attain (Sanshi and Cd 2019). The approximate distance between a mobile node and the CPN can be computed from the RSSI equation as follows:

$$RSSI = \ -10 \ n \log \left( D \right) + \mathbb{C} \tag{9}$$

where *D* is the approximate distance, *C* represents the fixed constant, and *n* is the path loss exponent factor. The remaining distance (*RD*) before losing connectivity with the CPN is calculated by subtracting the approximate distance, *D*, from the CPN's communication range, *CR*:

$$RD = \mathcal{C}R - D \tag{10}$$

Later, to compute the value of mobility timer, we have to divide the remaining distance, *RD*, by the MN's max speed, *S*:

$$MT = RD/S \tag{11}$$

9. Children number (CN): The number of children affiliated to a particular parent or neighbor node are reflected by this metric. Ideally, the number of children has to be distributed uniformly in order to avoid the saturation or overloading of few parents. Using this metric during routing allows load balancing to be carried out by promoting the selection of a less loaded neighbor as the parent. The CN can be calculated by monitoring the ICMPv6 messages, particularly the DAO and DAO-ACK messages exchanged, to cancel or confirm a candidate parent during the selection process (Kechiche et al. 2019).

3.1.2. Fuzzy Logic to Overcome the Limitation of Single-Metric-Based Objective Functions in the RPL

To enhance the performance of the RPL for a sustainable implementation of the IoT, metrics from the above list can be combined by using fuzzy logic. Many studies have proposed a new, improved objective function for the RPL that employs either two, three, or four metrics to make a routing decision.

In this section, we discuss in detail one such work (Kuwelkar and Virani 2021b), which proposes an improved objective function, OF-FZ, that utilizes four metrics for decision making during routing. The four metrics chosen are the ETX, HC, delay, and RE. The ETX is a measure of reliability, HC and delay are measures for real-time requirements, and RE is linked with energy efficiency. Hence, these four, when included in a routing decision, will guarantee quality of service. They are fed to a fuzzy logic controller to acquire a single output quantity quality assurance (QA) score, which will be used as a criterion for selecting the preferred parent during routing. This process is executed in two stages, as shown in Figure 4.

**Figure 4.** Two-stage fuzzy process. Source: Reprinted from Kuwelkar and Virani (2021b), used with permission.

The following steps are followed in the fuzzy process:

Step 1: Specify the linguistic variables for the inputs to the FIS. The linguistic variables short, average, and long are used to define the ETX input, and the range chosen is one to fifteen. Hop count is defined by using the linguistic fuzzy sets near, average, and far, with a range of one to five. Delay is represented by using the linguistic variables small, average, and high, with a range from 0 to 3000 units. The fuzzy sets used to define the residual energy, RE, are low, medium, and full. The highest energy level is 255. Some very commonly used membership functions with which to quantify the linguistic terms are triangular and trapezoidal. In this case, trapezoidal membership functions are favored for all four inputs—the ETX, HC, delay, and residual energy—as shown below in Figure 5.

**Figure 5.** *Cont.*

**Figure 5.** (**a**) ETX, (**b**) HC, (**c**) delay, and (**d**) residual energy membership functions. Source: Reprinted from Kuwelkar and Virani (2021b), used with permission.

The Equations (12)–(14) define the level of membership in the ETX fuzzy sets short, average, and long as follows:

$$\mu \text{ (short) } (ETX) = \begin{cases} 0, & \text{ETX} > 6 \\ \frac{6 - ETX}{6 - 3}, & 3 \le ETX \le 6 \\ & 1, & \text{ETX} \le 3 \\ & & \end{cases} \tag{12}$$

$$(avg)\left(ETX\right) = \begin{cases} \begin{array}{l} 0, & \text{ETX} < 3 \text{ or } ETX > 12 \\\\ \frac{ETX - 3}{6 - 3}, & 3 \le ETX \le 6 \\\\ 1, & 6 \le ETX \le 9 \end{array} \\\\ \frac{12 - ETX}{\left(12 - 9\right)}, & 9 \le ETX \le 12 \end{cases} \tag{13}$$

$$\mu\left(\log\right)\left(ETX\right) = \begin{cases} 0, & \text{ETX} < 9 \\\\ \frac{ETX - 9}{12 - 9}, & 9 \le ETX \le 12 \\\\ 1, & \text{ETX} > 12 \end{cases} \tag{14}$$

The Equations (15)–(17) define the level of membership in the delay fuzzy sets small, average, and high as follows:

$$
\mu\left(\text{swall}\right)\left(Delay\right) = \begin{cases} 0 & \text{Delay} > 1200 \\ \frac{1200 - Delay}{1200 - 600} & \text{, } 600 \le Delay \le 1200 \\\\ 1 & \text{Delay} \le 600 \end{cases} \tag{15}
$$

$$
\mu\left(\text{avg}\right)\left(Delay\right) = \begin{cases} 0 & \text{Delay} < 600 \text{ or Delay} > 2400 \\\\ \frac{Delay - 600}{1200 - 600} & \text{, } 600 \le Delay \le 1200 \\\\ 1 & \text{1200} \le Delay \le 1800 \\\\ \frac{2400 - Delay}{2400 - 1800} & \text{, } 1800 \le Delay \le 2400 \\\\ \frac{\text{Delay} - 1800}{2400 - 1800} & \text{, } 1800 \le Delay \le 2400 \\\\ 0 & \text{Delay} \le 1800 \end{cases} \tag{17}
$$

The equations that determine the levels of membership in the RE and hop count fuzzy sets can be written in a similar manner.

Step 2: Next, a set of rules have to be formed that will define the relationship between inputs and outputs. The FIS database stores these rules. The inputs are combined using AND, OR, and NOT operators, along with IF–THEN conditions, to obtain the rules.

Here, Stage 1 has three fuzzy inputs: hop count (HC), delay, and the ETX. Each one is characterized by three fuzzy sets each; therefore, the Stage 1 rule base will consist of 3<sup>3</sup> = 27 rules. The output of Stage 1 is Quality, and it is comprised of five fuzzy sets, namely very\_slow, slow, average, fast, and very\_fast. The rules are built using the AND (&&) and OR (||) operators, in addition to IF–THEN conditions.

Out of the total 27 rules that relate the inputs with the output Quality, some are shown below:

1. If (HC == near) && (ETX == short) && (Delay == small) then (Quality = very fast)


The Quality obtained in Stage 1 is combined with the RE in Stage 2 in order to obtain the output quantity quality assurance score. The linguistic terms for the QA score are very\_bad, bad, degraded, average, satisfactory, good, and excellent. Figure 6 shows the membership functions of Quality and the QA score. The QA score is computed using the rules defined as per Table 1.



Source: Authors' compilation based on their research work.

**Figure 6.** *Cont.*

**Figure 6.** (**a**) Quality and (**b**) QA score membership functions. Source: Reprinted from Kuwelkar and Virani (2021b), used with permission.

The range of the QA score is between 0 and 100. A higher value is an indication of a better-quality parent node. A quality assurance score is computed for each candidate parent in the list by invoking the FIS. When a choice of more than one candidate exists, the one that achieves the higher QA score is selected as the preferred parent.

Step 3: The crisp value for the quality assurance score is computed by defuzzification by using the centroid formula:

$$M = \frac{\sum\_{i=1}^{n} W i \times \mu \text{ (}\dot{W}i\text{)}}{\sum\_{i=1}^{n} \mu \text{ (}\dot{W}i\text{)}}\tag{18}$$

where *M* is the crisp value, *Wi* is the center of gravity of the activated fuzzy set, the number of activated rules is given by *n*, and *μ* is the membership value for activated rules computed using max(min) implication. This process works on the Mamdani and Assilian (1975) model.

To understand the fuzzy process working mathematically, consider an example. Let node N1 have two parent choices, P1 and P2, with metric values as shown in Figure 7. Assume a candidate parent, P1, with delay = 1000, the ETX = 2, hop count = 2, and residual energy = 200. Initially, Stage 1 of fuzzification is invoked and Quality is computed. The ETX of 2 belongs to the short fuzzy set, with μ = 1. The delay of 1000 belongs to the small and average sets, with μ = 0.33 and μ = 0.667, respectively. HC = 2 belongs to the average set, with μ = 1. Equations (12)–(17), listed above, are used for computing the μ (membership values). For Quality, four rules are

activated, with "fast" and "very\_fast" values triggered. From max(min) implication, Rule 1 results in a value of 0.333, the value of Rule 2 is 0.667, that of Rule 3 is zero, and that of Rule 4 is zero. The centroid formula is applied to calculate the crisp value of Quality, Q:

$$Q = \frac{0.333 \times 72 + 0.667 \times 72 + 0 \times 94 + 0 \times 72}{0.33 + 0.667 + 0 + 0} = 70$$

where 94 and 72 are the centers of gravity for "very\_fast" and "fast", respectively. During Stage 2 of fuzzification, a residual energy of 200 belongs in the fuzzy sets "full" and "medium", with values of 0.9216 and 0.078, respectively. The computed quality of 72 in Stage 1 belongs to the fuzzy set "fast", with a value of 1. The QA score is activated by the triggering of two rules with "good" and "satisfactory" values. Using the max(min) implication, Rule 1 results in a value of 0.9216 and Rule 2 has a value of 0.078. Applying the centroid formula, we compute the QA score as follows:

$$QA\,score = \frac{0.078 \times 63 + 0.9216 \times 77}{0.078 + 0.9216} = 75.9$$

where 77 and 63 are the centers of gravity for the QA score fuzzy sets "good" and "satisfactory", respectively.

**Figure 7.** Node with candidate parents. Source: Adapted from Kuwelkar and Virani (2021b), used with permission.

When a node receives a DIO message from a neighboring node, the entry of this neighbor is made in the candidate parent list. The values of the ETX, delay, RE, and hop count for this particular neighbor are extracted from the received DIO message. If more than one candidate is present in the list, then the FIS is invoked and the quality assurance score for all of the candidates is computed. The one with the highest QA score is chosen as the preferred parent node. Suppose for a particular candidate, 1, that the QA score is 78, and that for another candidate, 2, the QA score is 65. Consider

that the present parent node had a QA score of 70. This being the case, candidate 1 will be chosen as the new best parent, as it has the highest score among the three. The rank will be computed based on the rank of selected parent. The preceding parent is substituted by the new one and the updated DIO message is broadcasted to its neighbors. This technique gives 9% lower power dissipation, 7% better packet delivery ratios, and 8% lower latency, as shown in Figure 8 where the OF-FZ is the four-metric-based fuzzy improved objective function. The Contiki-OS-based COOJA simulator is used to perform the performance evaluations. The packet rate is set to 5 ppm. The T-mote Sky platform is used in network emulation, and the density is varied from 30 to 100 nodes. A single sink node is used, and the packet length is 128 bytes. In this scenario, the routing process comprising four metrics is thus a holistic approach to ensure quality of service.

**Figure 8.** Average power consumption, packet delivery ratio, and latency for the standard RPL and OF-FZ. Source: Reprinted from Kuwelkar and Virani (2021b), used with permission.

#### 3.1.3. Fuzzy Logic to Overcome the Limitation of Mobility in the RPL

The RPL is not optimized for mobile nodes (MNs) and is subject to frequent disconnection in communicating links between mobile nodes. To overcome this issue, an improvement, FL-RPL, is suggested [19], which enhances the reliability and responsiveness of the RPL, thus providing support for mobility. In this work, four metrics, namely the received signal strength indicator (RSSI), residual energy (RE), the ETX, and mobility timer, are chosen as inputs to the fuzzy inference system. Figure 9 shows the membership functions for all four inputs.

**Figure 9.** Membership functions of (**a**) RE, (**b**) the ETX, (**c**) MT, and (**d**) RSSI. Source: Reprinted from Sanshi and Cd (2019), used with permission.

The RSSI and mobility timer metrics serve as key factors in providing mobility support to the RPL. The RSSI metric gives an estimate of the signal strength between the node and the candidate parent. Mobility timer indicates the tentative time before a mobile node loses connectivity from a candidate parent. Both of these metrics help mobile nodes in choosing parents that exhibit a strong signal strength and better connectivity for prolonged durations. The FL-RPL works by eliminating weaker parents from the list.

This method uses four fuzzy inputs, and each input is linked with three fuzzy sets; therefore, the rule base consists of 34 = 81 rules. A few rules out of the 81 are defined as follows:


In a similar way, the other rules can be listed by using combinations of different fuzzy sets. The output of the fuzzy inference system after defuzzification is a parameter known as the confidence score. The output has seven fuzzy sets, namely very low, low, moderate low, moderate, moderate high, high, and very high. This score defines the confidence with which a candidate will be selected as the preferred parent. The candidate that results in the highest confidence score will be chosen as the best parent. The confidence score membership function in shown in Figure 10.

**Figure 10.** Membership function of the output variable. Source: Reprinted from Sanshi and Cd (2019), used with permission.

The fuzzy inference system is invoked every time a new DIO message is received from a candidate parent or when the freshness timer associated with a chosen parent node expires. The flowchart in Figure 11 shows the parent selection process.

At the start, DIO messages are solicited from neighbors by broadcasting DIS messages in the network. If a DIO message is received from a neighboring node, this neighbor is added as a candidate parent to the list and routing metrics are extracted. The value of the RSSI is obtained, which is then used to compute the approximate value of MT. The freshness timer for this candidate is initialized. If no other candidates are present in the list, then this neighbor is chosen as the preferred parent. Otherwise, the fuzzy inference system is invoked and the confidence score is calculated for all of the candidates. The candidate parent with the highest confidence score is selected as the parent. In cases where a node receives another DIO message from an already-present candidate parent in the list, then the freshness timer values for this CPN are updated. When the current parent node's freshness timer expires, the FIS is invoked and a new parent is selected from among the candidates. Any CPN whose freshness timer expires is omitted from the candidate list.

This improved version of the RPL was tested by using the COOJA simulator in Contiki OS and compared with the standard version. The simulation results clearly confirm that the FL-RPL increases the PDR by 12% and reduces power consumption by 20%. Incorporating metrics such as the RSSI and mobility timer in routing decisions provides the necessary mobility support for the RPL.

**Figure 11.** Route construction in the FL-RPL. Source: Reprinted from Sanshi and Cd (2019), used with permission.

3.1.4. Fuzzy-MADM to Overcome the Limitation of Load Balancing and Congestion in the RPL

In IoT networks, a large density of nodes and higher data rates cause congestion. Every node has a buffer associated with it to store and forward packets. If the buffer becomes full then the packets which come in later are dropped. This reduces the packet delivery ratio and affects the network performance. The RPL does not ensure load balancing, so the distribution of children is not uniform among the parent nodes. If a parent, 1, had five children nodes and some other parent, 2, has three children, the chances of the parent 1 buffer becoming full are higher as compared to parent 2. To overcome this issue, a metric called buffer occupancy is utilized in this method (Shreyas et al. 2019) to ensure uniform distribution. It corresponds to the number of packets queued at the buffer of a node for transmission. Another metric used

is Rtmetric, which is a measure of the congestion on any particular route. Along with buffer occupancy and Rtmetric, the ETX metric is also used for decision making during routing. It is modeled as a multi attribute decision-making problem (MADM) using a fuzzy weighted sum model (Pahlavani 2010).

A typical fuzzy multi attribute decision-making (MADM) problem consists of m possible alternatives, *A1, A2,* ... *, Am*, which must be examined with respect to n attributes, *C1, C2,* ... *, Cn.* The attribute weights or weighting factors are denoted by *w1, w2,* ... *, wn*. In a fuzzy MADM problem the key feature is a decision matrix, *D*:

$$D = \begin{bmatrix} y11 & \cdots & y1n \\ \vdots & \ddots & \vdots \\ ym1 & \cdots & ymn \end{bmatrix} \tag{19}$$

where *yij* represents the assessment of the alternative *Ai* under the attribute *Cj*. It can be an approximate number, interval, crisp number, or linguistic words.

Consider that P = {pi, i = 1, 2, 3, ... , n} is a finite set of parents for a node. The set of metrics for each parent is denoted by R = {rj, j = 1, 2, 3}. In this technique, Rtmetric, the ETX, and buffer occupancy are chosen as the routing metrics. Rtmetric gives an indication of the congestion on a route and BO is a measure of the buffer space availability at a parent. Including these two along with the ETX makes the routing process congestion aware and provides a uniform distribution of children nodes. In the weighted sum model weights are associated with the metrics, which is represented by a weight vector: W = {wj, j = 1, 2, 3}.

The decision matrix, *AWSM*, is a representation for MADM parent selection. In this case, a (N × 3) matrix, *M*, is selected to represent the metrics. Each element, Vj(ai), represents the value of the jth routing metric for the ith parent for all i = (1, 2, 3, . . . , N) and j = (1, 2, 3). The matrix, M, is represented as follows:

$$M = \begin{bmatrix} V\_1 \begin{pmatrix} a\_1 \end{pmatrix} V\_2 \begin{pmatrix} a\_1 \end{pmatrix} V\_3 \begin{pmatrix} a\_1 \end{pmatrix} \\\\ V\_1 \begin{pmatrix} a\_2 \end{pmatrix} V\_2 \begin{pmatrix} a\_2 \end{pmatrix} V\_3 \begin{pmatrix} a\_2 \end{pmatrix} \\\\ V\_1 \begin{pmatrix} a\_n \end{pmatrix} V\_{2\left(a\_n\right)} V\_3 \begin{pmatrix} a\_n \end{pmatrix} \end{pmatrix} \tag{20}$$

The matrix, *M*, is multiplied with the weight vector matrix, *W*, to obtain the decision matrix, *AWSM*:

$$\text{AVSM} = M \times W \tag{21}$$

$$AWSM = \begin{bmatrix} V\_1 \left( a\_1 \right) V\_2 \left( a\_1 \right) V\_3 \left( a\_1 \right) \\\\ V\_1 \left( a\_2 \right) V\_2 \left( a\_2 \right) V\_3 \left( a\_2 \right) \\\\ V\_1 \left( a\_n \right) V\_{2 \left( a\_n \right)} V\_3 \left( a\_n \right) \end{bmatrix} \times \quad \text{W} \tag{22}$$

For an individual parent, Pi, the *AWSM* will be computed as follows:

$$AWSM(i) = ETX(i) \times W\_{ETX} + BO(i) \times W\_{BO} + rtMetric(i) \times W\_{rtMetric} \tag{23}$$

The ETX, BO, and Rtmetric values are obtained for all of the candidate parents in the list from the DIO message. Using the decision matrix and weight matrix, the AWSM values are calculated for all of the candidates. As the ETX is a measure of link quality, the lower the value the better the candidate. A low BO value indicates better space availability at the candidate buffer. Additionally, a candidate with a low Rtmetric value signifies a less congested route. The above being the case, among the available candidates the one with the lowest value of the AWSM is selected as the best parent for routing. This method provides improvements in packet delivery to the tune of 5% as compared to the standard RPL. The networks were tested in the COOJA simulator with data rates of six packets/sec. An application with payload of 30 bytes is executing on each node. The UDP transport layer protocol was used. A buffer size of eight packets was set at each node.

Figure 12 shows the networks constructed using the standard RPL and this improved version of the RPL. It can be seen that the network employing the improved RPL has a more uniform distribution of children nodes.

**Figure 12.** Networks constructed using (**a**) the standard RPL and (**b**) the improved version of the RPL. Source: Reprinted from Shreyas et al. (2019), used with permission.

Several other works use a fuzzy logic model to include more than one metric during routing and overcome the limitation of a single metric. In one study, the authors (Farzaneh et al. 2020) proposed a novel method with which to detect intrusion in the RPL. Fuzzy logic is used to include three metrics, namely residual energy, distance, and the expected transmission count (ETX). This method effectively detects local repair attacks with high rates of true positive and low rates of false positives. In Kechiche et al. (2019), the authors propose an opportunistic fuzzy-logic-based objective function. A novel metric, known as children number, is derived by using a fuzzy logic approach to combine the conventional expected transmission count (ETX) and hop count (HC) metrics. Lamaazi and Benamar (2018), have proposed OF-EC, a novel objective function that combines three metrics, namely energy consumption, the ETX, and hop count, using fuzzy logic and provides a composition metric based on which routing decisions are taken. Using OF-EC, RPL implementation shows improvements in terms of the network convergence time, energy consumption, latency, routing overhead, packet delivery ratio, and network lifetime. Gaddour et al. (2014), in their work have developed a holistic objective function, OF-FL, that combines hop count, end-to-end delay, link quality, and energy by using fuzzy logic. Simulations are carried out that compare the performance of OF-FL with standard RPL objective functions for network sizes up to 100 nodes. A better network lifetime, PDR, and lower frequency of parent change is achieved. Kamgueu et al. (2013), proposed combining three routing metrics—the ETX, delay, and energy—by using fuzzy logic to determine the Quality of candidate parents. This is the pioneer work that suggested the use of fuzzy logic for improving the RPL since 2013.

#### *3.2. RPL Enhancement Using Evolutionary Algorithms*

"Evolutionary algorithms" (EAs) constitute a collection of methods developed to solve optimization problems. They adapt Darwinian principles to automate problem solving. Evolutionary algorithms are metaheuristic optimization algorithms based on populations and inspired by natural evolution (Slowik and Kwasnicka 2020). The main components of EAs are populations of individuals, a problem-specific objective function or fitness function for optimization, and operations. Evolutionary algorithms include particle swarm optimization (Yang and Karamanoglu 2013), genetic algorithms, ant colony optimization (Sahani and Kumar 2013), differential evolution, and the firefly optimization algorithm. EAs have characteristics of flexibility and robustness with which to capture global solutions for complex optimization problems. The term evolutionary computation (EC) was recently adopted to epitomize the whole family of evolutionary algorithms. In this section, we provide an overview of how these evolutionary algorithms can be applied to improve the functionality of RPL implementations.

#### 3.2.1. RPL Enhancement Using Genetic Algorithms

John Holland, University of Michigan, proposed genetic algorithms in 1960, but they only gained popularity in the 1990s. Genetic algorithms are used for solving both constrained and unconstrained optimization problems by using the concept of natural selection and biological evolution. GAs recurrently modify a population of individual solutions. At every step, the GA selects individuals from the current population as parents by using a fitness function. The selected parents will reproduce the offspring of the next generation. The population evolves towards an optimum solution over successive generations. Genetic algorithms can be applied to solve a variety of optimization problems that cannot be solved with standard algorithms, including problems in which the objective function is nondifferentiable, stochastic, discontinuous, or highly nonlinear. It can be widely used in the image processing, stock market prediction, function optimization, and machine learning application areas. Genetic algorithms use three types of operations at each step to create next-generation populations from current ones:


In this work (Cao and Wu 2018), the authors have introduced a chaotic genetic algorithm (CGA) by introducing the mechanism of chaotic optimization into a genetic algorithm. The basic steps in a CGA are consistent with a simple GA; that is, start with a random initial population, perform a fitness calculation, select parents, perform crossover, and mutation. The inclusion of chaotic optimization effectively improves the selection of the initial population and control parameters, thus reducing the randomness of a genetic algorithm. Chaotic selection, crossover, and mutation help to constructively improve the local optimization and convergence of a GA. In a CGA, the ergodicity of a chaotic algorithm allows for a larger search sample space. The initial sensitivity of chaotic optimization helps in avoiding local optimization, thus finding an optimal global solution. Chaotic optimization algorithms utilize chaotic maps, such as a logistic map, to generate pseudo-random numbers that are mapped as the design variables for global optimization (Yang et al. 2014). A CGA was proven

to be a better option in solving optimization problems as compared to a simple genetic algorithm. A CGA is applied to improve the performance of the RPL.

As we have seen in previous sections, more than one metric can be combined, and based on this composition metric the best parent decisions are made. Generally, in techniques that use weighting factors for routing metrics to obtain a composition metric, once the weights are allotted they are static and cannot be modified during runtime; however, an implementation that tunes the weights dynamically, as per network behavior and needs, would be a better option. A CGA can be applied to search for the optimum solution for the weighting factors of routing metrics during runtime. This improved version of the RPL, which applies a CGA to search for optimal weighting factors in a composition metric for evaluating candidate parents, is termed RPL-CGA.

This version of the RPL combines five metrics, as listed below:

1. *g1*(*i*): This is the ratio of the queue length in the buffer of the ith candidate, (*QL*(*i*)), to the maximum packet queue length, (*QLmax*). It helps in network load balancing by avoiding parents that have less buffer space. The following equation represents *g1*(*i*):

$$\text{g1 }(i) = \frac{QL\,(i)}{QLmax} \tag{24}$$

2. *g2*(*i*): *EED*(*i*) represents the end-to-end delay when a node is transmitting data to a root via a candidate parent, i. For (i = 1, 2, 3, ... , n) parents, the *EED*(*i*) for all routes via different parents is determined. EEDmax is the maximum delay obtained for a route via some parent, X. The candidate with the lowest EED will be preferred as the parent. The weight factor *g2*(*i*) is the ratio of *EED*(*i*) for candidate *i* to the maximum EED, as given by following equation:

$$\text{g2 (i)} = \frac{EED\,(i)}{EED\,max} \tag{25}$$

3. *g3*(*i*): This factor represents the ratio of residual energy (RER) for a candidate parent, i, where i = 1, 2, ... , n. *Ecurrent*(*i*) and *Einitial*(*i*) represent the current energy of candidate parent i and the initial energy at deployment, respectively. To prolong the network lifetime it is desirable to select the candidate with higher residual energy as the preferred parent. *g3*(*i*), or RER, is given by the following equation:

$$\text{g3 (i)} = 1 - \frac{\text{Ecurrent} \left( i \right)}{\text{Einitial (i)}} \tag{26}$$

4. *g4*(*i*): This is the ratio of the hop count for a particular candidate, i, to the maximum hop count between a candidate parent and root, given by the following equation:

$$\text{g4 } (i) = \frac{\text{HC } (i)}{\text{HC} \text{max}} \tag{27}$$

5. *g5*(*i*): The *ETX*(*i*) for (i = 1, 2, ... , n) represents the expected number of retransmissions from a node to the root via a candidate parent, i. Suppose that, among the n candidate parents, a route via candidate X takes the maximum ETX; this value is then denoted as ETXmax. *g5*(*i*) is the ratio of the ETX(i) for a candidate parent, i, to the *ETXmax*, given below:

$$\text{g5 (i)} = \frac{ETX \,(i)}{ETX \,max} \tag{28}$$

The above five metrics are combined by using weighting factors to form a composition metric, *CM*. The weighting factors a1, a2, a3, a4, and a5 are used to adjust the impact of each routing metric. The function *F*(*i*)*CM*, shown below, defines the composition metric formed by individual routing metrics and weighting factors:

$$F\left(i\right)\text{CM} = \sum\_{j=1}^{5} \text{aj } \text{gj}\left(\text{I}\right), \qquad for \, i = 1, 2, 3, \dots, n\tag{29}$$
 
$$\text{Such that } \sum\_{j=1}^{5} \text{aj} = 1 \text{ and } 0 \le \text{aj} \le 1$$

The objective function for RPL-CGA is defined as the minimum function of the composition metric, *CM*:

$$\text{OFFPL-CGA} = \min \left( \text{F(i)CM} \right) = \min \left( \sum\_{j=1}^{5} \text{aj} \, \text{j} \, \text{(i)}, \quad \text{for } i = 1, 2, 3, \dots, n \right)$$

If we have *n* candidate parents and RPL-CGA employs five metrics, QL, EED, RER, HC, and the ETX, then the jth routing metric for the ith individual candidate can be denoted as *xij*, where i = 1, 2, ... , n and j = 1, 2, 3, 4, 5. The sample set of each routing metric for each parent can be written as a matrix called the initial decision matrix:

$$X = \begin{bmatrix} \chi\_{11} & \chi\_{12} & \chi\_{13} & \chi\_{14} & \chi\_{15} \\\\ \chi\_{21} & \chi\_{22} & \chi\_{23} & \chi\_{24} & \chi\_{25} \end{bmatrix} \tag{30}$$

Using the weighting factor *aj* for every *jth* metric, the comprehensive evaluate function values, *F*(*i*), of each candidate parent can be obtained as shown below, A being the weighting factor matrix:

$$\mathbf{F} = \mathbf{A} \,\, \mathbf{X} \tag{30a}$$

$$F\left(i\right) = \sum\_{j=1}^{5} a\_j^i \text{ xij, } for\ \left(i = 1, 2, 3, \dots, n\right) \text{ and } \left(j = 1, 2, 3, 4, 5\right) \tag{30b}$$

The candidate, *i*, with the minimum value of *F*(*i*) is chosen as the best parent. The values of the weighting factors, aj, could be obtained using multi attribute optimization algorithms, but in this work a chaotic genetic algorithm is applied to search for the optimal solution for weighting factors. In RPL-CGA, the initial population genes of weighting factors are obtained through a chaotic system. In successive steps, the population is improved through the selection of superior individuals, crossover, mutation, and chaos perturbation. Once the stopping criterion is met, the algorithm stops. At this stage, the population individuals with the maximum fitness value are the final weighting factors for the routing metrics.

The detailed steps in RPL-CGA are listed below:

#### Step 1: Initialization

During initialization, the parameters to be used in RPL-CGA are determined, such as the maximum number of iterations, *k*, population size, *w*, mutation probability, *Pm*, and crossover probability, *Pc*.

#### Step 2: Deciding the Fitness Function

In genetic algorithms the fitness function plays a crucial role in selecting the population individuals for reproduction at each step. It helps in assessing the quality of population individuals. Generally, individuals with the highest fitness values are chosen as parents for determining the next generation so that better offspring is obtained and weaker ones eliminated. This is consistent with the Darwinian theory of survival of the fittest.

In RPL-CGA the fitness function is dependent on the comprehensive evaluation function, *F*(*i*). The fitness function is defined as follows:

$$Fitness\ (a) = \frac{1}{1 + F\left(i\right)}\ for\ i = 1, 2, 3, \dots, n\tag{31}$$

max*Fitness*(*a*), *under constraints* ∑<sup>5</sup> *<sup>j</sup>*=<sup>1</sup> *a*j = 1 *and* 0 ≤ *a*j ≤ 1

The comprehensive function, *F*(*i*), depends on the weighting factors, *aj*. Therefore, the variation in weighting factors will affect the fitness function. The optimal weighting factors can be determined by evaluating the maximum value of the fitness function under given constraints. At the end of a CGA, the population individual with the maximum fitness will be the optimal solution of the weighting factors.

Step 3: Generation of Initial Population Using a Chaotic System

Including the chaotic system results in better initial population values, better sequence randomness, and wider traversing of state points in a chaotic region. This work uses a representative logistic map to generate chaos perturbation vectors and initial population genes. The state equation for a chaotic system is shown in the equation below:

$$
\tau\_{\mathbf{z}+1} = \eta \,\,\tau\_{\mathbf{z}} \,(1 - \tau\_{\mathbf{z}}), \, \mathbf{z} = 0, \, 1, \, 2, \, \cdot \, \cdot \,\_{\text{>}} 0 < \tau\_0 < 1, \, 0 \le \eta \le 4 \tag{32}
$$

where *η* is the control parameter. The system goes into a chaotic state when *η* > 3.57 and *τ* = 0.25, 0.5, 0.75, and the iteration provides results comparable to random numbers [0, 1]. In the initial population, w individuals are selected and m genes are assigned to each individual. This means thatw\*m population genes are chosen from the chaotic sequence generated. Each individual gene represents the weighting factor of each routing metric. In this case, m = 5 since RPL-CGA uses five routing metrics. The individual genes should meet the constraints specified above for aj. The individual population can be written as *hij* (i = 1, 2, 3, . . . ., w and j = 1, 2, 3, . . . , m).

#### Step 4: Selection of Superior Individuals

In RPL-CGA, once the population individuals are generated the fitness is calculated for every hi. The fitness function values, Fitness(hi), are arranged in descending order, and the topmost 15%, with higher fitness values, are taken to the next generation directly. No operations, such as crossover or mutation, are applied to them. The remaining 85% of the population for the next generation is obtained by applying the crossover and mutation operations of a genetic algorithm.

#### Step 5: Addition of Chaotic Perturbation

RPL-CGA adds chaotic perturbation to population individuals, with the purpose of avoiding local convergence, reducing evolution algebra, and finding optimal solutions very quickly. The chaotic perturbation is applied to only 85% of the individuals with lower fitness, according to Equation (33):

$$\mathbf{h}' = (1 - \alpha)\,\mathbf{h} + \alpha\mathbf{h}'' \tag{33}$$

where *h'* is the new population individuals generated after adding chaotic perturbation, *h* is the 85% individuals generated in Step 4, *h"* is an m-dimension chaotic perturbation vector selected from the chaotic series, and α ∈ [0, 1] is an adjustment factor.

Step 6: Deciding the Stopping Criterion

The RPL-CGA algorithm stops if the number of iterations reaches 100 or if the following condition is met:

$$\text{Fitness(a)max - Fitness(a)avg} \le \varepsilon \tag{34}$$

where *Fitness(a)max* is the maximum fitness value and *Fitness(a)avg* is the average of all of the values. = 0.00001 is a small positive constant. At the end of a CGA, the population individuals with the maximum fitness values will be the optimal weighting factors used in a comprehensive evaluation function, F(i), to determine the best parent among all of the candidates. The flowchart in Figure 13 shows the detailed steps followed in a CGA for computing the weighting factors.

**Figure 13.** Flowchart of a CGA for computing the weighting factors of a comprehensive evaluation function. Source: Figure by authors.

Network simulations using OPNET show that RPL-CGA performs much better with regard to power efficiency, packet delivery success ratio, network lifetime, and delay. The graphs below, in Figure 14, indicate the superior behavior of RPL-CGA over other implementations for a simulation time of 3000 s. Chaotic Genetic Algorithm, being a computationally intensive algorithm, would require a comparatively powerful microcontroller on the motes to be deployed with a bigger memory size, which is a drawback compared to fuzzy-based implementation.

**Figure 14.** (**a**) Packet delivery success rate, (**b**) delay, and (**c**) average remaining energy for RPL-CGA and other implementations. Source: Reprinted from Cao and Wu (2018), used with permission.

#### 3.2.2. RPL Enhancement Using the Firefly Algorithm

Yang (2009), proposed the firefly algorithm in 2007–2008; it is a biologically inspired metaheuristic optimization algorithm. Studies have shown that the firefly algorithm can outperform the genetic and particle swarm optimization algorithms. It has a better success rate and efficiency for solving NP-hard problems. This algorithm is inspired by the natural behavior of fireflies. In fireflies, the flashing light is produced through a bioluminescence process. The flashing light helps in communication, allowing fireflies to attract mating partners or potential prey, and possibly acts as a defensive cautionary mechanism. The flashing rhythm, flashing rate, and amount of time form part of the signaling system that attracts mates.

Light intensity at a distance, y, from the light source obeys the inverse square law, which means that light intensity decreases with an increase in the distance from the source. This makes fireflies visible for only a limited distance at night, maybe a few hundred meters, which is sufficient for fireflies to communicate. The flashing light is formulated in such a way that it can be associated with the objective function to be optimized in any optimization problem. The following assumptions are made in the firefly algorithm:


The algorithm steps can be summarized as follows:


$$\mathbf{x}\_{i} = \mathbf{x}\_{i} + \beta\_{0}^{-\gamma r\_{\Delta j}^{2}} \left(\mathbf{x}\_{j} - \mathbf{x}\_{i}\right) + \alpha \left(r \text{and} - \frac{1}{2}\right) \tag{35}$$

where *rij* is the cartesian distance between two fireflies, *i* and *j*, at *xi* and *xj,* respectively, and is given as follows:

$$r\_{ij} = ||\mathbf{x}\_i - \mathbf{x}\_j|| = \sqrt{\sum\_{k=1}^d \left(\mathbf{x}\_{ik} - \mathbf{x}\_{jk}\right)^2} \tag{36}$$

*βo* is the attractiveness constant, *γ* is the absorption constant, and *α* is the randomization parameter. Generally, *βo* = 1 and α [0, 1].


In this method, the firefly optimization algorithm is applied to select the best parent for forwarding the data to the root in an RPL network (Sennan et al. 2021). This proposed version is termed EEOPS-RPL. Here, the ETX and residual energy (RER) metrics are chosen as the attractiveness parameters, while the distance between

nodes is chosen as the movement parameter, to select the optimal parent in a DODAG. EEOPS-RPL provides faster convergence and a longer network lifetime.

All of the nodes in the network are considered to be fireflies. The fitness function or objective function is chosen as follows:

$$\mathbf{F(i)} = \mathbf{w}\_1 \times \text{ERR}(\mathbf{y\_i}) + \mathbf{w}\_2 \times \text{ETX}(\mathbf{y\_i}) \tag{37}$$

where *w1* and *w2* are the weights chosen for RER and the ETX.

The steps followed in EEOPS-RPL are shown in the flowchart of Figure 15. The performance of EEOPS-RPL was studied under different network scenarios by using the COOJA simulator. The WISMote sensor node was used in the simulations in a random distribution. The initial energy of each node was set at 1000 J. A network area of 100 m × 100 m was considered. The number of nodes was taken as 30, with a network coverage of 50 m. A data packet of a size of 127 bytes was chosen. The data rate was set to 1 pkt/min. The following parameter values were used: *βo* = 1, *α* = 0.3, *γ* = 1, and MinHopRankIncrease = 256. There was improvement in the packet transmission ratio and network lifetime by 5% and 10%, respectively, in comparison to others.

**Figure 15.** Operation flow of EEOPS-RPL. Source: Figure by authors.

#### 3.2.3. RPL Enhancement Using the Ant Colony Optimization Algorithm

The ant colony optimization protocol is a metaheuristic, probabilistic technique for finding optimal paths or solving optimization problems in computer science or operations research. It belongs to the family of swarm intelligence algorithms and uses the pheromone-based communication technique of biological ants. It was proposed initially by Marco Dorigo in 1992, where the algorithm was seeking to find the optimal path in a graph, mimicking an ant's behavior of searching for the shortest path between their colony and a food source. The application of the ant colony optimization algorithm is explored in RPL networks for optimal parent selection. Here, the researchers have proposed an improvised E-RPL based on the ACO (Preeth et al. 2020).

In this method, the ETX, residual energy (RER), children number, and rank value metrics are used. The ETX and rank value are considered pheromone factors. The RER and children number are taken as heuristic factors. The child–parent relationship is taken as a pheromone evaporation factor. The pheromone, heuristic factors, and evaporation factor are combined to form an objective function by using weights. The pheromone factor is defined for a node as *PH(i)*, given by the following equation:

$$PH = \text{x}\left(\frac{1}{\text{Rank value (i)}}\right) \tag{38}$$

where *ETX(i-j)* is the ETX value of a link between nodes i and j.

A term, EPH(i), is introduced to represent the evaporation factor, and it is governed by the parent–child relationship. Initially, when there is no relationship between nodes *i* and *j*, *EPH(i)* = 0. The first time node j is selected as the parent a value of 0.1 is assigned. Every subsequent time this node, j, is selected as the parent, the value of *EPH(i)* is incremented by 0.1. The equation is shown below:

$$\text{EPH}\left(\mathbf{i}\right) = \begin{cases} \text{0, } \text{EPH}\left(\mathbf{i}\right) > 1 \\ \text{EPH}\left(\mathbf{i}\right) + \text{0.1, } \text{EPH}\left(\mathbf{i}\right) > 0.1 \\ \quad \text{0.1, } \text{otherwise} \end{cases} \tag{39}$$

The minimum residual energy of any link between a DIO message receiver and a DODAG root is termed *MREij*. The next important metric taken into account is the children count for any node j, denoted as *CCj*. Too many children nodes can result in collision and packet dropping. *CCj* is a measure of children count and the probability of packet loss due to collisions:

$$\text{CCj} = \frac{\text{Cilidren Count}}{\text{Total Number of neighbors}} \tag{40}$$

Two subobjective functions are defined for a parent node, *EIPNj* and *EEPNj*, which correspond to efficiency and effectivity, respectively. *EIPNj* is the product of *PH(i)* and *EPH(i)* , and *EEPNj* is proportional to *MRE* and *CCj*:

$$EIPNj = PH\left(i\right) \times EPH\left(i\right) \tag{41}$$

$$EEPNj = \left(1 - \frac{1}{MRE\text{ij}}\right) \times \left(1 - \frac{1}{\text{CCj}}\right) \tag{42}$$

The ant colony optimization algorithm evaluates the fitness for a particular parent by using the following objective function:

$$F\Delta tnss\_{\hat{\jmath}} = \left\{ \frac{\left(\alpha \times EIPN\_{\hat{\jmath}}\right) \times \left(\beta \times EEPN\_{\hat{\jmath}}\right)}{AvG\left(\left(\alpha \times EIPN\_{\hat{\jmath}}\right) \times \left(\beta \times EEPN\_{\hat{\jmath}}\right)\right)} \right\} \tag{43}$$

where *α* and *β* are the weights used to combine the two subjective functions, *EIPNj* and *EEPNj*.

This method gives an energy-efficient and reliable implementation. There is significant improvement in the packet delivery ratio to the tune of 35% over standard implementations; however, due to the computations involved it experiences a slightly higher delay then the standard and may not be ideal for real-time applications. The flowchart is shown below in Figure 16. In addition to the ACO algorithm, the authors have used a coverage-based dynamic trickle algorithm that works on the concentric corona mechanism. It utilizes node density information within DIO messages to determine the transmission duration of DIO messages, thus reducing routing overhead considerably without affecting the network coverage. This technique achieves faster network convergence as compared to the standard RPL.

**Figure 16.** Operation flow of E-RPL by using the ACO algorithm. Source: Figure by authors.

#### *3.3. RPL Enhancement Using Neural Networks*

Neural networks are computational models inspired by the human brain. They consist of a network of neurons connected by synaptic weights and configured to perform a specific task. ANNs can be applied to solve problems in the domains of classification, regression, optimization, and clustering. A training algorithm is used to determine the optimal value of weights and reduce error to a minimum. Some of the very popular applications of ANNs include image recognition, stock market prediction, speech and pattern recognition, handwriting analysis, medical diagnosis, text translation, and social media platforms.

The application of neural networks in communication protocols is explored in this section. This section describes the role of ANNs in improving the routing protocol, RPL, used in low-power and lossy networks. A novel objective function, based on neural networks, is proposed for parent selection and routing decisions in RPL implementations. A multilayer perceptron feedforward network is designed, which will be applied to determine the optimal parent for a node within a DODAG.

The hop count (HC), ETX, residual energy (RER), and end-to-end delay metrics are chosen as the criteria for selecting the optimum parent. These four metrics are fed as inputs to the feedforward neural network. The design consists of three layers of neurons. In layer1 there are 10 neurons, layer2 constitutes 5 neurons, and layer3 is a single-output neuron. This is a typical example of a network for performing regression. The network computes the SCORE for each candidate parent depending on the values of the ETX, HC, RER, and delay. This network is trained using a database with 42,67,199 sample values, where the dataset was split 70% and 30% for training and validation. The gradient-descent-based Delta learning algorithm was used for training the network. This network provides an accuracy of 96%. The network is shown below in Figure 17, and the scatter plot of actual vs. predicted is shown in Figure 18a.

**Figure 17.** Neural network for selecting the parent in an RPL network. Source: Adapted from Kuwelkar and Virani (2023), used with permission.

**Figure 18.** (**a**) Actual vs. predicted scatter plot for the trained NN. (**b**) Accuracy of various machine learning techniques vs. ANNs. Source: Adapted from Kuwelkar and Virani (2023), used with permission.

The design and training of the neural network was performed by using tools such as Google Collab and Jupyter Notebook. Several other neural network configurations with different numbers of layers and neurons were tried and tested; however, the one shown above displayed better accuracy and practicality of implementation in Contiki OS. This neural network was compared against other machine-learning-based regression techniques, such as random forest regressor, K-nearest neighbor, and linear regression, which were trained by using the same dataset. Artificial neural networks had the highest accuracy as compared to the other methods. The accuracy graph is shown in Figure 18b.

The steps involved in best parent selection and routing using ANN-based RPL implementation are as follows:


This novel ANN-based objective function must be incorporated into operating systems meant for IoT motes. Contiki is one such OS build for the wireless low-power sensor motes used in Internet of things applications. Contiki OS has a built-in TCP/IP stack and multitasking flexibility. The memory requirement is around 30 KB of ROM and 10 KB of RAM. The RPL is standardized as the routing protocol in Contiki. The neural network functionality is incorporated into Contiki OS and simulations are performed by using the in-built network simulator COOJA (Kuwelkar and Virani 2023).

The network view in Contiki OS COOJA simulator is shown in Figure 19.

**Figure 19.** Network view of ANN-based RPL implementation in the COOJA simulator. Source: Adapted from Kuwelkar and Virani (2023), used with permission.

The test logs generated during the simulation in COOJA can be used to extract the values of power consumption, packet delivery ratio, delay, and control overhead by writing PERL or Python scripts. The proposed ANN-based objective function is evaluated against the standard RPL by varying the node density from 30 to 100. A single sink node is used. Packets of a length of 128 bytes are transmitted at a rate of 5 p/min. The parameters used during simulation are shown below in Table 2.


**Table 2.** Parameters used during simulation.

Source: Authors' compilation based on their research work.

The simulations are performed and graphs are plotted for latency, PDR, average power consumption, and control overhead, as shown in Figure 20. ANN-RPL uses the RER metric, hence avoiding the use of candidates with lower RER as parents. This preserves node energy and improves overall efficiency. It reduces power consumption to the tune of 11%. The delay and HC metrics ensure that candidates with lower delays and shorter routes are chosen as parents, hence ensuring faster packet delivery. The delay in ANN-RPL is lower by 17% as compared to MRHOF. The ETX metric ensures better reliability and hence improves packet delivery. The PDR of ANN-RPL is higher by 3%. In the RPL, the DAO messages are generated after the expiration of the DelayDAO timer. In the standard RPL, the expiration of this timer happens at regular intervals, leading to excess DAO messages circulating in the network. In this work the DelayDAO timer expiration is triggered upon the selection of a new parent node. This ensures that DAO messages are only generated when crucial routing updates must be sent, and avoids unwanted overhead. The DIO messages, which carry the crucial routing information, are generated upon the expiration of the Trickle timer. This timer expires at predefined fixed intervals and after a change in the parent node. Together, DIO and DAO messages ensure that updated routing information is circulated within the network. This leads to a significant amount of reduction in control overhead due to the mechanism adopted in transmitting DAO and DIO messages. Traffic reduction to the tune of 48% is

achieved. This novel ANN-RPL technique is proven to be substantially better than the standard RPL.

**Figure 20.** Plots of (**a**) latency, (**b**) PDR, (**c**) Pavg, and (**d**) traffic overhead for ANN-RPL, OF0, and MRHOF. Source: Adapted from Kuwelkar and Virani (2023), used with permission.

Figure 21 shows the paths chosen from two nodes, N1 and N2, towards the sink node in an RPL instance when the network is operating using the objective function of ANN-RPL as compared to the standard OF0 and MRHOF. ANN-RPL chooses optimal parents that have higher energy levels and lower delays, contrary to what is seen with OF0 and MRHOF. For node N2 there are two neighbors in the vicinity, with the following metric values: P1 (ETX = 12, RE = 230, Delay = 800 and HC = 3) and P2 (ETX = 7, RE = 175, Delay = 1200 and HC = 3). ANN-RPL yields a quality score of 80 for neighbor P1 and 66 for P2. Since the score of P1 is higher, ANN-RPL choses P1 as the parent for the route towards the sink, whereas OF0 and MRHOF

choose P2. As P2 has lower energy and higher delay then P1, it is evident that the performances of OF0 and MHROF networks will be poorer.

**Figure 21.** Route chosen in RPL networks from sender to sink in (**a**) ANN-RPL, (**b**) OF0, and (**c**) MRHOF. Source: Figure by authors.

3.3.1. Comparison Analysis of ANN-RPL with Other RPL Implementations

The performance of the novel ANN-RPL objective function is compared with other work performed previously. The graphs plotted in Figure 22 show the values of ANN-RPL for PDR, latency, power consumption, and control overhead in addition to other implementations, such as RPL-HC, RPL-ETX, RPL-CGA, HOFESA, EEOPS-RPL, E-RPL, and DN-RPL.

ANN-RPL has a higher PDR as compared to the standard RPL, chaotic genetic algorithm, firefly optimization algorithm, and ant colony optimization algorithm. ANN-RPL reduces the number of control overhead in the network, thus ensuring less traffic and congestion in network. This ensures a higher successful packet delivery rate. DN-RPL (Kharche and Pawar 2020) has deep nets in the neural network, which provide slightly higher packet delivery but affect the delay. The HOFESA (Hassani et al. 2021) implementation is an empirical stability aware technique that avoids frequent parent changes to maintain network stability. It provides a trivially higher PDR then ANN-RPL but has higher power consumption.

**Figure 22.** ANN-RPL vs. other works in terms of PDR, latency, power consumption, and control overhead. Source: Adapted from Kuwelkar and Virani (2023), used with permission.

ANN-RPL has lower power consumption as compared to most other implementations, with the exception of genetic algorithm techniques and deep-neural-net-based optimization. In deep nets more hidden layers are added to allow better performance. This assists in achieving lower power consumption in DN-RPL, but with the tradeoff of higher delays. RPL-CGA considers queue length, RER, HC, the ETX, and delay. The computation time in a CGA is significant due to the chaotic mechanism. The optimization in RPL-CGA is more focused for energy as compared to delay.

ANN-RPL uses the delay metric to make a routing decision; hence, it chooses paths with the lowest distance and delay to the root. This provides a significant reduction in latency as compared to all of the other techniques, whereas RPL-HC, RPL-ETX, EEOPS-RPL, E-RPL, and DN-RPL do not consider the delay metric when making routing decisions.

ANN-RPL has the least control overhead compared to all of the other techniques. DAO message generation depends on a DelayDAO timer. In ANN-RPL, DAO messages are triggered only when a new parent is selected. The messages are unicast to the parent node only. This avoids any excess DAO messages in the network and considerably reduces DAO message overhead. Control traffic overhead has a direct or indirect impact on the resource consumption of the network. Less traffic leads to lower congestion in the network and improves the performance further.

If we compare ANN-RPL with the fuzzy-based RPL, then it scores better. In fuzzy logic a range of values within a fuzzy set are assigned the same value and are evaluated without distinction. For instance, a candidate with RER values of 110 and 150 will have equal scores, since they will figure in the same fuzzy set; however, in this NN scheme a candidate with an RER value of 150 will clearly have a higher weightage over one with a value of 110. This technique has more sensitivity and responsivity to the metric values, thus performing better. Table 3, below, shows the percentage improvement in the performance of ANN-RPL with as compared to other works.


**Table 3.** Performance comparison of ANN-RPL with other works.

Source: Authors' compilation based on their research work.

The evolutionary-algorithm-based RPL implementations require more computing time due to the large number of iterations involved in the algorithms. On average, the delay is seen to be around 0.4 min. Additionally, they need more powerful microcontrollers with a larger memory space. This considerably increases the deployment cost. These factors provide ANN-RPL with leverage over these

EA-based schemes. ANN-RPL has much lower computation time since it only involves a series of addition and multiplication operations at the three layers of neurons. The delay is approximately 1.2 s and sizably lower than the EA-based RPL. It can work well on most commercially available microcontrollers, such as the MSP430. This extended and improved RPL version is suitable for the various applications of the WSN and IoT domains. Table 4 below summarizes the various approaches with which to improve the RPL by using soft learning techniques.


#### **Table 4.** Summary of works.



Source: Authors' compilation based on their research work.

#### **4. Discussion and Conclusions**

This chapter has explored two revolutionizing technologies of the future: the IoT and soft computing. The popularity of the Internet of things has grown by many bounds over the decade. With the advancements in sensor technologies, embedded systems, and communication technology, such as 5G, the IoT will pervade our lives in the coming years. To ensure sustainability in such networks, the routing operation plays a crucial role and needs to be optimized. Overall, routing affects energy efficiency, end-to-end delay, packet delivery, network lifetime, and reliability.

The domain of wireless sensor networks and ADHOC networks has matured, and a number of routing protocols exist, such as AODV, OLSR, LEACH, and OSPF. IoT networks are characterized as low-power as well as lossy, and are designed to adopt IPv6 addressing. Due to these factors, existing protocols were proven to be unsuitable with regard to power, latency, overhead, and reliability. To overcome this limitation, the IETF standardized the 6LoWPAN specification, which specifies how to carry IPv6 datagrams over LLNs. As a routing solution, the IETF ROLL working group proposed the IPv6 routing protocol for LLNs (RPL). The RPL provides IPv6 addressing to low-power wireless embedded devices for WSN and IoT applications.

Over a period, the RPL has attained maturity and been standardized as a routing protocol. Although the RPL was able to resolve major routing issues in LLNs, there were still certain limitations that needed addressing. Several researchers have contributed to effectively improving the RPL over the years. In this chapter we have reviewed these works, with a primary focus on the soft computing techniques adopted for enhancing the RPL.

The application of fuzzy logic in order to overcome the limitations of single-metric-based objective function, support for mobility, load balancing, and congestion in the RPL is explained in detail. The application of evolutionary algorithms, such as genetic algorithms, the firefly algorithm, and ant colony optimization, to augment the performance of the RPL is described. These methods provide better results in terms of energy efficiency, packet delivery, delay, and lifetime over the standard RPL, thus paving the way for sustainable IoT infrastructure. In the latter part, a novel technique using a multilayer feedforward neural network was proposed for RPL improvisation. This technique lowers energy consumption by 12%, improves the PDR by 3%, lowers delay by 17%, and reduces control overhead by 48% as compared to standard RPL implementations. Some of these proposed methods have been tested on real-life motes, such as WISMote, T-mote Sky, and the Zolertia Z1 platform.

**Acknowledgments:** We are grateful to the Director, Directorate of Technical Education, Goa, India and Principal, Goa College of Engineering for constant support rendered during the research work.

**Author Contributions:** Conceptualization, S.K. and H.G.V.; methodology and software, S.K.; validation, H.G.V.; formal analysis, investigation, resources, data curation, writing—original draft preparation, S.K.; writing—review and editing, H.G.V.; project administration, H.G.V.

**Funding:** This research received no external funding.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

MDPI St. Alban-Anlage 66 4052 Basel Switzerland Tel. +41 61 683 77 34 Fax +41 61 302 89 18 www.mdpi.com

MDPI Books Editorial Office E-mail: books@mdpi.com www.mdpi.com/books