Comparative Study on Ant Colony Optimization ( ACO ) and K-Means Clustering Approaches for Jobs Scheduling and Energy Optimization Model in Internet of Things ( IoT )

T latest IoT applications depend on promotion of wireless sensor networks (WSNs) with expert of engineering. These IoT applications contain a large number of devices, connected with different requirements and technologies. Such kinds of IoT applications do the sensing and collection of data with transmission of data to the administrator nodes for other possible operations and even a cloud at the backdrop for data analytics. These processes require routing protocols for their completion. Routing protocols have two major challenges. The first challenge is to improve data transmission and scalability whereas the second challenge is to minimize energy consumption. In an IoT application, network nodes under different network topology collect different kind of data so that an IoT application produces an enormous amount of data. The heterogeneity in network topology restricts the TCP/IP to become the best policy for proper resource allocation to computing and routing [1]-[3], [27]-[29]. Owing to the above-mentioned challenges, different persons view IoT in different ways, based on their perception and requirements. A routing protocol includes the multiple job scheduling methodologies. These job scheduling methodologies are reported as either heuristic or metaheuristic-based approaches. Heuristic-based methodologies are comparatively more helpful when we look for a local optimum whereas metaheuristic methodologies further try to explore the solution DOI: 10.9781/ijimai.2020.01.003

space to attain global optima. Despite the fact that the metaheuristic methodologies look very engaging and a large number of parameters to be turned on account of IoT thus limits the utilization [4]- [9], [27]- [29].
A number of researchers have developed and used the ACO algorithms for finding the shortest path in several routing problems. An ACO algorithm includes a stochastic local search strategy to structure the routing paths which can be established by a set of artificial ants. These ants work cooperatively using indirect communication of information for construction of the optimal shortest path. Inan intelligent optimization algorithm, the ACO idea is borrowed from the food searching characteristic of the real ant colony and how ants do this difficult job when they work together. Depending on biological studies on ants, it can be assumed that the ACO performs the finding of the shortest path from the nest to the food. Ant's pheromone distribution mechanism to share information with other ants in indirect coordination is called stigmergy. A number of researchers have suggested that the ACO optimization algorithm is very good for collaborating, exchange and transmission of information. The ACO algorithm is based on pheromone updates. This pheromone updating depends on the best solution achieved by the pheromone amount and the number of ants. The natural ants find the shortest path based on their own best knowledge solution and it depends on a strong pheromone trace. Finding the shortest path using ACO algorithm is inversely proportional to the pheromone quantity and length of the path [10]- [12].
The ACO depends on a probabilistic method for solving the computational problems and minimizes the paths through graphs [13]. ACO algorithm can be given in detail as: Clustering is used in a wide range of research areas like engineering, medicine, data mining, biology, artificial intelligence and even IoT. Xu and Wunsch (2005) have represented an abbreviated survey on clustering algorithms. K-means clustering is the most commonly used algorithm. K-means clustering algorithm divides the data/substances into a number of clusters based on minimizing the sum of the squared distances between the data/substances and the centroid of the clusters. The k-means clustering algorithm is one of the simplest algorithms, but it is not suitable for a large amount of data set due to higher time complexity. Various methods have been proposed to accelerate the working of k-means such as when computation complexity is increased the backtracking is required [4], [12].
In recent years, many new clustering algorithms have been proposed after deep study on clustering. There is a clustering algorithm which is based on ant system. A combination of two or three different clustering algorithms is new to clustering analysis. Clustering analysis plays an important role in the datamining field. Data can be grouped into different classes or clusters by clustering analysis. There exists better similarity among the objects in the same class and poorer similarity among the objects in different classes. In machine learning, clustering is a kind of unsupervised learning because it has no prior knowledge of classification labels. Clustering analysis is widely applied in image processing, model recognition, document retrieval, medical diagnosis, web analysis etc. [4], [14].
A. The Basic Principle of the K-means Algorithm K objects are randomly chosen from n objects as initial clustering centers. Then the algorithm calculates the distance from each object to k clustering centers and judges which clustering center is nearest, assigning the object to the cluster of the nearest center. When all the computation work is done, it will form knew clusters. Next, the algorithm re-computes a mean value of each new cluster as its new clustering center. According to the above procedure, the algorithm will repeat calculating the distance and iterating till criterion function converges. The sum of square error is often-used as the criterion function. It is defined as [4], [14]: (1) E is the sum of square error to all objects in the database. p is a point in the space that expresses a given object. m i is the mean of clustering C i . According to this criterion, data belonging to the same class are as similar as possible and data from different classes are as different as possible [4], [14].
The article is divided into six sections. After a brief introduction about ACO and k-means clustering in section I, section II contains the related work. In section III we explain our problem definition, in section IV we show our proposed algorithm, and finally, section VI explains the discussion and conclusions.

