A comparative node evaluation model for highly heterogeneous massive‐scale Internet of Things‐Mist networks

Internet of Things (IoT) is a new technology that is driving the connection of billions of devices around the world. Because these devices are often resource‐constrained and very heterogeneous, this presents unique challenges. To address some of these challenges, new paradigms of Edge and Fog are emerging to bring computational resources of the IoT networks from remote devices like cloud closer to the end‐devices. Mist computing is a new paradigm that attempts to make use of the more resource‐rich nodes that are closer than Edge nodes to end‐users. Since these nodes might have enough resources to host services, execute tasks or even run containers, the utilization of network resources might be improved, and delay reduced by utilizing these nodes. The nodes must, therefore, be assessed to determine which nodes should offer resources to other nodes based on their situation. In this article, a new comparative assessment model for ranking Mist nodes in highly heterogeneous massive‐scale IoT networks in order to discover nodes that can offer their resources is proposed. The Mist nodes are evaluated based on parameters like resources, connections, applications, and environmental parameters to heuristically compare the neighbors with a novel learning‐to‐rank method to predict a suitability score for each node. The most suitable neighbor is then selected based on the score, with load balancing accomplished by a second chance method. When evaluating the performance, the results show that the proposed method succeeds in identifying resource‐rich nodes, while considering the selection of other nodes.


INTRODUCTION
The Internet of Things (IoT) is recognized as the most important emerging network infrastructure to connect billions of devices around the world. 1 It is increasingly set to become a vital aspect of technology, enabling "things" as devices to sense, communicate, and perform actions. Recently, new applications and developments in IoT have heightened the need for improving the efficiency of the network infrastructure to satisfy a wide range of requirements, such as reducing the energy consumption of the nodes and supporting quality of service (QoS) of different applications. 2 In addition, the rapid expansion in the use of IoT in a diverse range of application areas means the current technology unable to maintain the efficiency of IoT networks regarding the huge volume of data to process and number of nodes to manage. There are increasing concerns that some IoT networks are being disadvantaged because of their massive-scale size and QoS problems. 3 In addition, the underutilization of resources and latency in accessing rich remote resources like the cloud are significant challenges for the current IoT networks. 4 Recently, researchers have been attempting to solve these problems by migrating computing capabilities from Far-end nodes like the cloud to so-called Edge nodes, which are geographically closer to the end-users. 5 The concept of Edge computing is a solution to reduce latency when accessing computational resources at Far-end Nodes and also to improve resource consumption by eliminating the need to connect to remote service in some cases. Edge nodes are generally part of the network infrastructure and are resource-rich nodes like routers, access points, base stations, or gateways. There are currently several different edge computing paradigms that are emerging simultaneously; namely, multiaccess edge computing, 6 mobile cloud computing 7 Fog computing, 8 and Mist computing. 9 While each of these paradigms is concerned with leveraging the computational resources close to end-users in order to perform computation tasks, they achieve this in different layers of the network. Because there are several layers available, its not clear which layer is best utilized to achieve these goals in different situations. 10 When comparing the Edge computing paradigms, the research to date has focused on layers in the network infrastructure devices (Edge and Fog) to execute tasks, rather than resource-rich end-user devices. Although network infrastructure devices are appropriate to execute tasks and host services, there are reasons to encourage the pushing of execution closer to the end-users: • IoT devices are becoming more powerful than before, which enables them to offer free resources to various light-weight or even heavy-weight tasks, in order to help their neighbors and the local network to improve performance. 11,12 • In some IoT applications, the network load consumes a considerable amount of energy and bandwidth to transfer data to the edge of the network. Although Edge nodes are close to the end-users, moving the services even closer to end-users can reduce the network load, leading to more efficient resource utilization. 13 • Moving the location of specific data processing models like caching, or data fusion, closer to end-users can exponentially improve the efficiency of a network by decreasing the amount of data being transmitted across the network. 14 • In IoT networks, there are almost always free resources on IoT nodes that could be used to help the network to improve efficiency. In massive-scale IoT (mIoT) networks, the amount of these free resources can be considerable. Utilizing these can remove the costs of using remote resources (like the cloud) and network infrastructure resources like bandwidth. 15 • Combining the free resources of weak devices can provide a resource-dedicated distributed network infrastructure to execute heavy computation tasks, which will help to save resources and improve the efficiency of the network. 16 Mist computing is a newly defined paradigm that moves computing tasks from the cloud to resource-rich IoT devices; specifically, end-users like home appliances, and resource-rich sensors. 17 Compared with other paradigms of Edge computing, at the moment, Mist computing is commonly used because of the predominance of weak and resource-constrained end-user nodes, when compared with Edge nodes and the complexity of network management in a network with a considerable number of nodes. 18 Although the literature review did not discover any publications that surveyed how quickly the resources of IoT nodes are increasing, it is evident that IoT nodes are becoming more powerful thanks to advancements in digital electronics. Today, wearable sensors are equipped with several network interfaces and have their own operating systems, which enable them to execute tasks, both light and heavy. Thanks to affordable modules and processors, like Raspberry Pi, Arduino, and ARM, most IoT nodes are capable of executing tasks locally without the help of the cloud. Evidence shows that the future of IoT networks belongs to the network paradigms that can use and manage the available network resources efficiently in all layers, because of the volume of data that needs to be processed. 19 Although providing resources on the edge of the network is a solution, there is no logical reason to ignore the free resources of IoT nodes that are more accessible, free, and flexible. 10 Despite the efficient promise of Mist computing, it still suffers from several significant drawbacks. There is not yet much research on implementing Mist computing and a lack of standards for how to do it. How to implement Mist is made complex by the number of heterogeneous nodes found in mIoT networks, and there is an ongoing debate about the best strategies to follow, as they are not as easy to configure efficiently as, for example, Edge paradigms that generally to be considered. In addition, because of the different applications and services that are demanded by each node in a shared network infrastructure, the application layer requirements need to be considered. In order to identify the nodes that are eligible for executing specific tasks or hosting specific services, various methods are available in the literature. However, this article propose a method to assess and identify nodes that are, in general, good candidates for providing their resources to share with others when compared with their neighbors. The selected nodes are relatively more suitable than their neighbors to execute tasks, not only based on their resources but also to satisfy application and physical layers requirements.
The primary objective of this article was to design a node assessment method for highly heterogeneous mIoT-Mist networks. The method proposed in this article contributes to a larger goal of designing a hierarchical clustering method that can be used to build an overlay network for sharing resources in IoT networks. The proposed method can find the most resource-rich nodes, which are also most able, among their neighbors, to support the physical and application layer requirements. The proposed method uses eight comparative parameters among neighbors to select the most eligible nodes. These parameters are then combined to calculate a score for each node. The nodes explore their neighbors to select the most eligible neighbor, and then the best nodes are selected based on votes from neighbors. The results show that the proposed method can identify the nodes which are more powerful and relatively are in a better situation when compared with neighbors in their geographical area. By only considering information obtained from one-hop neighbors in the choice of suitable nodes, the overhead is kept at a minimum and scales well to large networks, unlike methods that need information about a whole network. The proposed method also considers the requirements of the application layer, which can help to improve the efficiency of service placement, service migration, and data fusion. Because some parameters are more important than others, a point-wise learning-to-rank method was used to model the relationship between these eight parameters and heuristically predict a final suitability score. In addition, a second chance method was proposed to reorder the neighbors in order to balance the load among the most suitable nodes.
The main contributions of this article are summarized below: • The provided model is used to identify resource-rich nodes which have a better situation than their neighbors to participate in Mist computing in highly heterogeneous mIoT-Mist networks with hundreds or thousands of nodes.
• Combining parameters that can inform decisions needed to increase the efficiency of a highly heterogeneous IoT network based on different network layer requirements.
• Designing an assessment method that can determine the suitability of nodes in IoT-Mist networks to offer their resources to help their local neighbors.
• Designing a second chance method to avoid selecting only the most powerful nodes and give a chance to the nodes which are relatively good compared with the best nodes.
The rest of the article is structured as follows. In Section 2, related works are reviewed to show the importance of the proposed method. In Section 3. In Section 4, the proposed method is evaluated to show its efficiency. Finally, Section 5 proposes some future works and concludes the article.

