A Dynamical Slot Assignment Method for Wireless Sensor Networks Based on Hopfield Network

This paper proposes an improved Hopfield neural network (I-HNN) algorithm to optimize the slot assignment scheme in wireless sensor networks. The key advantage of the proposed algorithm is to increase the convergence probability under different traffic loads. To achieve this, nodes can adjust their slot demands according to the traffic load, slots number, and demand history. Various aspects of the network performances with the proposed I-HNN algorithm are evaluated via simulation. The results indicate that I-HNN is suitable for wireless sensor networks with dynamically varying traffic. In particular, it can increase the convergence probability and slot utilization under the heavy traffic load.


Introduction
A wireless sensor network is a special wireless network without the support of any fixed infrastructure.Due to the lack of central schedulers, the media access control (MAC) protocol is one of the key design challenges for wireless sensor networks.According to the assignment strategy, the MAC protocols can be classified into three categories: random access mechanism such as IEEE 802.11 [1], allocation based mechanism such as FPRP [2], and hybrid mechanism such as TDMA/CSMA [3].In this paper, we focus on the allocation based mechanism, which has two assignment strategies: static and dynamic.Compared with the static strategy, the dynamic assignment strategy can adapt to the dynamic network topology to achieve collision-free packet transmission and reduce time delay.However, dynamic assignment protocols require nodes to run in parallel and cooperate mutually.Such a lack of centralized control brings further challenges to the design of slot assignment algorithms.
The Hopfield neural network [1] was originally proposed in the neural network literature.It is composed of several interconnected simple neurons and has been widely used in solving nonlinear optimization problems.The Hopfield neural network algorithm has the following four features: (1) it runs on multiple nodes in parallel, (2) it allows multiple nodes to cooperate in a distributed manner, (3) it approaches an optimization goal with a nonlinear method, and (4) it computes rapidly.Consequently, The Hopfield neural network algorithm is naturally suitable for resource assignment (including TDMA assignment) in decentralized systems such as sensor networks.
In the literature, the neural network algorithm has been proposed for resource allocation in cellular radio networks [4][5][6][7][8][9][10][11][12][13][14][15].The continuous Hopfield network [6], firstly used in channel assignment, requires very large iteration numbers to converge and is unsuitable for decentralized wireless sensor networks.Funabiki and Takefuji proposed a modified neural network model called the hysteresis McCulloch-Pitts neuron model [5].This model uses two thresholds to limit the neuron's input.When the input exceeds the upper threshold or is below the lower threshold, the output then changes to 1 or 0, respectively.Otherwise, the output remains unchanged.All neurons update their outputs in parallel, and four heuristics are introduced to increase the probability of convergence to the global minimum.In [4], another modified Hopfield network algorithm was proposed.To accelerate convergence, the algorithm uses different random initialization methods for the neuron's input and then compares the different initialization methods by simulation.References [7,8] proposed a TDMA slot assignment scheme based on the neural model in [5] and achieved a collision-free TDMA broadcast mechanism for every node.
The papers mentioned above cannot solve the localminimization problem.Therefore, they are not applicable to a distributed dynamical network.As a result, several improvements upon the above algorithms were proposed [6][7][8][9][10][11][12].Reference [9] added a negative self-feedback in the neuron model of [5] and proposed a new parallel algorithm for slot assignment in wireless packet radio network.In [10], a dynamic slot assignment algorithm based on the Hopfield network is proposed.Once a node needs to apply for a slot, it randomly chooses a slot number and runs the Hopfield network to judge whether the slot is available according to local contentions.If the slot is not available, the node will subsequently try other slots and update the entire network.Another algorithm called binary recursion neural network [11] proposed a new activation function.To solve the local minimum problem, it unifies the Gaussian distribution to determine the termination threshold.Reference [12] applied a nonlinear function to modify the neuron's connection weight and increase the convergence rate.However, this algorithm does not achieve the best performance in terms of convergence probability.
Recently, with the development of advanced optimization algorithms such as genetic algorithm and chaotic algorithm, new types of neural networks combined with these new algorithms are sought to increase the convergence probability.One mixed assignment algorithm that combines the genetic algorithm and neural network was proposed in [13].This algorithm adopts the Hopfield network concept and is able to achieve the maximum throughput.Moreover, a fuzzy neural network algorithm was proposed to solve the channel assignment problem in [14,15].This algorithm uses the fuzzy C-means clustering to classify nodes in a network, adds the correlation degree between a node and a cluster to the neuron's weight, and adopts the Hopfield neural network to update the neurons.The modified algorithms can solve the local-minimization problem at the cost of increased iteration number.
The algorithms proposed in the above literature do not consider the dynamic change of traffics in wireless sensor networks, which, in practice, are likely to have varying traffics.This paper proposes an improved HNN (I-HNN) algorithm to solve the channel assignment problem in wireless sensor networks with dynamic traffic demands.Compared with existing algorithms, the proposed algorithm can increase the convergence probability under different traffic loads.
The remainder of this paper is structured as follows.In Section 2, the neural network model and the slots assignment algorithm are described.The proposed algorithm I-HNN is presented in Section 3. Section 4 shows the simulation results and Section 5 concludes the paper.