II. Related Work
The IoT environment contains a large scale of different types of networks. Routing techniques in WSN from source to destination is one of the important issues in the IoT system. The algorithms which are used to select the cluster heads/nodes depend on specific characteristics of clusters and/or network environments like energy level that suffers from complexity. Hence, the architectures of IoT are unsuitable and features of IoT application are dynamic. A large number of different kinds of research work on routing in IoT from source to destination have been done in literature [1], [4], [26].
Omar Sajid [1] has proposed optimum routing path using Ant Colony Optimization (ACO) algorithms inside the IoT system. Depending on the types of network, Sajid [1] has suggested to divide the IoT environment into various zones like status, requirements, etc. then use the ACO algorithm that was fit for each network. Finally, the simulation results proved that the proposed routing algorithm has better energy saving techniques. Kumar et al. [4] has presented a comparison of some clustering algorithms to analyze the scheduler performance and suggested that K-means based clustering is effective for the IoT based environment. Lu et al. [10] has suggested that the ACO finds the path to broadcast signaling contained in various network nodes and various flexible network structure problems, and during simulation analysis it is noticed that finding the path by ACO in IoT decreases the transmission storm efficiently. When the number of nodes increases in the finding path process, then it is important to reduce the time of path structure. In order to analyze a large-scale routing strategy, Guang Ji [15] has proposed IoT ant colony searching routing based on Markov decision model. Markov decision ant colony routing selection algorithm is based on multi-parameter equilibrium. Markov routing is a decision model to estimate the number of nodes in a node communication range and facilitates the decision which meets the requirements. This algorithm efficiently decreases the overhead workload which is generated by controlled messages and multiple hops routing between clusters and make the evaluation function value of the path for allowing decision set corresponding to the pheromone concentration of ant colony for repeating the process. During the routing discovery phase, it calculates the transition probability of nodes and selects the global optimal routing. During the simulation-based analysis, it is observed that the problem of network "hot spots" is effectively solved by the Markov-A algorithm and the energy consumption of the network is balanced so that the life cycle of the network is prolonged. Dorigo et. al. [16] has specified an explanation of the Ant Colony Optimization (ACO) meta-heuristic and has discussed the type of problems where it can be applied. Dorigo et. al. [16] has used ACO algorithms in two typical applications, namely traveling salesman problem and routing in packet-switched networks. Merkle et. al. [17] has introduced an ACO method for the resourceconstrained project scheduling problem (RCPSP). It is a combination of direct (or local) and indirect (or global) for ants in the structure of a new solution and uses pheromone evaluation approaches. From newly added features, this algorithm changes the strength of the heuristic effect and the rate of pheromone vaporization over ant peers. Below some limitation author's proposed algorithm perform the best solution compared to some other heuristics with and without limitations to the number of evaluated schedules shows the flexibility of the method. Michael Frey et al. [18] have proposed a framework and methodology to study ant routing algorithms for wireless networks. While running experiments in a wireless test bed is a number of some, expensive and error-free task, studying ant routing algorithms in simulation allows investigating some specifics properties of these algorithms more easily. This includes behavior of all aspects such as adaptive and pheromone evolution, the scalability in respect to the number of nodes or traffic flows, and mobile scenarios. These frameworks are easy to extend and customize by providing new back ends for different network simulators (or test bed frameworks) which is feasible with acceptable efforts. Mariusz et al. [19] have proposed Ant Colony Optimization (ACO) based algorithm designed to find the shortest path in a graph. The algorithm consists of several sub problems that are presented successively. Each sub problem is discussed from many points of view to enable researchers to find the most suitable solutions for the problems. Algorithms based on the metaheuristic of ant colony do not guarantee finding an optimal solution in all possible cases. Accordingly, to experimentation, it is particularly important to find out and select parameters dedicated to each of the problems under consideration. Individual elements of the procedures applied in the process should be also analyzed with regarding to their usability and purpose fullness of application. The construction of this Shortest Path ACO algorithm directly reflects to the various variants of the execution of individual elements of the procedure. In this way, it is possible to improve the method for the solution of the shortest path problem to approach or reach optimal solutions. An evaluation of the duration time and the quality of returned solutions will provide information for making a decision on the implementation of a given scheme as being of optimum quality or an alternative to more time-consuming procedures or procedures with higher computational cost. Yuq in get. al. [20] has recommended a new K-Means algorithm. This algorithm is a combination of density-based and ant searching theory, which is controlled by the initial parameter of k-means and local minimal by the random ants. The experiments analysis shows that, this algorithm has better quality for productivity and accuracy of clusters. Thus, it can place the similar types of objects together in one cluster and eliminate the dissimilar types of objects away. This procedure has random competence of ACO which avoid clustering success into local optimality, and it furthermore avoids responsiveness of the primary partition of the k-means algorithm. Gelenbe et al. [25] has proposed the relationship and effect between choice of system load, energy consumption and QoS using a simple queuing model. They [25] have analyzed the parameters which are effect of response time of the system and energy cost per job using the mathematical queuing model. S. Kumar et Al. [30], [31] and V. García-Díaz et Al. [32] have proposed the Supply Chain Management based model for optimizing the response time and job scheduling by applying M/M/1 queuing model in IoT environment.