RELATED WORK
Resource discovery is a big challenge in many distributed systems 23 and P2P networks. 24 There are several survey articles on resource sharing, 25 resource discovery mechanisms, frameworks, 26,27 and resource management, specifically in new computing paradigms like Edge and Fog computing. 28 In many applications, storage and contents are shared as a resource with other nodes. In Reference 29, Wang introduces SoFA, which is a network resource management model for peer-to-peer semantic communities to organize contents and storage as resources. The challenges that are solved include a method to find appropriate resources effectively and quickly, obtaining and maintaining a huge number of shared good resources, and finally designing a routing mechanism to access the shared resources effectively in P2P networks. They focus on two first problems and the introduced method is used to recognize the location and quality of the resources to solve them, respectively. In SoFA, an autonomous peer model collects information and communication and evaluates them with the help of other local APs to build an expert-driven autonomic semantic community to evaluate the trust based on semantic similarity, history, and time effect.
Discovering resources through distributed systems is considered as a key service in such systems to dedicate and share resources. In Reference 30, the authors use a hybrid resource discovery approach for P2P Grid networks in which they integrate spanning trees for information propagation and epidemic algorithms. They use a mathematical model to predict the process of information dissemination and a model to evaluate the quality of the prediction. They also show that the proposed method is failure resistant in scenarios in which up to 50% of peers are failed in a short time. The authors of Reference 31 study the performance of classic flooding, random walk, and gossip-based resource discovery algorithms in mobile P2P networks, and improved the algorithms' performance in mobile ad hoc networks (MANET) networks. They also propose to improve the algorithms to work in MANET. They compare the algorithms on success rate, energy consumption, response time and overhead and QoS metrics by using an NS-2 Simulator. Talpur et al, 32 introduce an IoT network infrastructure that shares services of IoT nodes as resources to reduce monetary costs. They share the services of some sensors among multiple users and introduce some methods to avoid data loss and spoofing. They simulated their architecture by NS3 and added ubiquitous homomorphic encryption to validate nodes, users, and data. They applied the proposed model to use shared-nodes validated with a geographic saturation model and they also tried to reduce the probability of successful cryptanalytical attacks.
In Reference 33, Abedin et al designed a model for Edge and Fog networks, which is used for node pairing to address utility pairing and matching problems based on Irving's matching algorithm. They use the algorithm to ensure stable IoT node pairing. They provide a model for node pairing in IoT-Fog enabled networks based on modeling the problem as a "one sided stable matching game" and they define a utility-based preference list to pair IoT nodes. Azam et al 34 present a model that is used for resource prediction, resource estimation, reservation, and pricing for IoT customers based on their characteristics. Their model is used to predict and estimate the resources that each customer needs in the Fog, in addition to locating, reserving, and estimate the cost of using the resources from a pricing model. They use CloudSim toolkit and Java to evaluate their proposed model. In Reference 35, the authors present a status-aware and stability-aware mobile device selection method which is used to find optimal mobile devices in edge networks. By storing the status and historical characteristics of mobile devices and using a cloud model to evaluate the stability of each device, the optimal device will be selected to help other neighbors by hosting services and executing tasks.
Fernando et al 36 introduced a work-sharing model called "HoneyBee" to balance the load among heterogeneous mobile nodes based on a well-known work-stealing method. They focus on short-term available mobile nodes that are joining and leaving based on proactive worker and opportunistic delegator concepts. They consider heterogeneity of nodes, unknown capability and dynamism as challenges to address and present a model which use an adaptation of the well-known work stealing method to allocate tasks to heterogeneous mobiles nodes considering dynamicity. Short-term goals and using the advantages of resource sharing on arising the new available resources are two main factors to introduce the model. They report up to 71% optimizing energy consumption in the network. In Reference 37, the authors introduce a search engine in IoT networks which helps to discover objects that are able to store the data from sensors as part of their proposed method. The search engine has three layers, including run-time monitoring the equipment of devices, distributively storing the data, and providing access by IoT devices to data.
Although there is a paucity of literature on the problem of resource discovery in highly heterogeneous Mist networks, the available articles are briefly reviewed. Vasconcelos et al 10 introduce a model to use the computational resources in three different layers of the Cloud, Fog, and Mist. They evaluate the cost, bandwidth and latency of each layer based on available resources and topology of the network to determine the best layer to execute tasks. They also introduce a method that reduces the time of exploring eligible nodes among client devices and their neighbors. The authors in Reference 38 also review how self-awareness can help Fog and Mist networks as a cyber-physical system. They mention that there are two central aspects of self-awareness; namely, attention and situation-awareness. They explain that monitoring the performance of the system to recognize changes is an important aspect. In addition, attention can help to balance the tasks which need resources in resource-constrained CPSs. Barik et al 39 introduce MistGIS, which is used to process geographical information system (GIS) data in Mist and Edge and store the data in the cloud. They use a K-means model to cluster nodes in different geographical areas and evaluate how many Fog and Mist nodes are needed based on their resources to analyze various GIS datasets to reduce the overhead of the cloud.

