Cluster Head Selection and Routing Protocol for Wireless Sensor Networks (WSNs) Based on Software-Defined Network (SDN) Via Game of Theory

There is a way to prolong the life of sensor networks according to which a hierarchical routing algorithm is used intelligently, which employs all network elements in data transmission. Clustering the nodes is one of the best methods that can significantly increase the network life. Making a cluster, selecting a Cluster Head (CH) and data transmission in Wireless Sensor Network (WSN) are the issues that affect energy consumption. Software-Defined Networks (SDN) are a modern network architecture that distinguishes the network control panel from the data plate also this architecture cause the network utilizing is increased, and the operational cost is reduced. This method also causes creativity and perfection in the network area. Moreover, the possibility of implementing management protocols, including traffic management, which is an inevitable part of networks, can be implemented in SDN with a higher level of flexibility. In this paper, the CH has selected trough game theory, which sends data with the help of game theory rewards and calculating the geographical location of other nodes. Then, high-priority data is sent according to the proposed algorithm with the help of game theory. The simulation results in NS3 software show that the proposed method has obtained acceptable results compared with Artificial Bee Colony algorithm (ABC), Genetic Algorithm (GA), Cuckoo Search algorithm (CS), Firefly algorithm (FA) and Grey Wolf Optimization Algorithm (GWO).


Introduction
The Software Defined Network (SDN) is an emerging network architecture that allows overcoming network infrastructure in current limitations [1]. This means that an intelligent controller configures transmission elements with sending rules for different packets. SDN is the next transformation in computer networks [2]. When a packet reaches a switch in SDN, a software in the switch decides where the packet should be sent [3]. SDN are a centralized program for implementing the network and monitors the network behavior [4]. The main purpose is to separate the control panel from the data plate. This separation can be done by the Application Programming Interface (API) between the In the WSN, transmits data between the base station and nodes is called routing [16]. On the one hand, routing can be considered as a method of data transfer between the nodes. On the other hand, data transfer between nodes and the sink can be defined as routing [17], which are arranged to cover a large geographical area, however in the most of the time wireless sensors are mobile and move away from the base station [18]. This method of data transmission leads to saving energy and a significant increase in telecommunication between nodes and base station [19]. In the network's hierarchical structure, each node has a leader called the CH and CH usually performs specific tasks [20]. In addition, there are a number of common nodes in each cluster as members of that cluster [21]. The clustering process creates a two-level hierarchy, the upper level of which is made up of CH nodes and the lower level of which consists of normal nodes. CH nodes collect data and send it to the base station [18]. Sending to the base station can be done directly or in the form of connection with other CHs [22].
In this paper, the management of nodes and CH is considered with the SDN. This controller is located between the sink and the CH, which manages the network. In this article, first CH is selected by game theory. If a CH selected in the first round, a reward is considered, then check the normal nodes have been connected with CH or not. CH duty is a heavy task in the network [23], it must be able to send all the data to the controller and have the high throughput and energy. Then, the game's score begins to be calculated; if the score has a high rate, the CH node is definitely selected as the CH. In this article, after discovering the CH, the controller commands the other nodes to route and send their own data to CH. In this method, game theory is used only in high priority data, which is done by the First in First out (FIFO) priority queue. Low priority data is done by estimating node factors with the received power signal.
Finally, routing takes place. The main features of this paper are as follows: Achieving the best CH for WSN in the area based on game theory criteria.
Selecting the efficient CH based on game theory for WSN. Increasing the network lifetime, throughput, and delivery rate using game theory.
Fast routing for high priority data with the help of game theory.
The rest of the research is as follows: Section 2 presents related work. Section 3 provides the proposed algorithm. Section 4 shows the experimental and simulation results. Finally, section 5 presents future discussions and studies.