III. The Problem Definition
This section contains the problem statement followed by a description of the ACO and K-Means clustering based IoT messaging service architecture considered in the work and the job model.

A. Problem Statement
In an IoT environment, a big amount of heterogeneous wired and wireless devices/objects interconnect with each other identified by IPv6 addressing using single or multiple levels of subnets. These devices/objects generate a big amount of data (much time a continuous stream too) and scheduling these in the IoT environment from source to destination becomes a challenging issue.
IoT is a mixture of multiple wired or wireless communication technologies. The routing is the most important challenge in the IoT environment for solving how to find the best optimal path for data transmission from one node to another node in a different environment. An IoT environment includes different types of networks which depend on the network's status, and requirements. In this article, it is proposed that each network has own responsibility for finding an optimal path in the IoT environment. There are many inter-connections between different networks and the seinter-connections are called overlapped areas. So, this work intends creating an algorithm to control the use of algorithms and determines a solution for overlapped areas problem. This algorithm has been tested and compared with ACO and K-Means clustering algorithms that are closely related to the IoT routing problem.
The prime objective of this work is to calculate and compare the response time for message forwarding of the entire IoT environment using ACO and k-means clustering algorithms approaches to find the suitable path for reducing the energy consumption/cost. In the big transportation for IoT background, this is very beneficial for providing the flexible and effective response time services. The number of clusters is one of the most important features for calculating the performance of K-means clustering algorithm and the number of paths is one of the most important features for calculating the performance of ACO algorithm. The nodes (for ACO algorithm) and Cluster Head (CH) (for K-means clustering algorithm) may be completely connected or partially connected. The processing speed of each CH/Node can be measured as MIPS (Million Instruction Per Cycle) count [4], [21], [26].

B. Job Model
Each job or message is divided into sub-jobs/tasks depending on the priority of jobs and sequence of data messages. Data are available in the format of data packets and need the transmission from source to destination. The jobs are mathematically modeled by a weighted graph D= (T, E) where T shows the set of t tasks and E shows as the set of e edges among the jobs. The edges show the priority of task/message [4], [26].