THE PROPOSED METHOD
IoT is a network infrastructure that connects billions of CPSs, such as sensors, cellphones, home appliances, cars, and homes, to each other in order to gather information and perform tasks. Computation power of IoT networks can be provided by different machines remotely or locally. When compared with traditional cloud resources, such as remote computation resources, the Mist can provide more accessible and affordable resources with greater efficiency by performing computation closer to the user equipment. As IoT-Mist networks contain many highly heterogeneous nodes, recognizing the most resource-rich nodes is a distributed task, and is needed in order to place tasks and services on the most appropriate nodes. In addition, because the IoT nodes are heterogeneous in several aspects, only considering a single feature, like available physical resources, may result in a suboptimal placement of services and computation tasks. Therefore, several requirements need to be considered when selecting the most suitable nodes, and the overhead must be minimal with respect to the size of a massive-scale network, thereby eliminating the possibility of using a centralized task. The proposed method keeps the overhead to a minimum by executing the assessment method as a distributed task in which each node is responsible for comparing itself with its neighbors and selecting the most suitable node. It is demonstrated in this article that the proposed method generally finds the resource-rich nodes in each geographical area, and succeeds in identifying the most suitable nodes in a mIoT network with thousands of nodes. There are, however, some assumptions which need to be considered when using the proposed method: • The nodes are aware of their own energy and hardware resources, including processing power, network interfaces, RAM, and storage. In addition, each node is aware of which services it requires, and whether the node is a data generator or a data consumer of those services. In this article, an application A of Node i , specifies that Node i connects to a specific service related to Application A to send and receive data. In Section 3.2.1, applications are categorized based on their resource consumption. The nodes know which of these categories their applications belong to compare their applications with each other. The user can specify the category of applications and amount of resources that they are expected to consume or they can be specified based feedback systems, resource estimation models, 40 or resource provisioning models. 41 • The nodes are heterogeneous in several aspects, including energy, CPU, RAM, Storage, network interfaces, applications, and the services that they use. Each node is aware of its own resources, applications and the resources and applications of its one-hop neighbors by broadcasting or via piggyback methods. Although the proposed node assessment method is executed in the setup phase, events like mobility, node failure, significant changes in the available resources of a node, or QoS problems can trigger the nodes to execute the assessment model again locally by asking neighbors to broadcast their current state. As the nodes are only assessed locally, there is no need to trigger the reassessment globally.
• The resource metrics are either using standard units among the nodes or are convertible. As the proposed method is a comparative model, having the same units for the parameters for each node is essential, but nodes can have different underlying providers of the raw values and convert the information before broadcasting to their neighbors.
Eight parameters are defined such that they help identify the most suitable nodes, in a geographical area, based on requirements involving several layers in the network stack. These can then be used to place tasks or services or manage other nodes such as cluster heads in clustering techniques. These nodes can also be used for caching and data fusion, which can be executed in Mist networks to reduce overhead of the network. In the definitions, N i is the node that wants to calculate its score, with being N j , … , N z the array of N i neighbors. In addition, C is used as the number of its neighbors. In all parameter definitions, N n is the neighbor of N i , if they have at least one common network interface, like Bluetooth or Zigbee, and their distance is lower than the radio range of the network interface, except for WiFi neighbors who need to communicate with the same access point to connect. As different parameters can have some impact on the requirements of all layers, it is hard to allocate each parameter to a layer, but categorize the parameters based on their highest impact in this section. For calculating the score and selecting the node that is the most capable of offering its resources, the method uses a process: • Broadcast parameters: First, the nodes broadcast their parameter values, like energy, physical resources, coverage area, and its applications to all neighbors.
• Calculate and broadcast score: The nodes then use the proposed method to combine the received parameter values into a score signifying its suitability for being selected. The nodes then broadcast their score to their neighbors.
• Rank and select neighbor based on score: The nodes then sort their neighbors and themselves according to the scores they receive and select the top ranking node.
• Inform the selected node: Having selected a neighbor, the node informs that neighbor that it has been selected.

Parameters to support network layer requirements
The goal of the network layer parameters is to improve the efficiency of the network connections among nodes when considering aspects like QoS, and network lifetime. In this section, the parameters of the proposed method are described, these are all designed to improve the efficiency of network layer services.