Related Works
Numerous types of research about CH selection and routing protocol in WSN have been performed. This part refers to certain papers investigating the CH selection and routing to feature their fundamental points of interest and impediments. In addition, according to the importance of CH selection and routing efficiency, the QoS factors have been considered in analyzing the previous techniques. These two aspects are discussed in the following. There are several different classifications of clustering algorithms based on the characteristics and utility of the sensors within the clusters. As a consequence, it could be defined using cluster head determination, calculation complexity, or cluster arrangement criteria figure 1 shows the CH selection classification. The WSN routing protocols are classified dependent on their method of service, network configuration, and sensor node participation types. Protocols for mode of operation may be constructive, reactive, or hybrid. The protocols in participation mode could be flat, direct, or clustering dependent. Protocols may be data-centric, locationdependent, hierarchical, or QoS (Quality of Service) based in network structure mode. Figure 2 shows the classification of routing protocol in WSN. Deepa and Latha [24] introduced a routing algorithm called Hybrid Hierarchical Secure Routing Protocol (HHSRP). The proposed algorithm is an improved approach by adding the CH in the network and calculating packet transmission efficiency based on packet priority. Therefore, the package can be quickly and easily delivered to the destination. The proposed approach can transmit the packet to the destination without losing the packet to any malicious node and inactive node activity. Identifying packet priority and transmitting packet to the destination is done by generating route, that is directly related to the shortest route and the head-coordinating node. The assessment outcomes indicated that the mentioned method could increase reliability and average number of packets received. Nevertheless, the mentioned technique has low load balancing and low mobility.
Sharma, et al. [25] provided a routing algorithm for WSNs. The algorithm includes clustering in WSN called Efficient Routing Algorithm (ERA) routing steps. The propose method, a novel routing scheme that provides increased throughput with managed delays while remaining power conscious. ERA is an adaptive routing algorithm that prevents congestion and helps to reduce network hotspots. They have shown that there is no need to exchange control messages to select the CH. They have also developed an efficient strategy for organizing all nodes for different levels to build a conducted virtual column to facilitate data routing to the sink. They also devised a simple method for ensuring that all nodes participate in the data routing process. Their energy is measured at the same time based on their residual energy. Each sensor appear that the proposed protocol has message complexity and time complexity for WSNs. This method has a good performance in throughput and energy consumption. However, it has limited functionality in reliability and service monitoring.
Deebak and Al-Turjman [26] provided a routing and energy-efficient routing protocol in WSN to reduce node temperature as well as reduce critical data delay using polymorphic (not uniform) sensor nodes and called the Authentication and Encryption Model (ATE). Base stations in the network architecture of this project is in the center, but the nodes with high data rates are located in places with less mobility. In query-based or critical data packets, sensor nodes increase their transmission power to send data packets directly to base station (single step), while multi-step communication uses normal data packets. Sensors with normal data packets cannot send query-based or critical data packets until the well has not received them. In multi-step communication, a path with a smaller number of steps is selected when there are two or more paths. If two or more stepping nodes have the same number, then the neighbor node is selected with the lowest energy consumption. It defines a threshold to control the rise in temperature, and if the temperature of the node exceeds the desired threshold, it eliminates all paths along with the neighboring node. If the temperature of the node reaches the threshold after receiving the data packet, it sends the packet back to the previous node and the previous node would be assigned as a hotspot. This algorithm has a good performance in detection rato, but they did not pay attention to the reliability and energy consumpation.
Chze and Leong [27] provided a Secure Multi-Hop Routing Protocol (SMRP) for communications over WSNs. The applied technique in this solution is to authenticate users based on a multi-layered security architecture. In this system, nodes must be authenticated before connecting to the network. A multilayer parameter is used in the routing algorithm, which means that users must be authenticated to use the route. This algorithm is capable of resisting attacks such as Greyhole, Black hole, Sink hole, and spoofing. However, one of the problems is the inefficiency of the routing algorithm in controlling large networks. Therefore, the security architecture of this system has a good efficiency while the provided routing algorithm is not suitable to be used in the Internet of Things systems. In this paper, the authors found a high security architecture low delay and high bandwidth. However, this algorithm does not pay attention to the energy consumption and large networks.
Guleria and Verma [28] proposed protocol achieves optimal clustering using a weighing function for CH selection. Cluster formation is based on a number of factors such, including node remaining energy, Received Signal Strength Indicator (RSSI) and node density. Priority weights are also allocated to these metrics. For each round, the CH with the highest likelihood will be chosen as the best CH. The aim of this article is to propose an energy-efficient Load Balanced Cluster-Based Routing Protocol based on Ant Colony Optimization (LB-CR-ACO), which will increase the lifespan of WSN networks. Simulation results shows that the method decrease energy consumption and increase the network lifetime. Nevertheless, the proposed method does not have high throughput.
Altakhayneh, et al. [29] proposed Genetic Low Energy Adaptive Clustering (G-LEACH) for solving the CH selection and routing in WSN. The reason of this paper is to simulate the utilize of different routing methods in modern wireless communication, especially in WSN communication. The second is G-LEACH, which is a more advanced version of LEACH techniques that makes use of genetic algorithm. In this comparative simulation, both the LEACH and G-LEACH algorithms try to find the best CH in order to increase packet delivery to the CH, cluster life time, and network life time. However, this algorithm suffers from throughput and low load balancing.
PSO-ECHSrk is an energy-efficient cluster head selection algorithm proposed by Rao, et al. [30]. It is based on particle swarm optimization (PSO). The algorithm is built around an effective particle encoding and fitness function scheme. CH selection and cluster formation are the two steps of the algorithm. PSO is used to choose the CH, also the residual energy, distance parameters are used in the CH selection algorithm. All sensor nodes send their location and residual energy to the base station during the CH selection phase to see if they satisfy the threshold energy to be considered for a CH. In this paper, the authors found a good efficiency in energy consumption. However, this method has limited functionality in low reliability and low scalability.
Baskaran and Sadagopan [31] proposed hybrid firefly algorithm. Using crossover and mutation in the suggested algorithm, the best fireflies chosen through tournament selection are allowed to replicate among themselves. The proposed method allows for faster convergence while also avoiding multiple local optima. The suggested algorithm has a high efficiency in terms of packet loss rate and network lifetime, according to simulation results. However, author does not pay attention the delay and rate of monitors.
Karaboga, et al. [32] using an Artificial Bee Colony (ABC) algorithm, and present a new energy-efficient clustering mechanism. The cluster heads are determined using ABC algorithm, where each solution represents an array of objects, which contains a sensor node. The ABC uses a population of bees to locate cluster-heads in the search space. CH selection fitness is expressed as a fitness value that is inversely proportional to the amount of energy consumed during a tour. The simulation results show that the ABC routing protocol can successfully optimize network lifetime and reduce transfer delays. However, this method suffer from low packet delivery rate and the node makes independence decisions without any centralized control. In table, 1 shows the advantage and disadvantage of the algorithms.