C. A Route Planning Model for K-Means Clustering and ACO Algorithms
The performance measurement for both K-Means clustering algorithms and ACO algorithms is done in terms of the average response time. It is assumed that each server follows the M/M/1 queuing model where λ is the arrival rate and μ is the service rate [4], [22], [26].
The set of objects in different colors represents them belonging to different clusters and paths. A sample shortest path is shown between source to destination base station based on a hypothetical approach.
QoS parameters like Average Response Time (RT), Average Waiting Time (WT), and Average Queue Length (QL) have been estimated. Here, it is assumed that each server follows the M/M/1 queuing model. The average queue length at the i th CH/Node with both the number of jobs waiting in the queue and those in service can be written as E [Ni] = Where ρ i is the i th server utilization and whose average queue length is E [Ni] [4], [23]- [24], [26].
The average response time depends on how to quick response a CH/Node. Arrival rate of the jobs at the input queue at each CH/Node is randomly generated. The average response time can be estimated as [4], [23]- [24], [26]: The waiting time is the period of time where the job does not execute because of the execution preference or some event to happen. So, the average waiting time at each CH/Node in the path can be calculated as [4], [23]- [24], [26]: (3)  Let us assume that there are n nodes in a network and m nodes transmitting the signal for searching at the same time in network routing. ι ij (t) is the number of active signaling established through the path among node i and j, d ij (i, j = 1, 2,...,n)stands for the distance among the node i and j at the time t.
In the initiation stage, m random nodes are selected, the number of active signaling among the nodes i and j are ι ij (0) and ι (tabu) is the primary part of individual signaling. k is allocated as a preliminary node.
Here, stands for the probability of k transmitting signal from node i to node j at the time of t, then: The permitted k= {0, 1... ,n -1}, and ι st and for the set of nodes and indicating next permitted node to pass. The difference between an artificial ant and real ant colony is the capability of memory. The ι (k = 1, 2,...,m) is utilizing the records of nodes and signaling k pass over at the current time, and it is dynamically adjusted with the transmission of signaling k process. 1-ρrepresentstheunit of disappearing andα, βindividually represent the amount of information collection of signaling in the process of re-transmission. It plays different roles for the heuristic aspect in the path selection through the signaling retransmission. η ij (t) represents the predictions unit of the transmission between node i to j. Then signaling k cover all nodes and make a complete cycle. At that time, the information of all paths is updated according to the following equation: Then (6) represents the amount of information of signaling k's suggestions between node i and j in this cycle.

(7)
Here, Q represents the constant, L k represents the path length that signaling k has paced in this cycle.
In order to estimate the shortest path using ACO from a source node (S) to a destination (E) it is assume that λ 1 isthe arrival rate of the job at Node 1 , working as a source node (S) for transmission to the destination (E)Node 5 . Node 1 has nodes Node 2 , Node 3, and Node 4 as immediate neighbors. Let the probability of arrival of jobs at queues of these neighbors be P 2 , P 3, and P 4 respectively such that P 2 +P 3 +P 4 =1. In this article it is assumed that there are equal probabilities for selection of all the paths i.e. P 2 =P 3 =P 4 . After being serviced by server Node 1 , the jobs arrive at Node 2 being the best path among the available paths offering the minimum response time with probability P 3 . Let this probability be referred to as P 1 for the remaining path, indicating the path chosen in the beginning. Therefore, the arrival rate for Node 3 can be written as λ 1 P 3 = λ 1 P 1 . Similarly, after being serviced by server Node 3 , the jobs arrive at Node 4 followed by Node 3 to finally reach Node 5 with arrival rate λ 1 P 1 .
Therefore, the utilization of Node 1 with P 1 =1 becomes The utilization of the selected nodes can be written as [4], [23]- [24], [26] (9) Where i = Number of stages in the network and j = Index of the selected node in each stage.
The average queue length for Node 1 becomes (10) Similarly, the average queue length can be calculated for the other selected nodes in the path as [4], [23]- [24], [26] (11) The queue length for the entire path can be estimated as:

E [QL avg ] = Sum of Average Queue Length (QL) value of selected nodes in every stage.
Therefore, (12) Here 'i' is the stage and Node j is the node being selected for message forwarding.

Average Response Time =
(from equation (2)) In the current case, the path from Node 1 (source) to Node 5 (destination) comprises of Node 2 , Node 3, and Node 4 . The average response time of for Node 1 : (13) For Node j server the response time can be written as:  Similarly, for Node j server the waiting time can be written as: In order to use the K-Means clustering algorithms, a sample path chosen among the clusters to route the messages from Source (S) to Destination (E) has been presented and routing paths as per the K-Means clustering algorithmic characteristic and some properties like Euclidean distance and Degree of nodes to find the shortest path from Source (S) to Destination (E).
Here it is assumed that P is the probability of arrival of the jobs at the source queue to be forwarded to the destination in K-Means clustering through Cluster Head (CH). Let the arrival rate of the jobs at CH 1 beλ 1 which is the Start CH 'S' in the IoT network. The packet needs to be transmitted to the end cluster 'E' which is CH 5 which can be the preferred endpoint like cloud storage. After being serviced by CH 1 , let the message be forwarded to CH 2 . As discussed above, the arrival rate for CH 2 becomes λ 2 P= λ 1 P. Similarly, the message reaches destination CH 5 with arrival rate λ 1 P, being routed through various cluster heads CH forming the path. The best and stable utilization of CH 1 server is [4], [22], [26] ( 19) Similarly, for CHj server, the utilization can be written as (20) where i = Number of stages in the network and j = Index of selected node in each stage.
The average queue length for CH 1 [4], [22], [26]: (21) Similarly, the average queue length can be calculated for the other selected CH j in the path as [4], [23]- [24], [26]: (22) The queue length for the entire path can be estimated as: Where 'i' is the cluster and CH j is the node being selected for message forwarding.