Energy
In IoT-Mist networks, most of the nodes are resource-constrained, especially in terms of their energy resources for battery equipped devices. While some nodes are connected to infinite energy resources like a power grid, the method generally consider IoT-Mist nodes to have a limited energy supply, which should be consumed efficiently in order to prolong the life of the device. Each network has a threshold between first-node-die and last-node-die, which is used to evaluate the efficiency of the network, so prolonging the life of each node will also help to prolong the life of the network. In addition, node failure caused by exhausted energy supply can result in data loss, which is a critical problem for reliability-sensitive applications like those found in healthcare. Therefore, energy resource is one of the most crucial parameters to consider when assessing a node. The method, therefore, ensure that nodes with a higher energy surplus than other neighbors will have a higher chance of being selected. This is important because the selected nodes will be under an additional load from processing and data forwarding when helping their neighbors, causing them to consume more energy and reducing the lifetime of nodes if they have a limited energy supply. Energy rest (N i ) is the remaining energy of N i , which in each trigger is broadcast by the node to be compared in neighbors. When comparing the energy of N i with the energy of its neighbors by Equation (1). . ( The result is 0 ≤ Energy cmp (N i ) ≤ 1 which is the suitability of the nodes among its neighbors in terms of the energy resource. When Energy cmp (N i ) is approaching 1, it means that the node has the best energy resource among its neighbors.

Coverage
IoT networks are becoming more quasi-ad hoc networks, as most of the network interfaces are enabled to use device-to-device (D2D) communication with their neighbors. As explained in Reference 42, D2D is one of the main communication technologies in the IoT ecosystem that devices will use to communicate with each other, autonomously, without the need to use a centralized system. Today, many of the most common communication technologies, like WiFi Direct, Bluetooth, and Zigbee are mainly designed to support D2D communication. In addition, new technologies are increasingly supporting D2D as one of the essential methods to improve the efficiency of the networks. An example is 5G, which is one of the most important IoT cellular communication technologies, and has been designed with D2D in mind. 43 Besides, current cellular network communication technologies, such as 4G and LTE are D2D-enabled by FlashLinQ. 44 As the number of IoT nodes is growing, maintaining the efficiency of the network-infrastructure-dependent networks will get harder, due to network overhead and high resource consumption. Network-infrastructure-independent networks, like D2D communication technologies, can provide a more flexible and efficient network infrastructure that mimics ad hoc networks. In quasi-ad hoc networks, the coverage of the nodes is an important parameter to improve connectivity, as nodes can connect to more devices directly via D2D technologies. Having more connections means more routes, more options to apply different priorities to support QoS metrics like reliability and reducing delay, and more solutions to support the dynamism and mobility of the network. The radio range of each node specifies the coverage area, but in several IoT nodes there is more than one type of network interface that communicate with neighbors. As an example, a smart cellphone may be equipped with WiFi, WiFi direct, Cellular D2D, and Bluetooth. The nodes can use different types of network interfaces as both the receiver and sender, which means that the maximum radio range among network interfaces can be considered as the general coverage area of the node. To compare the coverage of each node with its neighbors use Equation (2). . ( As Interfaces(N) returns the radio ranges of all interfaces of node N, Coverage cmp (N) is a value between 0 and 1 which shows the situation of the node coverage compare to its neighbors

Parameters to support application layer requirements
IoT is generally a service-based network, 45 which means that services in one or more machines are responsible for serving end-user devices to execute their tasks and process their data, and end users that need a service need to communicate with the host of that service. Traditionally, IoT services run on the cloud, but because the cloud is geographically far from end-user nodes, this can cause inefficiencies. A solution is to migrate the services to machines that are closer to the end users or even resource-rich end users as in Mist networks. Most IoT services need significant resources in order to be executed, which means that the nodes with more resources are more appropriate as the host of a service. In addition, how close the host of a service is to end users is important to reduce delays and improve resource consumption. Therefore, the selected nodes should compare favorably, in both proximity, and resources when considering the application requirements against their neighbors.

Hardware resources
Physical resources (generally known as hardware resources) are one of the most important parameters to identify suitable nodes. For this method, each node has a measurable amount of processing power, storage, and forwarding rate, which indicates the amount of resources available to execute tasks. In this method, the nodes will only broadcast the available resources they can share. Three types of hardware resources are considered: Forwarding rate is the number of bits per second that can be transmitted through the node. A node can have different forwarding rates for different network interfaces. As each node in quasi-ad hoc networks can be used as a relay, the forwarding rate is an important factor. While there is another parameter called "interfaces," which compares the availability of network interfaces by type, it is worth mentioning that a single type of network interface can have different forwarding rates based on various protocols, standards, physical obstacles, or interference, so each node needs to consider its forwarding rate separately. Processing power: All tasks require some CPU cycles to be executed, some more than others. In order to run services on a node, considerable computation power might be required. As IoT nodes are generally resource-constrained, discovering nodes with an abundance of computation power can identify them as able to run both light-weight tasks like data fusion and heavy-weight tasks like containers. RAM is another parameter to consider, as some tasks require significant amounts of RAM resources. In this article, both CPU and RAM are referred to as the processing power parameter. Storage: Especially in Big data IoT applications, nodes and services might need to store huge volumes of data to save, process, and forward. Having more storage in some applications helps to gather more information and process them before transferring, which would reduce the network overhead. In addition, there may be cases where applications need to store data in order to trigger services like database containers. Storage capacity is, therefore, a useful parameter to determine if a node is an eligible candidate in case of storage-consuming applications. To compare the hardware resources of each node with its neighbors Equations (3) to (6).
To integrate RAM and CPU as two parameters which affects computation power, Equation (7) are used, which indicate the processing power of the node compare to its neighbors.
Although the available resources parameter can be used to show the eligibility of a node, in reality, if nodes want to offer their resources, they need to evaluate the resource requirements of their neighbors. Each type of application needs different resources, which can be determined by the user or can be estimated based on various resource estimation methods. Table 1 is used to classify different types of applications as "application" defined in Section 3. Each application is classified into one of eight groups based on its requirements, as listed in Table 1. In this table, "Yes" means that the application needs a significant amount of the specific resource to run in the node, and "No" means the application does not need a significant amount of the resource in the node. In the equations, "Yes" is translated to 1 and "No" is translated to 0. The total number of possible applications per node is A, and each node can have up to 1 application per type. If A = 8, then a binary array shows each node has what types of applications. As an example, 1101001 shows that N i has Application types of 1, 2, 4, and 8. If N i has C number of neighbors, first, the number of requirements of all neighbor applications is counted separately, and designated Forwarding Nei-apps (N i ), Processing Nei-apps (N i ), and Storage Nei-apps (N i ). These are based on Equations (8) to (10), respectively. As N n (App p ) returns 1 if the application of p of Node n needs the resource significantly and returns 0 if it does not need the resource.
Processing rate (N n (App p )). Total resource requirements of neighbors is calculated by Equation (11).
To show the weight of each resource compare to others to select the eligible nodes, use Equations (12) to (14).
Finally, to compare the available resources in node N i with requirements of applications of its neighbors, Equation (15) is used, in which 0 ≤ Resource cmp (N) ≤ 1. Resource cmp (N) show that how much the node is eligible compare to its neighbors in term of hardware resources to support requirements of its neighbors.

Application similarity
Although it is hard to predict the similarity of applications, such as two neighbors watching the same movie in order to use caching methods, the similarity of application types can increase the chance to use methods like caching, data fusion, or hosting a relevant service close its users. As an example, if node N i is selected by 20 nodes, all of which are either a generator or consumer of the same type of application, like temperature sensing, N i has a good chance of reducing the resource consumption and improving the efficiency of the nodes by hosting a service which fuses data before sending to the cloud. In the proposed method, a weighting model is used to give priority to specific applications, which can be helpful in supporting QoS by giving more priority to more important applications, such as real-time applications. If an application has a higher priority than others, a node that is more similar to neighbors for this application type has a higher chance of being selected. In the method, the total amount of weights should be 100. For example, the weight of all applications can be 12.5, which indicates that the priorities of all applications are equal. In Equation (16), App b (Neighbors(N)) calculates the total number of App b for neighbors of node N.
Two different situations are available to compare the similarity of applications of neighbors formulated in Equation (17). Mathematically, two conditions are described in Equation (17).
Equation (17) shows that when N i calculate its score, it if has Application b then it increase score, otherwise increasing or decreasing the score is related to the number of neighbors which have the Application b. If there are a lot of neighbors which have the Application b then the score is increased, otherwise the score is decreased.
To show the eligibility of the node in case of similar types of applications with its neighbors, Equation (18) result between 0 and 1.

Neighbors
The number of neighbors can affect the performance of the nodes, as more physical resources are needed to host services and execute tasks to help neighbors. In addition, a node in a crowded area will have a higher chance of having more neighbors at some points during its lifetime, because of the dynamicity of the network and node movement. In order to compare the number of neighbors, the proposed method uses Equation (19), which gives a value between 0 and 1.
In order to ensure that this parameter has the same range as the other parameters, the result is subtracted from 1. If Neighbor cmp (N i ) is approaching 1, it means that the node is more suitable than other neighbors. Comparing the available resources and the number of users is done by a machine learning method, as explained in Section 3.5.

Parameters to support physical layer requirements
IoT networks are generally considered as UDNs in many IoT applications, such as crowdsensing and smart cities. 22 In such applications, the physical layer requirements should be supported to reduce the interference. Three parameters are considered when selecting nodes that can improve satisfying physical layer requirements listed below:

Interfaces
An IoT node can have multiple network interfaces which can determine its ability to communicate with other nodes and its reliability to transfer data by using different network interfaces in case of failures and inefficiencies. As the host of services and a place to execute tasks, the nodes with multiple interfaces can connect to more nodes and reduce interference by changing the active network interface. In the comparison, Bluetooth, Zigbee, Wi-Fi, Wi-Fi Direct, and Cellular D2D are considered as possible network interfaces for each node. Having more interfaces gives a node the ability to discover more nodes, support them, or use their resources efficiently. In addition, with more interfaces it is possible to find better and more efficient routes in a heterogeneous network. Furthermore, connectivity impairment can be solved by switching between different network connections. In the proposed method, the five types of interfaces are expressed by a Boolean array for each node. The number of interface types is equal to Interface type = 5. In order to compare the number of interfaces with neighbors, the proposed method uses Equation (20). Interface a (N) is equal to 1 if node N has the network interface of a.
To sum up the whole network interfaces of the neighbors of N i , Equation (21) is used.
To calculate the similarity of network interfaces among neighbors, the following equation is used: To calculate the similarity of network interfaces between N i and its neighbors, Equation (23) is used: The result of Equation (23) is between 0 and 1 and show the similarity of network interfaces between N i and its neighbors.

Proximity
Interference is an important problem in UDN IoT networks, and with the multiple interfaces in a node, the problem is even more critical. The selection should, therefore, consider the eligible nodes as bottlenecks if several nodes connected to them. As a fundamental solution to reduce interference, each node can reduce the radio range of each network interface by reducing the power used to communicate with other nodes. In addition, reducing radio range helps to decrease energy consumption simultaneously, as the wireless transmission is one of the leading causes of energy drain in IoT networks.
To support this solution, nodes that are closer to their neighbors should be selected to be able to reduce radio range. The energy consumption of a wireless transmission has a high correlation with the distance and the communication technologies used, following Equation (24). 46 Here, d(N i , N j ) is the distance between nodes N i and N j . Equation (25) is used to calculate the average proximity of N i and its neighbors in a 2D environment. Equation (26) is used to compare the proximity of the node with its neighbors, which is between 0 and 1. Proximity

Density
One of the problems of quasi-ad hoc networks is blind spaces if the network is highly dynamic, this could even be a critical problem. To improve the connectivity, nodes that can connect more nodes should have a higher chance of being selected. Density measures, proportionally, how many nodes are available in the area covered by a node. In order to achieve the most extensive coverage of an environment, a node that can support more nodes based on its coverage should have a higher chance of being selected. Equation (27) is used to calculate the density of the area which is covered by N i . To compare the density of the N i with neighbor's density, the proposed method uses Equation (28).

Correlations among parameters
While eight parameters are considered when selecting the optimal nodes with respect to layer requirements, not all parameters are equally important in all situations. Therefore, these parameters must be prioritized when comparing the nodes.
A simple solution is to use a weighting model or optimization methods to give different priority to each of the parameters, but in some cases, there is a trade-off among two or more parameters based on their values. This trade-off makes the problem more complicated, as the weights of parameters should be recalculated in each case. Therefore, instead of using a weighting model, the priority order list shown in Table 2 is used. In Table 2, the principal correlation and priorities among parameters, based on human understanding of the problem, are given. In addition, the table reports how much effect each parameter has on supporting each layer's requirements, as some parameters can affect multiple layers. The priority order list is the foundation stone of an initial dataset for the learning-to-rank method provided by a human expert, which is a method described in Section 3.5. To show the whole idea and parameter correlations, a dataset was built by the authors by answering questions based on the table, which is available in Reference 47 as a CSV-formatted file named "Machine Learning Dataset.csv." In order to convert the idea from numeric to human-understandable format, a semi-fuzzy method is used to express the idea in a dataset. Each input and output parameter can have three values: Low, Medium, and High. Based on these parameters, all input values are between 0 and 1. By having eight parameters and three values for each, there are 6561 possible statements. A random method was used to select only 500 statements, and they have been answered by an expert to show the correlation based on Table 2 and the priorities. In addition shown in Table 2 are the effects of each parameter on energy consumption and QoS. In addition to presenting the priority of each parameter, the rules are only formed by logical conjunctions. However, the score as the output of the method used in this article is produced by the machine learning model explained in Section 3.5. Node N i calculates its score and broadcasts it to the neighbors N j … N Z via several different network interfaces in the setup phase. In addition, N i uses the scores received from its neighbors, in addition to its score, to create a sorted list of scores. The first node of the list is selected as the most eligible neighbor, and it is informed by the node. The machine learning method learns a general model that combines information from all parameters. Because of the way the dataset used to train the machine learning model is built, the model will incorporate the priority of the parameters. Here are the eight rules used to describe the trade-offs between the parameters that are considered when building the dataset used to learn the machine learning model: 1. Energy and physical resources have the highest priority. When they have different values, Energy is more important. 2. There is a trade-off between Neighbors and Energy; when Energy is high, having more neighbors increases the score; if Energy is low then fewer neighbors can increase the score. 3. The trade-off between Neighbors and Physical resources shows that if Neighbors is high, Physical resources should be so high, and if Neighbors is low, then the impact of physical resources is lower on decreasing or increasing the score. 4. When the Application similarity is high between N and its neighbors, then the physical resources should also be high to increase the score. When it is low, higher physical resources can increase the score further. 5. There is a trade-off between neighbors, rule 3 and rule 4, as when the number of neighbors is high, then rule 4 should be lower to increase the score. 6. There is a trade-off between Interfaces and Coverage, as when Coverage is high, higher Interfaces can increase the score more than the situation in which the Coverage is lower in the same value of Interfaces. 7. There is a trade-off between Interfaces and Neighbors, as when the number of neighbors is high, higher interfaces increase the score further. 8. There is a trade-off between Proximity and Density, as they have an equal priority in the same values, but Proximity has a higher priority when values are different.
Based on Table 2 and the rules, an expert answered a learning model that is available in Reference 47. Then the model is used by a learning-to-rank method explained in Section 3.5.

Learning-to-rank method
In this article, a ranking method is used to select the optimal node. The goal is to train a machine learning model to learn to rank the neighboring nodes based on each of the parameters, such that the order within the ranked list of nodes will represent the priority of the nodes. Because the relative order of any two nodes is not well defined, a model learns to approximate the order by modeling the correlations between the parameters and a score representing the position of the node within a set of examples ordered by an expert based on Table 2 and the priorities. This is known as a point-wise learning-to-rank approach. Because the model should replicate the judgment of a human expert regarding which node should be selected as the next hop, building the dataset, essentially, becomes a matter of designing a protocol for interrogating that expert in order to extract as much useful knowledge as possible within the time an expert could be expected to give.
The solution involves first generating a list of 200 points from an eight-dimensional Sobol sequence spanning the unit hypercube. Unlike alternatives like randomly sampled points, using a Sobol sequence ensures that the parameter space is covered with a much lower discrepancy, thereby reducing the number of examples needed in the datasets. The list of points was then sorted using the Timsort algorithm, with each comparison being presented to the expert as a problem of determining which of the two nodes should be preferred. The parameter values were separated into three equal ranges and displayed using the text values "low," "medium," and "high." Using this simplified presentation of the raw values makes the questions easier for the expert to answer quickly, and for the low number of examples in our datasets, no two examples will be mapped to the same combination of text values. Finally, the target scores for each example were generated as the 0-indexed position within the ordered list and normalized to the range [0,1) by dividing the index by the total number of rows, with the lowest index being assigned to the worst node configuration. Num round The entire dataset is available in the comma-separated file 47 named "Machine Learning Dataset." In the file, the first eight columns contain the points in the parameter space that were generated from the Sobol sequence and used as input variables to the XGBoost algorithm. The rows are sorted according to the input from the expert, with the last column containing the normalized rank.
In order to learn a model to predict the experts' knowledge when presented with a previously unseen combinations of values, the XGBoost algorithm is used. 48 XGBoost is a state-of-the-art implementation of the popular gradient boosting decision tree algorithm, and is capable of both classification and nonlinear regression. XGboost is robust against noise in the data and can handle small datasets. The algorithm works by successively fitting many small decision tree learners with each new tree correcting the errors of the preceding trees. This makes the overall ensemble robust to overfitting, a significant problem with very small datasets.
The 10 most important parameters of the XGBoost algorithm were tuned by using a random search strategy that samples and evaluates 400 points from a uniform distribution spanning the [1, 0] 6 six-dimensional hypercube. These points are then mapped to the ranges required by the XGBoost algorithm by using the equations specified in Table 3, a mapping based on the approach in Reference 49. The best performing hyperparameters were then selected based on the mean absolute error (MAE) obtained from a 10-fold crossvalidation.
The model was evaluated on seven datasets, one using only the plain dataset values, and six containing from 1 to 6 of the principal components being added as additional predictors to the dataset. The hyperparameter procedure was repeated for each dataset, with only the best performing MAE from the 10-fold cross validation for each dataset being reported. The best performing parameters, which achieved a MAE of 0.10999, were a learning rate = 0.047197, max depth of 3.925077, colsample bytree = 0.728061, min child weight = 15.014327, subsample = 0.7615632, and num round = 170. The model used for the remainder of this article were fitted using these parameters to the entire dataset.

Second chance method
When the node must choose between many resource-rich nodes within the local geographical area, all nodes will select the best node when using the method proposed in this article. That is because the method is designed to select the most suitable node, and in cases when there are several suitable nodes close to each other, our method, therefore, will select the best one. This can cause network congestion or inefficient resource utilization, as there are available resources in the local area, but all of the tasks are being executed on only one machine. Therefore, a second chance method that is designed to balance the load among the most suitable neighbors is also proposed in this article. The method consists of a fuzzy model that is used to compare the selected node with other neighbors in order to give a second chance to other suitable nodes of also being selected. This works by creating an array of all neighbors, sorted in descending order by score. Each node is then compared with the most suitable node. To compare the nodes selected by the choosing node N i , called selected old (N i ), with other neighbors, the Equations (29) and (30) were used to calculate the inputs of the fuzzy method, as shown in Figure 2. In addition, Table 4 shows the rules of the fuzzy model, which as used in the second chance method, contains inputs and an output.
F I G U R E 2 The fuzzy method that is used to give a second chance to other suitable nodes Equation (31) shows the results of the second chance method based on Figure 2. As Score(N) returns the score of node N, Score second chance (N j ) returns the output of fuzzy method for Node N j and Rand(x, y) generates a random float value between x and y and Selected new (N i ) shows the new eligible node which is selected by N i .
The primary measures used for the second chance is the number of neighbors and scores, which are compared by using a fuzzy inference system (FIS) model that is described in Figure 2.

PERFORMANCE EVALUATION
The performance of the proposed method was evaluated by modeling an IoT network consisting of 1024 nodes, which represents a general scenario. The types of nodes used are described in Table 5. In that table, the nodes are sorted based on their resources (energy and physical resources), and stipulate, for this scenario, that both the energy and hardware resources have the same priority. The network is simulated using the Riverbed Modeler (formerly known as OPNET Modeler) version 18.5, as a commercial network modeler for modeling highly heterogeneous networks. The nodes are simulated using the "MANET Station advanced" node model available in OPNET, as the base class of IoT nodes in the simulation. The base model is extended by including an energy resource model. Additional network interfaces were added, in addition to the built-in network interface WLAN, in order to simulate a heterogeneous IoT ecosystem. In order to implement some of the logic into the simulation, the OPNET modeler connected to the MATLAB engine by using MX-Functions, such that OPNET calls the MATLAB engine. Each node sends its information to MATLAB engine and MATLAB returns the results to the modeler. In addition, to integrate the machine learning model, MATLAB calls Python3. From OPNET modeler to Python and vice versa, all tasks are suspended until the calls returned. To evaluate the performance of the proposed method, there were three types of results expected in selecting the most suitable nodes, as listed below: • Resource-rich nodes will get a higher score when compared with their weak neighbors, and should then be selected.
Neighbors and their circumstances can affect their scores, so, in most cases, the same types of nodes might not have the same score based on their local eligibility.
• In the presence of some resource-rich nodes in the geographical area, it was expected that the most resource-rich nodes received the highest scores.
• In the absence of resource-rich nodes, the most suitable weak node should get high score in its geographical area, but other weak nodes should get low scores.
The different scenarios are designed to test how good the proposed method is at selecting the most suitable nodes in a complex environment. In the absence of stronger nodes among neighbors, weaker nodes should be selected. Without using the second chance method, only the strongest nodes should be selected, but when the second chance is used, other relative strong nodes should also be selected. In Figures 3 to 7, two measurements were used to describe the generated scenarios: # of nodes: The number of nodes for that type # of neighbors of the node type: How many nodes in the network can communicate with type x nodes include type x nodes. In addition, eight measurements was also used to show how the proposed method selected the nodes in cases of both weak and resource-rich neighbors. A threshold parameter refined the number of selected nodes per type of node to show how nodes will converge to resource-rich nodes.

# of Clients:
How many nodes selects nodes of type x as the most eligible nodes include type x nodes. # of Clients (second chance): How many nodes selected nodes of type x by using the second chance method. # of clients (Threshold ≥ 3): How many nodes are selected when each selected node has at least three clients. # of clients (Second chance and Threshold ≥ 3): How many nodes select nodes of type x by using the second chance method when each selected node has at least three clients.   How many nodes of type x are selected by using the second chance method. # of selected nodes (Threshold ≥ 3 )

TA B L E 5 Different type of nodes
How many of nodes of type x, are selected at least by three nodes. # of selected nodes (Second chance and Threshold ≥ 3 ) How many of nodes of type x are selected by at least three nodes.  In some cases, the sum of "# of nodes" for all node types is lower than the total nodes contributed in each simulation, for example, 1024 in scenario 1. This is because the nodes are randomly distributed, and some nodes have no neighbors in the area covered with at least one similar network interface. These nodes are not counted in the results, as they have no neighbors to compare or be compared against.
As the method is designed to be used in IoT networks, many nodes are required to show whether it is efficient or not. Therefore, statistical information on the suitability scores and their correlations with the different types of nodes and the types of neighbors of each node, was summarized, as it is impossible to show results in detail for more than 1000 nodes. The tables help to understand the behavior of the method in the various scenarios. In Tables 6, 7, 8, 10, 11, the columns are based on the average number of node types of each node separated by their scores. As an example, in Table 6, the value of the first column and the first row means that nodes which are an instance of Type 1 and their scores are between 0 and 0.1, have the average neighborhood of type 3.53. For node type t and 0 < score{N} < 0.1, used Equation (33). In addition, 0 in the tables means that there are no nodes of type t with the aforementioned score. The tables can help to show the scores that the proposed method provides the nodes in order to compare their neighbors. Furthermore, all of the information that is needed to mimic the scenarios in various datasets, is provided. Datasets related to the scenarios in the performance evaluation section are available in Reference 47 in a CSV format that contains the node name, selected eligible node by each node, the node type, the number of clients per node, the number of neighbors, the score, the average type of neighbors per node and position of nodes (metrics of node position is in kilometers).    Count(Nodes(0 < Score(N Type t ) ≤ 0.1)) .
Here, Avg Neighbor_ Types (N i ) is the average types of N i neighbors and Sum r (v) is sum of v for nodes that satisfy condition r.
In addition, Count(r) is the number of nodes that satisfy condition r.

Scenario 1: Equal distribution of all types of nodes
This scenario is built by randomly placing 1024 nodes in a 200 × 200-meter environment. To assign a node type to each node, samples was drawn from a uniform probability distribution, such that a node as an equal chance to be one of any of the ten node types. Figure 3 shows the distribution of the different node types in the randomly generated scenario. When comparing the # of neighbors with the # of clients, the most selected nodes are of type 9 and 7 when not using the second chance method, as they have the highest energy resources. When the second chance method is used, the distribution of the clients is much better at also selecting weaker, but the still usable, type 4 and 5 nodes as 220% and 30% increase, respectively. In addition show in the figure, without using the second chance method, more than 55% of the nodes connect to the type 9, but by using the second chance method, this is decreased to 40%. The number of nodes that select the type 10 nodes is also increased to 40%. The figure also shows that although weak nodes are selected rarely, by using the threshold, the weak nodes can be deselected when they are in an area in which all the other neighbors are not weak, as well and they only selected based on only having few weak nodes. The threshold can help to solve the problem of selecting weak nodes in sparse areas, as in some cases weak nodes have only few neighbors at the edge of the network which cannot connect to other nodes as nodes in blind spaces. If they are in an area that all nodes are weak, then more than three nodes should select them as eligible nodes. Otherwise, they will be deselected based on the threshold. As an example, in scenario 1, the nodes of type 1, 2, and 3 are sometimes selected, but when using the threshold, most of them will be deselected. Besides, it shows that type 8 is not selected because of its low energy resources, even when having excellent physical resources or circumstances when compared with its neighbors. As shown in the figure, most of the weak nodes have only a few clients, as shown by "# of selected nodes" for type 1 being 23, and the number of clients is 28, and 22 of them are deselected by using the threshold. On the other hand, in resource-rich nodes, the number of clients has mostly remained the same, especially when the second chance method and a threshold are used simultaneously. As an example, nodes of type 7 has 157 clients. And by using threshold and the second chance method, it decreases to 125. This shows that the second chance method can reselect the resource-rich nodes that are deselected by threshold and avoid reselecting weak nodes. Table 6 shows the average types of neighbors for the different types of nodes. As shown in the table, most of the nodes, which have a lower score than the same types of nodes, have neighbors who are richer in terms of different types of resources. In addition, in other cases, the nodes have a higher score when compared with the types of their neighbors because of their circumstances. In this article, when a node has a better circumstance when compared with its neighbors means that the node has better circumstances in terms of application and physical layer parameters. Since its same probability of all types of nodes, the neighbors of node N i can be very diverse in terms of their types. While this does put the proposed method under pressure, it can still handle nodes, such as type 6 and beyond, and most of the nodes, which have strong neighbors, still have a high score. As expected, there are some weak nodes that have a relatively high score because they have only weak neighbors, but none of them are more than 0.5, which shows that being in a very well situation cannot overcome the resource parameters which have the highest priorities. In addition, the table shows that although type 8 has excellent resources, the low energy resource parameter means that they cannot overcome other types of nodes and, therefore, only get low scores.

Scenario 2: Higher proportion of weak nodes
In this scenario, the number of weak nodes is higher than resource-rich nodes. To assign different types to the nodes, a random value is generated for each node by Type Rand (N i ), which is in (0, 1). Then, the generated value is searched for in P and N i is an instance of type x node when 1 ≤ x < 10 and 2 < y ≤ 10, and also they satisfied :  Figure 4. As shown in the figure, most of the selected nodes are of type 10, 9, 7, or 5. In cases of having less resource-rich nodes, node type 10 is selected more than scenario 1 equal probability as less Type 9 and Type 10 nodes are close to each other. In addition, nodes Type 5 are selected three times more than scenario 1 as they are more available than other type of resource-rich nodes in the network. With the second chance method, there is a chance to select nodes of type 4 as they are, relatively, more suitable and available than the other types. The load of clients on Type 10 is decreased to 60%, because of the added other types. As shown in the figure, the number of clients of type 4 nodes increases to about 150%, and the number of clients of type 5 nodes increases to 25%. Without using a threshold, the number of clients of type 1 is high, but by using the threshold, some weak nodes are still selected as eligible nodes as the average types of neighbors is not too high, as shown in Table 7, but most them are deselected, which shows that few nodes selected them, initially. In addition, as shown in the table, in some cases, although some nodes have fewer resources, they still get high scores because the situation compares favorably to that of their neighbors. In addition, Figure 4 shows that using the second chance method and threshold simultaneously gives a higher chance of selecting weak nodes to balance the load, which means that each weak node only needs to have a few clients. This ability to balance the load among multiple nodes becomes essential when there is a shortage of resource-rich nodes, as each weak node is only capable of offering their resources to a few neighbors.

Scenario 3: Higher proportion of resource-rich nodes
In this scenario, a higher proportion of strong nodes is generated using the same procedure described in Section 4. As shown in the figure, in this instance, most of the selected nodes are of type 9, as they are available everywhere (more than 15% of nodes), and because they have high energy resources. Furthermore, the other resource-rich nodes are not likely to be selected by neighbors without using the second chance method. By using the second chance method, some nodes select other resource-rich nodes, as shown by the number of clients of type 4 and 7 which increased by about 100%, type 10 which increased by about 90%, and clients of node Type 9 which instead decreased by about 25%. In addition, using the threshold shows that all weak nodes were selected by few clients, which are deselected. In addition, Table 8 shows that, having a lot of resource-rich nodes, the scores of the nodes decreases since most resource-rich nodes are between 0.4 and 0.7, and most of the weak nodes are between 0.1 and 0.4. The types of neighbors have less impact on the scores when compared with Tables 6 and 7, as nodes in the current scenario are much stronger than previous scenarios, but the correlation between the scores of the weak nodes and those of the resource-rich nodes is still set. Moreover, Figure 5 shows that most of the weak nodes are selected more rarely than three nodes; nevertheless, most of the resource-rich nodes are selected by more than three nodes, so there are no tangible changes in the number of selected nodes when using the threshold but the second chance method helps balance the load between them.

Comparing different proportions
To compare the scenarios and the impact of the types of nodes on the scores, Table 9 is used. The table compares the minimum, maximum, and average scores of nodes in different scenarios. As shown in the table, the lowest scores are, in most cases, sensitive to change in the contribution of different types of nodes. In scenario 3, the highest scores are reached when compared with other scenarios in case of having the lowest score, as shown by having more of the resource-rich nodes increased the score of all nodes. For average scores, scenario 1 has the highest average scores, which shows that having the same contribution of types of nodes can conceal most of the suitable nodes as the average scores are close to highest scores, and it can make the selection method more complicated. In addition, for the highest scores, the first two scenarios have approximately the same values, but scenario 3 has lower scores, which shows that having more resource-rich nodes can decrease scores but also reveal the most eligible nodes as highest and average scores are not close. Overall, by comparing the difference between the lowest, average, and highest scores of each type of node shows that scenario 1 has the highest diversity of scores for each type of node, as expected. Scenario 3 has the lowest diversity, which means that having more resource-rich nodes can make the selection process more complicated as scores are closer to each other and can conceal the neighbors that would be suitable. As shown in Table 8, the second chance method can help to solve the problem by giving a second chance to nodes that are also suitable. In addition, in case of having same probability for all nodes, having threshold can help to deselect weak nodes, which have received high scores because of their mixed types of neighbors.

Scenario 4: UDN IoT network
To assess the performance of the method in Massive-scale UDN IoT networks, a scenario consisting of 5076 nodes in a 300 × 300 meters environment was designed, generated using the same method as scenario 1. The details are available in Reference 47. Equation 6 shows the results of the proposed method for scenario 4. As shown in the figure, although the weak nodes as part of a UDN have more neighbors within their coverage area, they still have the most resources and better circumstances compared with their neighbors. Because a mIoT network has more nodes, the average types of neighbors, when compared with their scores, are increased, as shown in Table 10. Unlike the other scenarios, some nodes have scored higher than 0.7, and this shows that the density of the network can affect the proposed method and the scores. But the correlation between the scores of weak and resource-rich nodes in two different scenarios with different numbers of nodes present. Most of the weak nodes have also not attained scores better than 0.5, even when the circumstances are better than their neighbors. In addition, as shown in Figure 6, there are no tangible changes in the number of clients for resource-rich nodes when a threshold is used. The figure also demonstrates, as for general networks, that the selected weak nodes only have a few clients, and a threshold can be used to remove most of them.

Scenario 5: Comparing the proposed method
For this scenario, the model introduced in Reference 50 was used, which is based on a fuzzy method to compare the IoT nodes. In this model, all possible rules of the fuzzy model are extracted by a learning-to-rank method to compare nodes.
The results of using the method introduced in Reference 50 are shown in Figure 7. As shown in the figure, the distribution of the selected nodes among resource-rich nodes is more unfair than scenario 1, resulting from having more of the same types of nodes. Almost all nodes which are within the coverage area of a type 9 node and, therefore, selects them. By using the second chance method, the distribution of selected nodes is fairer, but still, the number of nodes that select type 9 is high because the scores are so close to each other. Besides, using a threshold can show that the node assessment model, based on fuzzy, selects more weak nodes. The figure also shows that, compared with scenario 1, nodes of Type 4, 5, 7, and 10, that are resource-rich, are selected less, even by using the second chance method. It confirms that the scores which are generated by the fuzzy-based method are closer to each other, which makes the selection procedure complicated and sensitive. In addition shown in Table 11, is the results of the average type of neighbors for the fuzzy-based method. The distribution of scores in the proposed method is better than the fuzzy-based method, as most of the nodes have scores between 0.1 and 0.6, but the scores in the proposed method is more evenly distributed between 0.0 and 0.8, which lessens the chance of selecting an inefficient node. As a conclusion, performance evaluation section shows that the proposed method is able to reveal eligible nodes in mIoT networks with thousands of nodes. The proposed method is able to detect nodes which are in a good situation and have more resources than their neighbors. When most of the nodes are weak, the method selects the nodes which are better than their neighbors. On the other hand, when there are considerable number of strong nodes are available, the proposed method helps to detect the strongest. In addition, the second chance method help the pure method to balance the number of members of eligible nodes in case of having several strong nodes close to each other. In addition, the tables show that score of nodes in different cases is related to neighbors, but consequently selected nodes are eligible globally even in UDN to dedicate their resources to neighbors in one-hop communications.

CONCLUSION AND FUTURE WORKS
Recently, computing paradigms like Edge and Mist are aiming to move more and more tasks and services closer to the end users. However, this requires identifying nodes that are able to share their resources, which can be a complicated task, especially in mIoT networks, as the huge number of nodes can hide the most suitable candidates. In this article, a novel method for evaluating the nodes in a highly heterogeneous-mIoT network is proposed that helps to identify relative resource-rich nodes. When evaluated in simulations of five different scenarios, the method succeeds in identifying the powerful nodes, when those nodes are available, while in absence resource-rich nodes, the local and relative resource-rich node are selected. While, there are a few evaluation methods proposed in the literature, existing methods do not consider several layers requirements during the nodes comparison, such as requirements from the application and physical layers that are needed for the methods to adapt to networks such as massive-scale and highly heterogeneous IoT. In addition, as the methods do not consider different layers requirements, selected nodes are not optimally able to serve tasks like caching, data aggregation, or executing containers. The method proposed in this article considers applications, hardware resources, the situation of the neighbors and environmental factors in the comparison of nodes to identify most suitable nodes, thereby increasing the effectiveness of techniques aiming to move computation closer to the end users.
The proposed method works by assessing the usefulness of neighboring nodes by comparing scores received from them. The score of each node is calculated by comparing its information and its situation with its neighbors. The comparison considers aspects like hardware resources, network interfaces, and the number of neighbors, all of which are then combined to form a single final floating-point score by using a learning-to-rank method. Because there can be several resourceful nodes in the network, a novel load balancing technique, named second chance, based on fuzzy logic, is also proposed. This method is used to reevaluate the selection of a node in order to also select other, only slightly less resourceful nodes.
The proposed method was evaluated using simulations of five scenarios designed to test different situations of networks including massive-scale networks and different quantities of resource-constraint and resource-rich nodes. In all scenarios, the proposed methods succeed in selecting the most suitable nodes, even in the scenario representing UDN networks. When evaluating the second chance method, other powerful nodes were also selected, thereby balancing the load among the most powerful nodes. But the much less powerful nodes remained largely unselected.
The main idea of the article is that the proposed method will form the foundation of a new clustering technique to unlock the power of highly heterogeneous IoT-Mist networks. The method can be further extended for use in a cluster head selection method to manage and share the available resources in IoT-Mist networks, but this is considered as future work. In addition, the method can be used to develop distributed computing in massive-scale networks, as it is able to identify the most suitable nodes to contribute to the computation. The proposed method is vulnerable to security attacks involving a malicious actor broadcasting false information about their resources and situation. Avoiding such security attacks is considered as future work as well.