Statement of the Problem
The challenge of energy constraints in WSNs can be significantly overcome using clustering methods. Scalability is one of the most crucial aspects of WSNs. Scalability and extending the life of WSNs can be achieved by clustering. In this method, the CH can be replaced or removed, the controller is responsible for network management. The controller is the connection between the CH and the base station. The following are the advantages of clustering in WSNs, and Figure 3 shows the clustering: Reduction of the routing table size: Routing in each cluster is done locally by clustering. This reduces the size of the routing table.
Savings in the consumed bandwidth: Extracommunication is reduced by clustering and ultimately saves communication bandwidth. The method that transfer the data between the sensor and where the base station is observed called routing. On the one hand, routing can be considered as a method of data transfer between sensor nodes and on the other hand, information transfer between sensor nodes within the network and the final base station can be defined as routing [33]. A very simple method to do this task is that each sensor send data directly to the base station. Nevertheless, direct-sending to base station is very costly because the nodes are may far from the base station and it cause evacuated early, which this method has limits the life of the network [34]. This issue is important especially when sensors are arranged to cover a large geographic area, or where the sensors are moving and may move away from the base station: Wireless sensor network in fixed SDN-WSN SDN controller is as a gateway in the centralized SDN-WSN network that manages all sensors, including sensor behaviors, sleep nodes, routing path, and data transmission [36]. The topology of the SDN-WSN network can be both fixed and mobile. The controller uses a middleware to control information, tables, thresholds, mapping performance, and information. The SDN controller, which manages all nodes and the network management unit is located in the base station. A controller that monitors the whole network consists of the control layer. The application layer of SDN-WSN includes various applications such as routing. Figure 5 indicates the performance of a SDN-WSN as well as the advantages of centralized mode: The SDN controller is suitable for small networks, which have a duty to manage all of the sensors.
The load balancing mechanism is used to store the energy of the nodes.
The network is more balanced, and the area's nodes are managed by the regional controller.
The CH is responsible for data transfer in the network, and it sends data to the sink via the main controller. The whole network nodes are divided into areas according to the distributed SDWSN model. There is a CH in each area that is the main controller located at the gateway. The controllers manage and synchronize the sensors and CH. Figure 6 shows the performance. There are 2 types of topologies in this type of network, CH node and normal nodes under SDN controller. Central nodes act as transmitters for data transmission, while normal nodes are used only to receive data flow. Finally, a Network Operating System (NOS), which is responsible for the entire network such as topology management. Distributed SDN-WSN is suitable due to the high data transfer to the network and high load balanced for large-scale WSN. The advantages of SDN-WSN distribution include the following: Easy expansion of network topology. Nodes can be added or removed easily in the area.
Management of the controller easier than other conventional nodes.
The transmitted messages in non-SDs based on WSN are trusted, because they are sent by each node to identify neighbor nodes. This method adds significant overhead to the network and also consumes a lot of energy. Each node must store routing tables in limited memory and calculate the path for the other nodes to execute these decisions. Many of the tasks of the resource-hungry are transmitted to the controllers in a SDN-WSN because it has a power supply and examines the entire network. The nodes should not constantly send the message to discover the topology in SDN-WSN [39]. The controllers in the SDN-WSN make the routing decision. Therefore, nodes do not need to store routing information within their routing diagrams. In addition, controllers can adjust the range of each node to reduce the reference information between the nodes. Implementation of these tasks by the controller in SDN-WSN can store the remaining energy of the nodes [40].
Service quality parameters Packet Delivery Ratio (PDR): This ratio is based on the sum of the total received packets in to the sink to the total sum of generated packets at all sensor nodes in a network, which shows the percentage of total packages delivered in the sink [41].
Throughput: it is defined as the number of packets delivered to the sink per unit time. The measurement power is significant towards the computational efficiency.
Live nodes: Nodes in the network have enough energy to process their tasks and can send their data to the CH.
In which, Res ( ) is the residual energy of the node in each round.
Network lifetime: it describes the long life of a network for the number of rounds at a given time. In other words, it shows how long or how many rounds he network can operate. Finally, efforts should be made to extend the life of the network, so that data packets in the BS can be transmitted for longer.
In this equation, ,-. is the coverage matrix and L i is the energy of sensor nodes, and N j is the sensors in the network.
Consumed Energy: An open space model (fs) is used for energy consumed by sensor nodes in data transmission, when the distance is less than the threshold value d 0 , otherwise, the multi-routing (mp) model is used. The energy consumed by the sensor is calculated to transmit L-bit information at distance d so that E elec , E fs , and E mp are the consumed energy by the electronic device and by the amplifier in open space and multi-way space, respectively.
Selecting a CH by Game of Theory: A. Identification of nodes by the controller: At first, the controller knows nothing about the network. Therefore, nodes must send their information such as address, location, residual energy, and their types to the controller.
B. The controller starts the strategy of choosing the game theory algorithm: When the goal is to select a number of nodes as CH, the clustering game is played by network nodes, which corresponds to selecting at least one CH from the node population. The CH is responsible for data collection from other nodes and sending after compressing proportional to another node. In this method, the proposed method is sent to the controller. The game is defined as FB = <N, T, E>, where N is the set of nodes T, the set of available strategies, and E is the set of utility functions of the nodes. D. The reward of selecting or not selecting cluster head According to rewards, if a node does not send own information, to the CH, the CH reward will be zero. In other words, if the node has to send own data directly to the controller, which will consume a lot of energy. If at least one node identifies node in the area as CH, its score will be W. This means that delivery of data to the controller is sent by CH. If the one node introduces itself as a CH, its reward to deliver data through clustering is reduced by an equal value at the cost of being a CH. In this case, the final reward will be W-D. It is clear that the game is symmetrical. Since the reward depends only on the players' strategies, because of that no specific node is considered. This means that each node can select itself as a CH with reward. Strategy (D, D) is not a Nash equilibrium. For this reason, it is best for each player to change the strategy to ND, in which case the reward will be W (W> W-D).
Similarly, strategy (ND, ND) it is not a Nash equilibrium so that each node prefers to change direction and introduces itself as a CH because this will lead to a positive reward. If the first player selects to be a CH and the second player selects to be a normal node, then neither of them has an incentive to change their choice. Hence, the strategy set (ND, D) is an equilibrium Nash. Similarly, (D, ND) is also an equilibrium Nash. Although these two strategies (D, ND) and (ND, D) are Nash equilibrium, there is no symmetrical Nash equilibrium in this game because there is no normal strategy for all players with an equilibrium result. In the following, useful expressions and theories that correspond to the clustering game with N players will be mentioned. T vector is considered to represent the strategies that players follow to extend the game from two nodes to N players. If no player considers itself as a CH, then the reward for all players will be zero. If at least one player, called k, plays D, then the score of all players except k will be equal to w, while the cost of introducing itself as a CH will be deducted from the initial reward (w) of player k. Therefore, the utility function U i (S) for the optional player i is as follows: If a node is not selected as a CH, the game continues and another node is declared as a CH.
E. Another round of the game and introduction a cluster head If the reward of the nodes to the controller is zero, the game will be played again in another round F. Do the other nodes send their own information to the CH or not?
G. If the CH gets all information from all nodes of the area, the CH throughput and consumed energy will be calculated.
Declaring or non-declaring of a node as a CH, the two numbers w and D cannot be the only CH criterion. As mentioned, a very important issue in WSN is the limited resources, especially the energy source of the nodes. A node that is introduced as a CH in the clustering structure will lose a lot of energy. Therefore, it is better to have CH candidate that have more energy than other nodes. They should have more throughput to be able to send information to other CH or controller with a high percentage. The desired changes are applied to some extent by multiplying the remaining energy of the node by the output of the utility function. The node that has more residual energy, as well as better throughput, will have more points to enjoy by implementing this change. The connection is obtained from the following relation and is placed in the neighborhood table to gain operational capability. Link R = µ N succ /N total + (6-µ) Link R The weighted mean factor coefficient is used in 8 µ in the proposed algorithm is the number of packets that succeed node N succ neighbors is considered as much as 0.4. The N total parameter is the total number of packets sent to neighbor node. This equation consists of two parts, the first part whose coefficient (µ) is related to the last time period, and the second part, whose coefficient (µ-1) is related to the time periods before the last time period. According to the equation, it is obvious that the more time intervals, the greater the effect of the last time period in calculating the throughput of the link. The desired changes are applied to some extent by multiplying the remaining energy of the node and the operating power by the output of the utility function. The node that has the remaining energy and throughput will also have more points to enjoy by implementing this change.
H. Calculation of the scores of all nodes In the proposed scheme, this choice is implemented completely randomly and with a random function. Using probability may create problems for the proposed scheme. The node scores are calculated before the clustering operation to reduce the probability effects in the proposed method. The total score of all nodes is calculated each time the game. Obviously, the best network mode is when the score is higher. In each round of the game (P), the selected node declares itself as a CH. The points are obtained for each node based on the modified utility function. These points must be added together. If the score is better and higher, the CH has selected otherwise another round of game will be started to find the best CH. The following equation shows this.
If the CH node cannot receive information from the node, it would be identified.
Zero reward is given to CH. Is the node not sending the information to the CH farther away from the CH?
First, each controller called Vi sends a radio message to u unknown node and records the time ti to receive the answer.
Each Vi sends a radio message with ti to an unknown node.
The controller calculates the distance of each reference to u from ti and sums the squares by subtracting the u coordinates.
The controller can now perform two tests to see if the U coordinates are acceptable. Test a is that the controller obtains the distance between each estimated Vi and U and compares it with the distance obtained from the protocol. If they differ greatly, the estimate is unacceptable and the node must be far from the geographical environment, but the test b is that u must be at least among the three sent nodes, otherwise it is not acceptable. If both tests a and b are positive, then the distances are constant with the estimated position and the node falls into a triangle of references. Therefore, the controller can assume that the estimated position of node is in the correct geographical position. However, if one of the tests fails instead, then the available information is not enough to examine the data environment. The estimate does not pass test a and is fixed far away from the environment. In fact, a delayed response node can pretend that the node is far from the environment.
If the node is farther from the Euclidean distance, it is turned back and the other round of the game is played to select the spark.
If the selected node is close, the command to send data to the CH.
After all the nodes have recognized the CH and the CH score is higher, the CH is definitely selected and they will send the data to the controller.
The controller takes the information from CH'S and sends to the sink. Routing with Game Theory: Identification of nodes by the controller At first, the controller knows nothing about the network. Therefore, nodes must send their state information such as location, residual energy, ID and their types to the controller.
Selection of the CH using the game theory algorithm The CH is selected using the above proposed algorithm. Preparing the package of each node to send After identify, the nodes prepare the packets and become ready to be sent.
High and low prioritization is considered in data transmission.
Sending data using FIFO priority algorithm First, high-priority queues are served. Thus, highpriority traffic classes will have little delay. A new scheduling plan is announced for high-priority incoming traffic, which uses a transit queue buffer and a sending queue buffer to alternately select packets. When the prioritized package is served over a period of time, the counter is reduced by the size of the package. If a queue fails to send a packet in the previous period, the counter value is retained and used in the next time. Therefore, if a service queue receives less than the amount sent in one period, it will have the opportunity to receive more service in the next period.
Discovering neighboring nodes If two nodes are neighbors in a radio range and can interact directly with each other, an edge is considered between them. N i is a set containing all the neighbors of node i representing the number of nodes in the network.
The network player selects the node according to the next node conditions In the routing problem, the source node can be considered as a player. The set of operations is all the states of the path that exist from origin to destination. In WSN, intermediate nodes play an important role in routing. Since WSN have limited power consumption, they may be reluctant to participate in the middle role. In other words, if all nodes do not want to use energy as an intermediate node, the efficiency of the network will decrease. For this reason, WSNs sometimes operate in the form of optional resource sharing networks. Uj(s)=αj(s)+βj(s) Benefits come from sharing the resources of a user with others βj (sj) = βj (s). Benefit (cost) is the result of sharing one's interests with others. S =0 means subscription and S =1 means non-subscription.
The player is the network that decides which neighbor to receive the package. In this proposed method, a node is a player that defines its maximum profit with the shortest path and the lowest energy consumption according to the equation, creates a table like the following table based on the number of neighboring nodes, and completes it from the characteristics of neighbors. Each node has neighbor characteristics, i.e. geographical distance to the earthenware and its amount of energy. An example of a created table: Therefore, the next node A3 is selected because it is the shortest distance with an approximate distance of 10, 8, 6, 5, 4, 2 from the well and different energies among the maximum available energies.
Referring to node interaction H i (t) = (h j I (t)| j=1, …, |N i |) is the history of interaction (transaction) of node I with neighbors. For example, the behavior of nodes belonging to Ni at time t occurs in packets. R ji> Hji (t) = <Fji is the history of the interaction of node i on node j. Fji is the number of packets that node j precedes for node i and R ji is the number of packets that node i requested from node j to send to at time t. ϴi is the private information of node i about other nodes without those nodes knowing the details. This information plays an essential role in assessing the correct amount of nodes. Therefore, a database is considered for each node, and each input of this database retains the properties of one of the neighboring nodes; for example, node properties, the correct value estimated for the node, and its history of interactions. The correct value that node i estimates for node j is denoted by T ij , which is equal to the following equation.
In this Ti j,g is the value of the predicted value of node j, and node i is obtained based on game analysis on the properties of node j. To calculate this value, node i must calculate the expected profit from the game of node j during the game with its neighbor node (node j) as follows.
T i,g j is the value that calculates node i based on direct observations of the transaction with node j according to the following equation.
α is a factor that indicates the amount of priorities. If α = 0, the transaction history of the nodes is not considered and it is assumed that the nodes have not had any previous transactions with each other. As the set up time of the network increases, the value of α also increases too.
Calculation of weight factor α The weight factor plays an important role in calculating the mean T i j . Suppose the number of transactions between nodes i and j is equal to δ (j, i). As a result, the weight factor is calculated as follows: Nodes can estimate the correct value for them during their transactions with neighboring nodes when the expressions in the above equation are known.
T i j = According to the definition this function is calculated based on observations of node interaction history. Suppose node i calculates the correct value for node j for the kth time after the node is set up, so it must use the k-1th observations and previous interaction history.
In which, F i j (k-1) is the interaction history after the evaluation of k-1th correct value.
Estimation of profit from routing In this game, the energy distribution of player i has a functional space according to <a i1 , a i2 >, where a i1 is the amount of personal energy and a i2 is the amount of energy in front of the packages. It is clear that a i1 , a i2 must be true in the condition Ei > a i2 + a i1 . The profit function of Node i, u i = (a 01 ,a 02 ), (a 11 ,a 12 ); θ is defined as follows: In this equation, j = 1-i, γ + β = 1, and γ j and x i are constant, which means that the previous profits in personal energy and frontal energy are also present and effective. The condition E i > a i2 + a i1 must be true after simplifying the profit function.
For this reason, the logarithm function is used. This function has a small growth and invertible. Then, U i =L n u i in node i does not know the type of node j, but the probability density function of the type of node j is ϴ (f). As a result, the expected gain of node i is equal to the mathematical expectation of U i .
Considering the Lagrange function, the initial condition is: As a result, the expected profit of node i is represented by U, which is obtained by simplifying the Lagrangian equations that can be used to calculate the value of T i . If the desired profit is obtained, the algorithm will continue to work. Otherwise, the network player considers another node.
Data storage of nodes ϴ i is the private information of node i about other nodes without those nodes knowing the details. This information plays an essential role in assessing the correct amount of nodes. Therefore, a database is considered for each node. Each input of this database holds the properties of one of the neighboring nodes. For example, the properties of the node, the correct value for that node, its history of interactions, and the benefit gained from using the information in future routing.
When the node with a lower priority wants to send the data to the header.
Identify adjacent nodes Receiving the list of neighbors in the proposed method is done through all the broadcasts of Hello packages. This package contains node information (including ID, residual energy, and node location).
Estimating node distances with received signal strength The distances between nodes can be estimated by the strength of the received signal. Therefore, it is assumed that network nodes are aware of their position relative to their neighbors based on the estimated signal strength. The shortest and closest node is selected.
Calculation of the energy consumption of the next node After selecting the node, the energy is calculated to see if the next node has good energy consumption or not. If the node has the desired energy, data is sent, otherwise another node is identified. The calculation of consumed energy of the proposed model is based on the LEACH algorithm. The amount of energy required for this transfer operation to occur in the sending node is calculated according to the following equation according to the algorithm for transferring a data packet of k bits to the distance i d (the distance between the data sending node and the data receiving node): In which 1 indicates the power consumption of the electronic circuit and indicates the energy required to amplify the transmission signals to send a bit of data. In addition, the power consumption for the i-data receiver is measured by the following equation to receive a k-bit data packet.
The energy consumption for nodes that are between the distance of the data sending node and the data receiving node will be equal to the sum of the data sending energy and the received data energy: 5! = ∑ p n 5! + n 5!q $% (25) The energy consumed by any type of node in this network, whether sender or receiver, can be calculated with the help of this equation.
Save the node address number The node is stored in the database as a new route for sending when it is energetically acceptable.

