The Internet of Things (IoT) is a heterogeneous network where objects hold various characteristics, such as identity, physical attributes, computational and sensing capabilities [1, 2]. For the vast majority of IoT objects, it is important to reduce the power consumption by communicating or making certain tasks. Further, objects must evenly share their resources and cooperate to support a better network performance . Thus, objects that run a set of functions can collaborate to allocate and realize different tasks . In this context, Industrial Internet of Things (IIoT) has received greater attention  since it focuses on connecting different objects with numerous capabilities within an industry, enabling thus everyone to work in a synchronized and organized manner to perform tasks.
The task allocation among IoT objects is an alternative to deal with the resource heterogeneity of objects that can perform more than one sensing activity in the network, like temperature measurement, environment monitoring, positioning among others. Industrial services as well as logistics, inventory control, and machinery synchronization can benefit from task allocation . Thus, tasks can be allocated by evaluating capabilities that each object is capable of performing within the network . However, IoT is dynamic and typically has mobile and fixed nodes, and infrastructure varies with the interactions between objects. A range of objects have limited resources, low power, low processing and storage capacity, and loss of connection links . So dealing with this variation poses challenges regarding the quality of the data generated by the objects. The poor quality of information available makes it difficult to interpret by applications. Using object groupings contributes to network organization, decreased resource consumption, and the quality with which information is disseminated. Thus, the task allocation problem is not trivial  due to the size and configurations that an IIoT network can achieve .
Addressing resource allocation issues to get good performance for running tasks among different IoT objects has been challenging 
. Factors, like resource scarcity, object heterogeneity, and environmental dynamics usually struggle the task distribution management. Resource allocation required at the devices becomes essential to the fairness of task distribution among IoT network participants, without the management of resource allocation multiple nodes will waste likely resources unnecessarily or even fail at crucial moments for role definition. A faulty distribution of tasks leads to flaws in the quality of the information generated by IoT objects, affecting services as data dissemination and consequently the applications. Besides, the efficiency of their maintenance must be ensured so that nodes can provide the quality of allocated services. Hence, conscious resource management is needed to better utilize IoT objects, making everyone work according to their characteristics and functions.
Task allocation services have been studied extensively in wireless sensor networks (WSN), which usually treats it as resource allocation. In particular, task allocation collaborate to improve the life of the network . With the rapid advancement of IoT networks, task allocation solutions have also become part of this research scope . Among works that deal with the task allocation problem, many consider it through the use of object virtualization in task groups  and distributed consensus [14, 10]. Object virtualization is used to assign tasks according to the sensing competencies that each object has and its performance capacity. The main objective is the optimization of tasks to save resources. As fair distribution of resources, distributed consensus applies based on the characteristics of each group of objects in the network. This approach is mostly applied to networks with a large number of participants. However, these solutions do not consider the similarity relationship among objects and tasks to be performed, as well as the allocation based on the characteristics of the environment in which the objects are inserted. Though, it is crucial for IoT to own mechanisms able to manage task allocation among objects through their relationships and capabilities for more robust and conscious management of available network resources.
This paper introduces a mechanism for supporting the task allocation service among objects into an IoT network, called CONTASKI (CONsensus Collaborative Based TASK Allocation for IIoT). It arranges the network into similarity-based groups to handle the division of tasks to be allocated. CONTASKI makes use of a distributed consensus strategy for decision making about the better tasks distribution for making a given service. Evaluation on NS-3 simulator has shown that CONTASKI achieves 100% of allocated tasks in certain cases with 75 and 100 nodes, and also, on average, more than 80% clusters performed tasks, keeping thus the quality of the information disseminated by IIoT object.
This paper is organized as follows: Section II discusses the related work. Section III defines the model and assumptions taken by CONSTASKI. Section IV describes the CONSTASKI components and their operation. Section V shows the evaluation methodology and the results obtained. Section VI presents conclusions and future work.
Ii Related Work
The provision of dynamic and distributed services aware of the resources and capabilities of IoT objects has been the focus of several works [3, 14, 10, 15]. The adoption of means of task allocation management enables the maximization of resource usage among network objects. However, coordinating the distribution of these resources entails challenges in their conduct, like assessing the capabilities of objects concerning tasks to be performed, organizing the network and ensuring quality of the information provided.
In , virtual objects (VO) in an IoT Smart health network implement a decentralized strategy for allocating tasks where they negotiate with each other to reach a resource allocation consensus. However, it does not evaluate the issues of objects having various capacities and types of interactions and also the influence of network size. In 
, it is proposed an evolutionary algorithm based on a heterogeneity recognition heuristic to ensure greater stability and operational periods of tasks in an IoT network. The model creates collaboration between the functions of IoT objects based on the tasks to be executed and in the selected groups. The algorithm selects objects with energy levels above the average level of the other task group members. Thus, group’s virtual objects can perform tasks and also reduce the energy consumption. But, the model assumes that few objects are capable of performing all tasks defined by the network, and only two types of tasks are performed, restraining the use of the model to networks with multiple nodes and capabilities.
In , a consensus-based heuristic approach to task allocation in IoT with the primary goal of fault tolerance makes use of the concept of task groups and objects so that in each task group, objects can be selected as virtual and vice-virtual. This model assists the best division of tasks between objects, in way that when a virtual object runs out of energy, the vice-virtual object takes on the duty of being a virtual object and the next in the list becomes the vice-virtual object of the corresponding task group. However, the model requires periodic hello message exchanges, being costly in communication, computing, storage, and power overload. In addition, the capabilities of nodes are not considered, which directly influence the distribution of tasks. In , to deal with the task allocation issue in IoT, they consider that all objects cannot interact directly with one another, and make use of gateways
services to be responsible for managing this interaction. Thus, they have transformed the task allocation problem into an integration problem with a minimal degree variant in order to narrow the problem and thus can apply a genetic algorithm to reduce the time required to allocate tasks. However, the interaction manager ultimately limits relationships between nodes, and the information centralization model can cause a communication bottleneck depending on the network size.
In , an algorithm decomposes sensor tasks into distributed tasks by taking the energy consumption for making each task and the feasibility of the solution in the assignment of tasks between the sensors. However, the model only considers a centralizing entity in the distribution of functions, not considering a leader-based network organization for task distribution between nodes. Although effective in a dynamic network such as IoT may not be viable given the standalone scenarios. In , it is proposed an algorithm that uses adaptive task mapping in sensors. It works in parallel with scheduling based on a genetic algorithm in which both work in real-time. The algorithms aim to extend network life by balancing the workload between sensors. However, by centralizing the entire distribution of tasks, they overload the transmission channel, as well as inserting a delay in the delivery of messages, which end up compromising the synchronization of tasks execution.
Iii System Model
This section presents the network, communication and task models. The IIoT network takes into account an infrastructure arranged into clusters, composed of common nodes, leader nodes, and APs. The task model comprises the task description and its life cycle. The communication model is responsible for keeping all the nodes and leaders connected.
Iii-1 Network model
An IIoT network composed by a set of objects denoted by in an area . All objects have an unique identifier to identify them in the network. The objects differentiates among themselves by their capabilities set , processing power, energy and memory. The objects are static and evenly distributed in an area of the network with coordinates .
Iii-2 Communication model
Communication among devices happens through wireless medium on a shared asynchronous channel with packet loss due to noise and object’s positioning. The system utilizes five different message types. The CapabilityDissemination messages are sent in broadcast to configure clusters. Leaders send LeaderRegister messages to Access Point (AP) to register themselves. The AP dispatches a task using TaskDispatch messages and leaders accept them using TaskAccept. Finally, leaders disseminate tasks to their cluster using LeaderToCluster messages. Further, all objects transmit in the same transmission channel in order to cluster. Moreover, the application layer can consume the sensing results using any application layer protocol, such as CoAP.
Iii-3 Task model
Each task represents a sensing demand that requires different sensing capabilities in order to be performed. A task is a set on which is the unique id of the task; denotes the set of capabilities needed to complete the task, denotes the discrete time needed to complete it and the per-cluster quorum to perform the task. Tasks are dispatched by the AP who also keeps track of their status which can be pending, dispatched or completed.
The CONTASKI architecture is comprised by two modules called: Cluster Coordination (CCM) and Task Allocation Control (TACM), as shown in Fig. 1. They act to guarantee both task dissemination and allocation among objects (nodes) of the network. The Cluster Coordination Module organizes the network in clusters and the Task Allocation Control manages the task dissemination among the network participants according to their capabilities.
The (CCM) module controls the creation and upkeep of the clusters. It evaluates the neighboring nodes using a similarity threshold of their capabilities in order to verify if they are apt to participate in the same cluster. Therefore, when it receives a CapabilityDissemination message it verifies the identification, capabilities and number of neighbors. CCM comprises three components, the component Capabilities Dissemination (CD), which is responsible for disseminating the CapabilityDissemination messages with the , capabilities and number of neighbors. The Similarity Verification (SV) component receives and interprets those messages exchanged among the nodes. Finally, Cluster Management (CM) component manages the cluster creation using the nodes’ similarity. It is also responsible for leader selection.
The (TACM) module manages and dispatches the tasks to the nodes of the IIoT network in order to maximize and preserve nodes’ resources. It comprises the components: Task Verification (TV), Role Assigner (RA), Task Dissemination (TD) and Task Operator (TO). TV oversees which tasks are to be performed and what capabilities are needed. RA monitors the tasks to be assigned to the nodes. It employs collaborative consensus to evaluate which tasks should be allocated according to each node’s capability. DT dispatches the requested tasks honoring the capabilities of the nodes. TO is responsible for receiving and execution of the tasks disseminated by the group leader. Thus, the task allocation becomes fare and balanced, and it does not overload the nodes.
Iv-a Cluster configuration
As the network size involves nodes with different capabilities, CCM arranges the network in clusters based on the leaders in order to create a network infrastructure capable of allocating tasks. Algorithm 1 describes the cluster coordination module. At first, each node sends a CapabilityDissemination message in order to announce its , capabilities (), and neighborhood size. There is a random send interval to prevent simultaneous transmissions. When receiving a CapabilityDissemination message, receiver updates its neighbors structure (), alongside with their capabilities (
). The similarity verification takes into account those structures, being calculated using cosine similarity. The neighbor can join the cluster when its similarity is within the threshold. This update procedure happens dynamically in every node, ensuring each node maintain its neighbor and cluster structure updated.
The leader selection process takes into account both the number of neighbors and individual capabilities to choose the cluster leader. After that, the selected leader registers itself with the AP to guarantee the communication between nodes and the AP and a better hierarchical network organization.
). The upper part calculates the norm of the vector that represents the intersection between the capabilities. The bottom part takes the square root of the multiplication of the norm of each capability vector.
Iv-B Task Allocation
The tasks are made available through the AP, where a list is kept with a set of tasks to be performed. The tasks are sent by messages directed to the clusters leaders. In order to identify the leaders, the AP monitors the LeaderRegister messages and keeps a leader list updated. TACM relies on a network infrastructure established by the cluster configuration, so that it runs guaranteeing resource maximization, i.e., allowing the task dissemination according to the capabilities of each cluster.
Algorithm 2 describes the task allocation control between nodes, how the entities relate to themselves in performing tasks dispatched by the AP. Initially, the AP holds a list of pending tasks (). When dispatching a task, the AP selects a pending task from the list and sends a TaskDispatch message to the cluster leaders announcing the task to be executed. After the dispatch, the AP waits until it receives the confirmation (TaskAccept messages) of which cluster leaders can perform that task. When at least one confirmation is received, the AP moves the task out of the pending task list. When the leaders receive the task , they verify if their own capabilities are compatible with the capabilities needed to perform the task, and if the number of nodes in the cluster is greater or equal the quorum needed. Case they meet the criteria, the cluster leader confirm to the AP with a TaskAccept message that it will perform the task and disseminates the task to the cluster. Case the cluster members cannot realize the task, the leader doesn’t confirm this task with the AP. As the allocation management acts in a dynamic and collaborative way, together with the cluster configuration, participants reach a better task distribution among them. Nonetheless, it is emphasized that the distributed operation within the network depends on consensual collaboration between all participants.
Fig. 2 exemplifies the cluster configuration and leader selection phase. Dashed edges indicate nodes within each other’s transmission range and thus apt to exchange control messages. Each node holds its identifier, set of capabilities and number of neighbors. Each time instant corresponds to message exchange for cluster configuration and leader selection. On instant the group of nodes (A, B, C, and D) share capability information and, then, compute the similarity according to Equation 1. Nodes compute the following similarities: , , , . The minimum similarity is and maximum . Therefore, all nodes within that interval are clustered and that cluster represents nodes with capabilities .
On instant , the leader selection happens according to the procedure in Algorithm 1. Since node B scores the highest number of neighbors, it is selected as leader. With the Cluster Coordinator operating in this manner, each node maintains its neighbors’ information updated through message exchange. The cluster structure determines which nodes in the spatial neighborhood are seen as members of the same cluster. It also eases the dissemination of tasks among nodes, because every leader represents the cluster itself.
The TACM acts considering the clusters are already configured. Once the leader is chosen, it sends a LeaderRegister message to the AP informing that it represents that region of the network. The AP has the list of tasks to be performed and that are allocated according to the application’s priority. Each task requires a minimal capability set to be performed and can run for an arbitrary time. Thus, when receiving a task, the leader verifies the cluster capabilities to make the task. In case positive, the leader sends a TaskAccept message to the AP informing that the cluster will perform the task.
Fig. 3 depicts the CONSTASKI operation in the task allocation process between AP and nodes. In the example there are two clusters and , comprised of nodes (A, B, C and D) and (E, F, G, H and I), respectively. Each cluster keeps a leader, and , responsible for directing communication with the AP and disseminating tasks among cluster members. In this way, the AP verifies its set of tasks and sends the TaskDispatch message with the task to cluster leaders. Thus, Leaders B and E will answer with the TaskAccept message, confirming that their cluster can carry out that task. But this is a partial view of the network, in the occurrence of a cluster that cannot perform that task, it is sufficient to not send the TaskAccept message. In this way, all tasks are allocated according to the node capabilities, and nodes that cannot perform that task wait for a new task round.
This section shows a performance evaluation of the CONTASKI mechanism in order to assess the gains to the management of all task. We implemented CONTASKI in NS3-simulator, version 3.29, and make all simulations taking into account an IIoT scenario similar to a manufacture industry environment. These objects may vary according to the type of industry evaluated and their type of function within the environment. The capabilities found at each object follow the sensing functions in , which consist of temperature, humidity, presence, light, machine status, pressure and reservoir level. The industrial scenario set up involved 50, 75 and 100 nodes evenly distributed in a rectangular area of 200 x 200 meters to create clusters that fit the task distribution, considering nodes with different sensing capabilities.
The system operates for 800s and over the initial 150s all nodes warm-up exchanging their capabilities through messages, followed by the similarity calculation and leader register. The AP dispatches 10 tasks from 150s to up 740s. Clusters perform each task for 60s. In addition, each task has a random capabilities set, and all tasks require at least the temperature, humidity and presence capability set. The final capability set has up to 4 other capabilities between light, synchronization, pressure and reservoir level capabilities. Nodes communicate through the IPv6 protocol over an ad-hoc IEEE 802.15.4 network. We also consider that nodes do not present communication failures and, in order to account for packet loss due to interference and bottleneck, we added a delay of 2ms for messages exchanged among nodes.
The tasks to be performed are directed to leaders through the AP, always available, located in the center of the network and equipped with a strong internet signal to reach all nodes. The similarity parameter varies from 0.65 to 1, closer to 1, higher is the similarity between two nodes. The nodes are set up with varied capabilities. We assess CONSTASKI using metrics based on : number of clusters (NC), number of allocated tasks (NAT), clusters apt to perform tasks (CPT), clusters inapt to perform tasks (CIT) and, latency of accept time (LAT)
. The results obtained in all simulations correspond to the average of 35 simulations with 95% of confidence interval. A comparative analysis with the work of was not carried out due to scenario incompatibility since they divide the network in two clusters and perform only one type of task.
Fig. 4 shows the CONTASKI performance for supporting the cluster formation. NC has a direct relation to the similarity among nodes that takes into account each capability set and the capabilities set of their neighbors. Clusters are labelled as apt and inapt and the differentiation happens on each task dispatch. Apt clusters can perform the dispatched task, otherwise, the cluster is considered “inapt”. Also, considering the static scenario and transmission range of the nodes, they form clusters with a non-deterministic number of participants. CONTASKI was able to have an average of CPT with one or at most two points of difference to NC. Fig. 5 shows the CPT and CIT in each task dispatch. Each point means a task being dispatched, dotted lines mean inapt clusters and solid lines, apt ones. All 10 tasks were dispatched and performed up to 700s. It is seen that inapt clusters is significantly higher than the apt ones. Despite that, all tasks have at least one apt cluster performing them.
Fig. 6 shows the similarity correlation between tasks and cluster leaders in the seventh round with 50 nodes. This round exhibited nodes’ capabilities similar to task’s capabilities and higher amount of leaders. Colored bars means each dispatched task. Leaders computes similarity between its capabilities and tasks’ demanded capabilities, and accept the task whose similarity equals to one. Fig. 7 (NAT) shows the amount of tasks dispatched by the AP, which is at most 10. Each task takes 60s and can be realized by more than one cluster. Clusters in a scenario with 75 and 100 nodes were able to perform over 90% of dispatched tasks. The distortion with 50 nodes is due to the small number of nodes and the random capabilities assigned to them. The randomization make it unable to guarantee that nodes have compatible capabilities in relation to the capabilities needed by the tasks. CONTASKI was able to reach a low LAT, that means the difference between the task dispatch time and the last accept time as seen by the AP. This is related to the hierarchical infrastructure based on cluster leaders. Since the capabilities of leaders are compatible with the cluster participants, the leader is responsible for evaluating if the cluster can perform the task and inform the AP about the acceptance. LAT varies according to the number of existing clusters and apt clusters for a given task e.g. with 100 nodes the achieved latency was 35ms, being smaller than one with 75 nodes, that achieved 43ms. The smallest latency was 15ms with 50 nodes.
This work presented CONTASKI for allocating tasks on devices in an IIoT network. It organizes the network into clusters based on the similarity of the capabilities of the devices and the capabilities of the neighboring devices. The mechanism applies the collaborative consensus to manage and distribute tasks between the clusters, considering the capacities they inform. These strategies manage to keep the network organized hierarchically allowing the participants to act according to their capabilities. Results show the effectiveness of CONTASKI by considering the relationship between capabilities and tasks to be performed by the devices. Also, the high number of suitable clusters ensures better use of resources, increasing the quality of the information made available by the devices. As future work, we intend to evaluate the allocation of multiple simultaneous tasks between nodes, different contexts of IoT networks with different types of mobility.
Acknowledgments - The authors would like to thank RNP HealthSense Project (Grant no. 99/2017 in Brazil).
-  J. Gubbi, R. Buyya, S. Marusic, and M. Palaniswami, “Internet of things (iot): A vision, architectural elements, and future directions,” Future generation computer systems, vol. 29, no. 7, pp. 1645–1660, 2013.
-  A. Botta, W. De Donato, V. Persico, and A. Pescapé, “Integration of cloud computing and internet of things: a survey,” Future generation computer systems, vol. 56, pp. 684–700, 2016.
-  E. A. Khalil, S. Ozdemir, and A. A. Bara’a, “A new task allocation protocol for extending stability and operational periods in internet of things,” IEEE Internet of Things Journal, 2019.
-  Z. Ghanbari, N. J. Navimipour, M. Hosseinzadeh, and A. Darwesh, “Resource allocation mechanisms and approaches on the internet of things,” Cluster Computing, pp. 1–30, 2019.
-  L. D. Xu, E. L. Xu, and L. Li, “Industry 4.0: state of the art and future trends,” International Journal of Production Research, vol. 56, no. 8, pp. 2941–2962, 2018.
-  R. Y. Zhong, X. Xu, E. Klotz, and S. T. Newman, “Intelligent manufacturing in the context of industry 4.0: a review,” Engineering, vol. 3, no. 5, pp. 616–630, 2017.
-  G. A. Korsah, A. Stentz, and M. B. Dias, “A comprehensive taxonomy for multi-robot task allocation,” The International Journal of Robotics Research, vol. 32, no. 12, pp. 1495–1512, 2013.
-  T. Qiu, N. Chen, K. Li, M. Atiquzzaman, and W. Zhao, “How can heterogeneous internet of things build our future: A survey,” IEEE Commun. Surv. Tutor, vol. 20, no. 3, pp. 2011–2027, 2018.
-  F. Gielow, G. Jakllari, M. Nogueira, and A. Santos, “Data similarity aware dynamic node clustering in wireless sensor networks,” Ad Hoc Networks, vol. 24, pp. 29–45, 2015.
-  G. Colistra, V. Pilloni, and L. Atzori, “Task allocation in group of nodes in the iot: A consensus approach,” in 2014 IEEE International Conference on Communications (ICC). IEEE, 2014, pp. 3848–3853.
-  A. L. Santos, C. A. Cervantes, M. Nogueira, and B. Kantarci, “Clustering and reliability-driven mitigation of routing attacks in massive iot systems,” JISA, vol. 10, no. 1, p. 18, 2019.
M. Aazam, M. St-Hilaire, C.-H. Lung, I. Lambadaris, and E.-N. Huh, “Iot resource estimation challenges and modeling in fog,” inFog Computing in the Internet of Things. Springer, 2018, pp. 17–31.
-  W. Fang, Q. Zhang, M. Liu, Q. Liu, and P. Xia, “Earning maximization with quality of charging service guarantee for iot devices,” IEEE Internet of Things Journal, vol. 6, no. 1, pp. 1114–1124, 2018.
-  V. Pilloni and L. Atzori, “Consensus-based resource allocation among objects in the internet of things,” Annals of Telecommunications, vol. 72, no. 7-8, pp. 415–429, 2017.
-  ——, “Deployment of distributed applications in wireless sensor networks,” Sensors, vol. 11, no. 8, pp. 7395–7419, 2011.
-  M. Kim and I.-Y. Ko, “An efficient resource allocation approach based on a genetic algorithm for composite services in iot environments,” in 2015 IEEE ICWS. IEEE, 2015, pp. 543–550.
-  Y. Jin, J. Jin, A. Gluhak, K. Moessner, and M. Palaniswami, “An intelligent task allocation scheme for multihop wireless networks,” IEEE TPDS, vol. 23, no. 3, pp. 444–451, 2011.
-  I.-R. Chen, J. Guo, and F. Bao, “Trust Management for SOA-Based IoT and Its Application to Service Composition,” IEEE TSC, vol. 9, no. 3, pp. 482–495, 2016.
-  L. D. Xu and L. Duan, “Big data for cyber physical systems in industry 4.0: a survey,” Enterprise Information Systems, vol. 13, no. 2, pp. 148–169, 2019.