(24)
Similarly, average response time can be calculated for the other selected CH j in the path as [4], [23]- [24]: (25) The average response time for the paths selected become the sum of the Average Response Time (RT) values of selected CH j in every stage 'i'.
Similarly, for CH j server the waiting time can be written as: The average waiting time for the complete path can be written as the sum of the average Waiting Time (WT) values of selected CH in every stage as: (29) IV. The Algorithm The primary objective of this algorithm is to calculate and compare the message response time from source to destination by preserving the service quality of fluctuating sized messages from the source to the destination through CHs/Nodes in the network. The word Cluster Head (CH) for K-Means clustering algorithms and the word Node for ACO Algorithms are used. When a sensor device sends a message from the source CH/Node to the destination CH/Nodes, it fritters away some communication cost in the transfer of the message. In this procedure, it waits for the response of each CH/Node in each IoT network environment. This is a big problem for IoT because it may affect the battery life of the sensor CH/Node as the battery life gets weak with every waiting period. However, if this response time was reduced by proper path choice, it would decrease the waiting time and eventually preserve the power of the sensor's devices. Thus, this method decreases the response time and makes it an energy-aware scheduling algorithm too.
These messages convey data with respect to the physical parameters which change continuously in some degree. Algorithm 1 corresponds to the message-scheduling algorithm for the IoT framework.

V. Performance Evaluation
To evaluate the performance of QoS parameters, Matlab64-bit version 8. 5.0.197613 (R2013a), processor Intel (R) Core (TM) i7-4790 CPU @ 360GHz, 64-bit Operating System, and RAM 4 GB as a simulation platform has been used. M/M/1 priority queuing model has been used for resource provisioning and message scheduling system within the IoT environment. Applied M/M/1 queuing model can be reconsidered for some newer models like phase-type queuing networks or Pareto-distribution-based queuing networks. The basis of considering the M/M/1 queuing model is that it considers each node/ CH as a single node and has been established to fit well in these types of problems. Random data values have been generated for the experiment during execution.  Table I. Further, ACO Response time result is a minimum and better than the K-means Clustering Algorithm response time.   The effect of some other QoS parameters such as the Average Service Rate, Average Queue Length and Average Waiting Time are shown in Fig. 4-6.In this experimental setup, we fixed the job size of 1000 while varying the number of CHs (For K-means) and Node (For ACO)from 10 to 50. The numeric data is represented in Table II- Fig.7 represents the effect of both ACO and K-means clustering algorithm Response time when we vary the job size from 200 to 1000 for a fixed number of Nodes (For ACO) and CHs (For K-means) that is 10, with the numeric data represented in Table V. We observed that the response time of ACO is again better than the K-means Clustering Algorithm.

VI. Conclusion
IoT is poised to change the way of living. With huge heterogeneity and dynamicity in IoT, the response time should be ensured to be as low as possible for better network performance leading to an efficient and smart IoT. The response time has effect on the use of energy cost per job for the system [25]. The optimization of the response time for transmission of data/jobs in the entire system of IoT environment automatically optimizes the cost/use of energy. This work contains a comparative analysis between ACO and K-means algorithms based on a job/message scheduling model for IoT, based on an N layered network. Performance measures such as the average queue length, average waiting time and average response time have been derived, plotted and analyzed. It is noticed that the ACO offers better performance for the considered parameters. The model gains significance due to the fact that efficient message forwarding in IoT will ensure the optimum use of sensor energy to realize a truly smart framework.