Obtained Results
The performance of the proposed method examined through Ant Colony Optimization algorithm (ACO), Genetic algorithm (GA), Particle Swarm Optimization algorithm (PSO), Firefly algorithm (FA), and Artificial Bee Colony algorithm (ABC). The factors and results of the simulation are also examined.

Simulation Environment
NS3 is the most powerful software for simulating and analyzing computer and telecommunication networks. NS3 allows the user to simulate different aspects of physical layer, data link, and application layer. This software allows designers and researchers to simulate the performance of protocols, equipment, and network architectures with great accuracy. The predictions of this software are dramatically coincided with reality. The hardware used was an Intel Core i7 3.2 GHz processor with 16 GB of RAM. Windows 10 was also used.

Simulation Parameters
As shown in Table 4, the values used were network size, number of sinks, number of nodes, data packet size, initial energy of each node, buffer size of each node, and number of iterations were limited to facilitate the process. In addition in table 5 shown the scenario of this method.

Results
In this section, the results of experiments are reviewed in NS3 software. In this section, the result of comparing the performance of different networks in the considered scenario were given in terms of the number of live network nodes, mean residual energy of nodes, total number of received packets in the sink, network life, total number of packets sent to the sink. It should be noted that the workload is the same for all cases in terms of performance. Game theory algorithm has obtained better answers to cluster selection and routing than metaheuristic algorithms. In Figure 9, it can be clearly seen that the live nodes of the proposed method are more live than the other methods. Subsequently, the ABC has obtained a more acceptable result, which is one of the most important parameters in the WSNs of node viability.
The number of packets received at the destination is divided by the total number of packages sent from the origin to calculate the package delivery rate at speed. The higher the ratio, the more packages have been successfully delivered to the destination given the total number of packages. In the proposed method, game theory has a higher package delivery rate than other methods because routing was assigned to data that wanted to send with high priority. If the data has higher priority, it sends the data to the CH by routing it closer. Figure 10 shows a comparison of the proposed methods in PDR.     Throughput refer to the actual number of packages delivered to the sink. This criterion indicates the ability of algorithms to transfer the desired number of packets to the sink. In the proposed method, a more acceptable result is obtained by comparing the load of the algorithms used. Figure 11 shows the throughput of nodes: Residual energy of network nodes is the amount of energy available in network nodes to be used by nodes to transfer data to other nodes. According to Figure 12, it can be seen that the proposed method has the best conditions in terms of the mean residual energy of all network nodes. Figure 13 compares the life time of different networks. Network lifetime means the time it takes for all nodes in a network to fail and the so-called network to shut down. According to the figure, it can be seen that the performance of the proposed method is better than the other discussed items.  In the second scenario and figure 14, the first level all method has approximately same, but after 600 rounds the PSO algorithm has the best answer compared with others, but suddenly this algorithm decrees sharply, in the live node the ABC algorithm and Game theory has a close competition but at the end, the proposed method has a good performance in compared with others.
In figure 15, the proposed method has a good efficiency compared with others; also, in the second scenario, the network size has increased; furthermore, the proposed method has a good performance on a large scale. PSO algorithm again does not have good performance in these skills.
Throughput is a measure of total units of information a system can process in a given amount of time. In figure 16, the ABC and proposed method have good performance compared with another algorithm. FA and PSO algorithm in the 100 nodes have the same results.  In Figure 17, all 6 methods are compared in terms of the average residual energy. As can be seen from the previous figure, the proposed method reduces energy consumption in the long time. In addition to maintaining the average energy, it is a reason for the energy level of nodes to be higher than other methods. Considering that, the issue of energy is the main challenge that has been solved in this research. Due to this method has the best performance among the three competitors in terms of the average energy of the nodes.
Lifetime of network is defined as the operational time of the network during which it is able to perform the dedicated task(s) and network lifetime is defined as the time until the first node exhausts its energy in the network. As expected from the proposed method in the second scenario, in the figure 18, the proposed method has the best performance in terms of network life.

Conclusions and Future Studies
One of the most important problems of network experts regarding the establishment and maintenance of WSNs in various applications of these networks is the problem of battery limitation and the life of the nodes of this network. Since the efficiency of WSNs is directly correlated to the lifetime and maintenance of the network coverage of each of the nodes that make up these networks, so all surfaces of this type of network must be designed with energy awareness. Routing in the wireless sensor network is one the cases that energy awareness is a great help in increasing the life of the network. In this research, a new routing protocol and cluster selection are presented based on game theories. This routing and CH selection protocol sends information according to data priorities and also uses game theories for CH selection. The results of simulating the proposed algorithm and comparing it with the artificial bee algorithms, genetic algorithm, cuckoo algorithm, firefly algorithm, gray wolf algorithm showed acceptable results.