Hopfield Based Channel Assignment Algorithm
2.1.Slot Assignment in TDMA-Based WSN.We consider a TDMA-based wireless sensor network, in which time is divided into frames and a frame is further divided into slots.TDMA-based communication system has the ability to provide collision-free packet transmission regardless of the traffic load.Figure 1 illustrates a simple wireless sensor network with 7 nodes operating in the TDMA fashion.To avoid transmission collision, nearby nodes cannot use the same time slot.However, a slot can be spatially reused by nodes separated by more than two hops away.Due to the decentralized and multihop characteristic of wireless sensor networks, the slot assignment algorithm should run in a distributed manner.Hopfield neural network is composed of several interconnected neurons which can run in a distributed manner.Therefore, it is naturally suitable for slot allocation in wireless sensor networks.

Construction of Hopfield Neural Network in Slot Assignment.
In a wireless sensor network with  nodes and  slots per frame, the slot assignment problem can be considered as a combinatorial optimization problem consisting of a Hopfield neural network with  ×  neurons, where each slot per node is treated as a neuron.Every neuron connects with other neurons and updates its output periodically according to others' output until all neuron's outputs are stable.In this case, each neuron (, ) is regarded as a processing unit.If the output of neuron (, ) equals 1, it means that slot  is assigned to node ; otherwise, slot  is unassigned.The construction of the neural network is shown in Figure 2.
The Hopfield neural network above consists of an array of simply connected neurons with binary output.Each neuron has several inputs from other connected neurons and has only one output.The neuron model is shown in Figure 3.
A neuron in the Hopfield neural network can be regarded as a simple processing unit, which is composed of an input unit and an output unit.The input unit   () is updated by (1) in each iteration.Consider   () =   ( − 1) + Δ  ( − 1) . ( The update of input Δ  () is a function of other connected neurons' outputs; namely, How to design the function Δ  () = [ ] will be discussed in Section 2.3.The output of a neuron is given by [5] Here, UTP (upper trip point) and LTP (lower trip point) denotes maximum and minimum thresholds, respectively, and the values of UTP and LTP are given in [5].When   () equals one, it means that slot  is assigned to node .The task of channel assignment is to ensure that nearby nodes in wireless networks should not be assigned with the same channel.

The Energy Function.
The slot assignment problem in wireless networks must meet the following two constraints: one is that the same slot must not be assigned to nodes within two hops; the other is that the slots assigned to a node should meet the node's demand of slots.Therefore, the slots assignment problem can be transformed to an energyminimization problem, as formulated in (4).Consider Here,   () denotes the total neuron energy of node ;  and  are constant coefficients.Parameter   denotes the slot demand of node .
The slot assignment algorithm is to minimize the energy function   ().When the first term equals zero, it indicates that slots assigned to node  in a frame equals   and hence satisfies the demand.When the second term is zero, it means that slot  and slot  assigned to nodes  and , respectively, are not in conflict.The energy function reflects the two above constraints of slot assignment.When the slot assignment is correct, the energy function will output 0. Otherwise, the algorithm will continually iterate until the energy function outputs 0 or the maximum iteration number is reached.
In symmetric neural networks, we have  , =  , , where  , denotes the connection weight between neuron (, ) and neuron (, ) [4].It follows that (4) can be rewritten as follows: It has been proved by [5] that when   ()/ = −(  ()/  ()) and   () = [  ()], then (  ()/) < 0, which means that the energy function will reduce with increasing iteration.Hence, the function Δ  () = [ ] is given by Δ  () = −(  ()/  ()).Because the energy is bounded, the algorithm can guarantee that the energy value will eventually approach zero.In a wireless network, the slot assignment problem can be formulated as minimizing the energy function in a corresponding neural network as shown in Figure 2.
International Journal of Distributed Sensor Networks As described above, the Hopfield neural network can solve the slot assignment problem in a parallel and nonlinear way.In a network with  nodes and  slots to be assigned per frame, there are  ×  neurons to implement the slot assignment tasks.These neurons can be divided into  groups, each group contains  neurons.All the neurons can operate in parallel on  nodes.The connections among the neurons running in a node can be arbitrarily adjusted according to the slot assignment algorithm.On the contrary, the connections among the neurons running in different nodes should reflect the topology of the network.Therefore, it can be naturally adopted for time-slot allocation in TDMA-based wireless sensor networks.In the next section, we will propose a new slot assignment algorithm based on Hopfield neural network.

Dynamical Slot Assignment Based on Hopfield Neural Network
In TDMA-based wireless sensor works, the slots in a frame have two types: a control slot at the beginning of a frame, followed by several traffic slots to be allocated.The control slot is used to exchange control information for scheduling the traffic slots.The traffic slots are used to carry the actual payload.To establish a neural network with  ×  neurons running in  nodes to carry out the slot assignment task, the control slot is used to exchange information among different nodes.

Modeling Assumptions and Discussions.
Three key assumptions are made in our system model.Assumption 1 is that all nodes keep perfect timing synchronization.
This assumption is the premise of all TDMA-based communication systems and is widely applied in the studies of TDMA systems [2,3].Assumption 2 is that the network topology will not change during one iteration interval.In practice, because the iteration time is typically very short, the change of network topology during one iteration time is negligible.Therefore, the network topology can be treated as static within one iteration time.This is a widely used assumption for ad hoc network studies [2].Assumption 3 is that there is no packet error in the channel.
Although communication errors are inevitable in practice, various practical techniques such as forward error coding (FEC) and ARQ can be used to manage the error rate at a desired level.In this paper, we consider the exchange of channel allocation information between nodes.In practice, such sensitive control information is typically well protected with FEC and ARQ schemes to have very low bit error rates.
In addition, preliminary simulations show that the main conclusions of this paper remain robust for an error rate below 10 −6 .The above three idealized assumptions enable us to make a tractable analysis in this paper.However, the results should be understood as the theoretical performance upper bounds.

Energy Function and Motivation Equation.
In a wireless sensor network, nodes can only receive local information within two hops.If the network guarantees that different time slots are assigned to nodes within two hops, it will realize conflict-free transmission.
As shown in (4), the information from other nodes is mainly used to calculate the second term, which guarantees that the slots assigned to different nodes do not conflict.Because nodes more than two hops away can reuse the slots, the calculation of the second term in each node only needs the information of nodes within its neighboring two hops.It follows that the energy function can be modified as follows: where () denotes the set of node 's two hop neighbor nodes and   () is the acquired demands of slots.The first term of ( 6) guarantees that the slots assigned to node  meet the slot requirements of node .The second term guarantees that the same slot is not assigned to nodes within two hops.
To compute this equation, each node should receive   () from other nodes within two hops away.This process can be achieved with an additional control slot at the head of a frame.Since the connection between two neurons is restricted to the topology of the network, the weight of  , is set as follows: According to   ()/ = −(  ())/(  ()) proved by [5], the change of the input is Therefore, the motivation equation can be written as follows: The termination condition of the iteration of neural network is that the energy value of the whole network equals zero.This implies that all nodes can acquire the global information about the network's energy by use piggybacking techniques to relay this information while iterating.To increase the convergence speed, [5] adopts some heuristics.It follows that Δ  () can be changed to where

Slot Demand Model.
The slot demand of a node in the th frame is the packet arrival number within a frame.The demand is a random variable and can be expressed as follows: Suppose that the packet arrival rate is a Poisson's distribution with mean , where  is the duration of a frame.We have The expectation of packet arrival number in a frame of time is .
The Hopfield slots assignment algorithm introduced above does not consider dynamic changes of the traffic load in the wireless sensor network.When a node has a heavy traffic, it needs more slots.The high slot demands in some nodes may lead to a failed convergence in Hopfield slot assignment algorithm.If these nodes can automatically adjust and reduce their slot demands, the convergence probability can be increased under different traffic conditions.
An appropriate slot demand model should include many factors, such as packet arrival rate , total slots number , and history slot demand of other contention nodes within two hops   ( − V),  ∈   and V = 1, 2, . . ., , and the slot demands of node  in th assignment should be Here, (⋅) is a function.Nodes can confirm the suitable slots demands due to the function.In this paper, we propose a simple function as follows: where   () is the acquired demands of slots,  actual () is the slots number that nodes actually need, TH is a maximum threshold, and aver is the average history demand of other contention nodes within two hops.TH and aver are represented by the following two formulas: where   is the two-hop neighbor number of node  and () is the set of node 's neighbor nodes.Threshold TH considers the maximum neighbor number, which is max(  ), and to let the nodes with lower neighbor, formula (15) also considers the rate of average neighbor number and its own neighbor number.

Algorithm Description.
Consider a wireless sensor network with  nodes and  slots per frame, the slot assignment task can be achieved by constructing a Hopfield neural network with  ×  neurons.Each slot per node is treated as a neuron.In each iteration, the input unit   () is updated by   () =   ( − 1) + Δ  ( − 1).The function of Δ  () = [  (),      (),      (), . ..] is given by formula (10), whose input is mainly determined by other neurons' output   () and its slot demand   ().The output of a neuron   () = [  ()] is given by formula (3).Every neuron connects with other neurons and updates its output periodically according to others' output until all neurons' outputs become stable.If the output of neuron (, ) equals 1, it means that slot  has been assigned to node ; otherwise, slot  is unassigned.
The above slot allocation algorithm runs in the control slot at the beginning of each frame.All the  ×  neurons compute the iteration parallel in  nodes.To realize this process, all the neurons are divided into  groups, each group has  neurons.Neurons (1, 1) to (1, ) are running serially in node 1, and, similarly, neurons (, 1) to (, ) are running serially in node .All  groups of neurons run in parallel in  nodes.Each node sends the output   () of those neurons running in it to its neighbor nodes.Each node also gets the output   () of other neurons which is running in its two hop neighbor nodes.
The main process of the proposed I-HNN algorithm is as shown in Algorithm 1.
When the Hopfield neural network converges successfully, channel scheduling with no conflict and low time delay can be achieved.The performance of the proposed I-HNN algorithm depends on the frame size, node density, and //initializing the input and output of its  neurons; for  := 1 to  do Parameter initialization:  = 1,  = 1, Set  randomly equal to 3, 4, or 5,  max = 30,  min = −30, UTP = 5, LTP = −5, set all the inputs and output of neuron are set to zero:   () = 0,   (0) = 0; end //begin the iteration of I-HNN  = 1 while (≤ maximum iteration) do Calculate the slot demands   () according to (15); Received output   () from other nodes within top hop away; for  := 1 to  do calculated the Δ  () according to (10); Update the input of neuron   ( + 1) by ( 1).end for  := 1 to  do Determine and update the output   ( + 1) by ( 3).end Calculate the energy function value by (6).if ( = 0) quit iteration and generate final slots assignment; else send new output   ( + 1) to other nodes and enter next iteration. =  + 1; end Algorithm 1 traffic load.The next section of the paper will evaluate the performance of I-HNN.

Performance Evaluation.
The main performance metrics are as follows.
(1) Average convergence probability: the convergence probability is defined as the probability of successful convergence.
(2) Average iteration number: it is the required iteration number when the Hopfield neural network successfully converges.When the network fails to converge, the iteration is equal to the maximum iteration number.
(3) Slot utilization: the slots utilization is defined as the acquired slot number in one assignment for each node.
(4) Average time delay: the time delay is defined as the average service time for one packet.To derive the time delay, we assume the  nodes in the network are //1 queues, and the time delay for each nodes is denoted as   and can be achieved by Pollaczek-Khinchine [16] formula as follow: where the service rate of the station  is The total time delay is given by

Simulation Analysis
4.1.Simulation Scenarios.Our simulation aims to analyze the average convergence probability, average iteration number, average acquire slots number for each node, and average time delay, under different traffics, frame sizes, and nodes densities.And we assume that (1) the packets have a fix length, which is also equal to the length of one slot; (2) the traffic demands of nodes are independent.Packets of each node arrive according to a Poisson's process with rate   .Packets are stored in buffers in each station and the buffer size is infinite.
In our simulation setting, the nodes are distributed in a 10 × 10 square unit area.In each unit area, a node is randomly generated, as shown in Figure 4.The communication range of each node is 1.5 units.There are 100 nodes and 30 slots in the network, the demands of nodes follow a Poisson's distribution with parameter .The maximum iteration number in each simulation is 100.The simulation results are averaged over 100 simulation runs.

Simulation Results and Analysis. This paper compares the
Hopfield neural network based slots assignment algorithm in [7] (HNN) and our improved Hopfield neural network slots assignment (I-HNN) from four aspects: average convergence rate, average iteration number, slots utilization, and average time delay.We first take an example to illustrate how the I-HNN algorithm works.It is assumed that the network traffic is under saturated traffic condition and all nodes require at least one slot.We use the sign "T" to represent that this node is assigned with a current slot.Figure 5 illustrates a simulated network topology with 16 nodes.Table 1 shows that the proposed I-HNN algorithm can assign slots well to achieve better slot utilization.
(1) Average Convergence Probability.The relation between the convergence probability and slot demand is shown in Figure 6.The slot demand  depends on the traffic load.The simulation result indicates that the convergence probability of the HNN algorithm reduces quickly with increasing slot demand.Although the increase of frame size can improve the convergence probability to a certain extent, the convergence probability is also low with high slot demands.In the proposed I-HNN, the slot demands can be dynamically adjusted according to the traffic demand.As a result, the convergence probability is increased under different traffic loads.Figure 6 also shows that the I-HNN algorithm can increase the convergence probability of the Hopfield neural network under the condition of high slot demands.
(2) Average Iteration Number.We note that for iterative algorithms, the minimum necessary iteration number can serve as an effective indicator of the computational burden.Therefore, Figure 7 also suggests the advantage of IHNN over HNN in terms of computation burden.
Figure 7 shows the relation between the iteration number and slots demands.The higher the demand is, the more iteration is needed for the Hopfield slot assignment algorithm to converge.As for the HNN algorithm, the iteration number increases with the growth of slot demands and eventually reaches the maximum iteration number.By dynamically  adjusting the threshold , the I-HNN algorithm can reduce the iteration number and accelerate the convergence rate.
(3) Slot Utilization.Slots utilization can be evaluated as the average number of assigned slots for each node.This simulation shows the slots assignment efficiency with different slot demands and frame size.
In conventional reservation based TDMA protocols, the frame size has a significant effect on the network performance.Because the contention nodes within two hops cannot reuse the same slot, the slot assignment will not succeed when the number of slots is less than the number of contention nodes within two hops.
Figure 8 shows that the slot utilization will change when the average slot demands increases.When the average slot demand is low, the slot utilization of HNN is higher than that of I-HNN; this is because the I-HNN can adjust and reduce its slot demands automatically.However, when the average slot demand is high, the slot utilization of HNN is lower than that of I-HNN; this is because higher slot demand may lead to failed convergence of HNN; hence, the slot utilization  will accordingly decrease.Otherwise, the I-HNN can reduce the overmuch slot demand and improve the convergence probability, so as to increase the slot utilization.
Figure 9 shows the slot utilization as a function of different frame sizes.When the slot demands are low, the I-HNN can improve the slots utilization with short frame sizes; when the slot demands are high, the I-HNN algorithm can obviously increase the slots utilization.
Similarly, the network performance is also related to the contention range of nodes.As the contention range expands, the number of contenting nodes within two hops will also increase, leading to decrease in slots utilization.As shown in Figure 10, the effect of contention range on slot utilization is similar to the effect of frame size.
(4) Average Time Delay.When the packet arrival rates are lower than the packet transmitting rates, all packets can be sent eventually.However, when the packet arrival rates are higher than the packet transmit rates, some packets cannot be sent, which will lead to an infinite time delay.Figure 11 compares the time delay of HNN with I-HNN.
The packet transmit rate is denoted by   which represents the average packet number that can be transmitted in a frame.The slot demands are simulated as Poisson's distributed traffic.It is assumed that the network traffic is saturated and every node requires at least one slot.From Figure 10, we can see that when the slot demand is low, the I-HNN algorithm can achieve slightly lower time delays than HNN; this is because I-HNN can dynamically adjust the slot assignment threshold .However, the time delay in I-HNN increases very fast with growing slot demands because the packet transmit rate is kept low by the I-HNN algorithm to avoid contentions.adopted from the classic HNN algorithm in the neural network literature and features two major modifications.First, a "two-hop" constraint has been imposed on the output of the network to reflect the nature of local channel contention in wireless sensor networks.Second, a simple but effective mechanism is introduced to dynamically adjust the channel assignment policy according to traffic demands.Through simulation, the performance of the proposed algorithm has been evaluated in terms of average convergence rate, average iteration number, slots utilization, and average time delay.It has been observed that the proposed algorithm is effective in improving all the above aspects compared with the conventional HNN algorithm.

Figure 1 :
Figure 1: An example of slot assignment for wireless sensor network.

Figure 2 :
Figure 2: The construction of neural network based assignment.

Figure 4 :
Figure 4: An instance of network topology in a simulation.

Figure 5 :
Figure 5: An illustration of a simulated network topology with 16 nodes.