An Immune Cooperative Particle Swarm Optimization Algorithm for Fault-Tolerant Routing Optimization in Heterogeneous Wireless Sensor Networks

The fault-tolerant routing problem is important consideration in the design of heterogeneous wireless sensor networks H-WSNs applications, and has recently been attracting growing research interests. In order to maintain k disjoint communication paths from source sensors to the macronodes, we present a hybrid routing scheme and model, in which multiple paths are calculated and maintained in advance, and alternate paths are created once the previous routing is broken. Then, we propose an immune cooperative particle swarm optimization algorithm ICPSOA in the model to provide the fast routing recovery and reconstruct the network topology for path failure in H-WSNs. In the ICPSOA, mutation direction of the particle is determined by multi-swarm evolution equation, and its diversity is improved by immune mechanism, which can enhance the capacity of global search and improve the converging rate of the algorithm. Then we validate this theoretical model with simulation results. The results indicate that the ICPSOAbased fault-tolerant routing protocol outperforms several other protocols due to its capability of fast routing recovery mechanism, reliable communications, and prolonging the lifetime of WSNs.


Introduction
The complex networks have attracted growing research interests in topology structure and dynamic problems.Many kinds of system can be described with the complex network model, and these models are constructed by several nodes connected with each other, such as the Internet and the wireless sensor networks WSNs .Due to the ability of collecting data from the environment and reporting it back to the sink without human supervision 1, 2 , WSNs, especially heterogeneous ones, have come to pervade every aspect of our lives, such as habitat monitoring, industrial sensing, and traffic control 3-5 .The heterogeneous WSNs always paths which are node/links disjoint with the primary path and other alternative paths.Thus, a failure in any or all nodes/links on the primary path does not affect the alternative paths.Using this multipath scheme in a network with k disjoint paths from source to destination can tolerate at most k − 1 intermediate network component failures.A secure and energy-efficient multipath routing protocol proposed by Nasser and Chen 10 is effectively resistive to some specific attacks, and has the character of pulling all traffic through the malicious nodes by advertising an attractive route to the destination.
A considerable amount of work has also been done on the hybrid routing scheme, which combines multipath scheme and reactive routing scheme.In this scheme, multiple paths are calculated and maintained in advance, and then, alternative paths are created on demand.EARQ energy-aware routing for real-time and reliable communication is a hybrid routing scheme proposed by Heo and Hong 9 , which selected a path that expended less energy than others, among paths that delivered a packet in time, which enabled even distribution of energy expenditure to sensor nodes.It also provided reliable communication and fast recovery from path failure, because it only sent a redundant packet via an alternative path if the reliability of a path was less than a predefined value.Pandana and Liu 11 sought to propose an algorithm which designed the connectivity weight of each node and established a most reliable path in order to keep the other nodes' connectivity.
Our work differs from the above existing ones 13-16 by considering a different architecture and routing objective.We consider the H-WSNs architecture with a number of macronodes and concern with providing k-connectivity from each source node to the set of macronodes, and as such, we provide a hybrid routing scheme to maintain the multipath routing.The H-WSNs usually consist of two types of wireless devices 12 : a large number of resource-constrained wireless sensor nodes deployed randomly and a much smaller number of resource-rich macronodes placed at known locations.The macronode network, which provides more energy, transmission bandwidth, computing ability, and storage space, is used to quickly forward sensor data packets to the sink.With this setting, data gathering in the H-WSNs has two steps.Firstly, sensor nodes transmit and relay information on multihop paths toward any macronode.Then, it is forwarded to the sink using fast macronode-to-macronode communication once a packet encounters a macronode.
The similar hybrid routing schemes for the H-WSNs are as follows: CPEQ clusterbased periodic, event-driven, and query-based protocol 17 groups sensor nodes to efficiently relay data to the sink by uniformly distributing energy dissipation among the nodes.It can provide fast broken path reconfiguration and high reliability in the delivery of event packets and speed up new subscriptions by using the reverse path.Cardei and Yang 18 proposed GATC k and DATC k in the H-WSNs, with the objective of minimizing the total energy consumption while providing k independent paths from each node to macronodes.Such a topology provides the infrastructure for fault-tolerant data-gathering applications robust to the failure of up to k − 1 sensors.Boukerche et al. 8 used a protocol of ICE intercluster communication-based energy-aware and fault-tolerant protocol by alternating the nodes responsible for intercluster communication inside one cluster.If one of multiple paths has faulty nodes, the other ones will be used for the event notification's propagation.But the fast routing recovery mechanism for path failure has rarely been considered.Further, as the fault-tolerant optimization problem to find the optimal routing is NP-hard, these heuristic deterministic methods would always get the likely optimal routing result, and is easy to fall into local optimum.So, we employ a swarm intelligence algorithm, the ICPSOA, to improve the performance of solving these problems.
In this paper, we propose an ICPSOA-based fault-tolerant routing algorithm, which reconstructs the network topology of H-WSNs and provides a fast recovery from path failure with alternative path.We also compare the performance of the protocols of EARQ, CPEQ, and ICE with that of our approach.As we known, EARQ is an effective fault-tolerant routing protocol for homogeneous WSNs, while ICE and CPEQ are for H-WSNs to provide routing recovery from path failure.In this way, we can evaluate the fault-tolerant routing recovery mechanism with different network types.

SPSOA, CPSOA, and ICPSOA
The EA-based bionic randomized algorithm has become the important tools for solving complex optimization problems because of its intelligence and widely used and global search ability.But the algorithm dealing with fault-routing problem of WSNs should support the characteristic of energy saving.In general, better fault-tolerant performance always needs more energy consumption.Therefore, we choose light-weight algorithm based on the particle swarm optimization algorithm PSOA , which has a simple structure and is easy to realize.
The PSOA is a new EA based method to search an optimal solution in the highdimensional problem space 13 , where each particle is a potential solution to the problem under analysis.In updating a population of particles with regard to their internal position and velocity, the PSOA is informed by the experiences of all the particles.It provides an idea to find solutions to complex problems using group advantage without global model and centralized control and can be suitable to apply in a dynamical modeling environment.It has been applied to many optimization problems, such as control problems and protocol design 14 .A remarkable difference between the PSOA and other EA-based algorithms is that the PSOA is very simple and has few parameters to be adjusted.Therefore, in general, it requires less computational complexity.
In the standard PSOA SPSOA , each particle is a potential solution to the problem.Assume N particles fly in the D-dimensional search space, the position of the ith particle is x t i x t i1 , x t i2 , . . ., x t iD T , and its velocity is v t i v t i1 , v t i2 , . . ., v t iD T .p i p t i1 , p t i2 , . . ., p t iD is the best previous position of the particle, and p g is the global best position of the whole particle swarm.Therefore, the velocity and position of each particle will be updated according to 15 where 1 ≤ d ≤ D, c 1 and c 2 are learning factors, and usually, we make c 1 c 2 2; w is the inertia weight and used to control the tradeoff between the global and local exploration ability of the swarm.Random numbers rand 1 and rand 2 are uniformly distributed in 0, 1 .
The SPSOA also exhibits several disadvantages: it sometimes posses the problem of converging to undesired local optimum, for the diversity of population decreases in the latter iteration of evolution; optimizing stops when reaching a likely optimal solution, and thus the accuracy of the algorithm is limited.Therefore, a cooperative PSOA CPSOA , which uses cooperative behavior of multiple swarms to improve the SPSOA, is proposed in 16 .In the CPSOA, limitation of an individual can be compensated by a number of other individuals from other symbiotic groups in the interaction.It can avoid misjudgment caused by single exchange of information 16 .However, it still uses the formula of the SPSOA to evolve.The trajectory of each particle is unable to yield high diversity of particles to increase search space.Therefore, the CPSOA may get a suboptimal solution.
For this reason, we draw on good diversity characteristic of immune mechanism and develop an immune CPSOA ICPSOA , in which each particle is considered as an antibody.Particle clone is used to generate a new population with offspring.Mutation is used to diversify the search process.Immune restrain is considered to restrain the inferior ones in order to keep the stable population.Immune memory is used to store the feasible solutions 19 .The affinity between antibody and antigen can measure the optimal path, and the affinity between antibodies and antibodies can evaluate the diversity of population 20 .In the ICPSOA, mutation direction of the particle called antibody is determined by evolution equation, and its diversity is increased by immune mechanism 21 .Although the addition of the immune mechanism may add more time complexity to the system, the proposed ICPSOA largely improves the capability of jumping out of local optima.The use of the ICPSOA for the fault-tolerant routing problem in H-WSNs has been presented in the following sections.

The Architecture for the Model of H-WSNs
The architecture for the model of H-WSNs contains two types of wireless sensor devices as shown in Figure 1.The lower layer is formed by sensor nodes with constrained resource, including small amount of source nodes and other relay nodes.The main tasks performed by the source nodes are sensing, data processing, and data transmission.The tasks performed by the relay nodes are data processing and relaying.The dominant energy consumer is the radio transceiver.The upper layer consists of resource-rich macronodes overlaid on the H-WSNs.Wireless communication links between macronodes have considerably longer ranges and higher data rates, allowing the macronode network to bridge remote regions of the interest area.The tasks performed by a macronode are data aggregation and transmission, complex computations, and decision making.The ICPSOA is also executed by macronodes.
Therefore, in-network data transmission can be performed by forming a spanning tree among all the tree nodes.As shown in Figure 1, transmission starts with the leaf nodes source node of the tree sending their values to their parent nodes macronode, nodes 1, 2, . . ., 12 in the tree, until the final data is obtained at the root node sink, node 13 .Thus, the overall architecture would have a tree of macronodes and then each macronode can serve as the root of a subtree of ordinary nodes.Here, we are only interested in the fault-tolerant routing between sensor-sensor and sensor-macronode communications.
Assume that the network has the following characters: 1 the H-WSNs is a static network, where the nodes will not move after deployment, 2 every node knows its own position and that of the macronodes and the sink.The location can be obtained by GPS or localization protocols for estimating the location of a node, 3 the wireless transmission energy of macronode can be adjusted based on the distance between the receiver and itself, 4 the adjacent nodes would acquire the state information of their 1-hop neighbors and the links between them through periodically broadcast.The meanings of used symbols is provided in Table 1.The optimal path of P s, r with optimal fitness in ST i n pbi The ith sensor node of p b in ST i

The k-Disjoint-Path Spanning Graph in the Subtree
The subtree ST i of the network is modeled as a directed, connected graph G V, E , where V is a finite set of subtree nodes and E is the set of subtree edges representing connection between these nodes, where source node n s ∈ V and macronode root n r ∈ {V − {n s }}.p i s, r is a valid path between n s and n r , and P s, r is the set of all the paths p i s, r .n n ∈ p i s, r represents a node in p i s, r , and e e ∈ p i s, r represents direct edge between any two adjacent nodes in p i s, r .Then, we can get the k-disjoint-path spanning graph in the subtree ST i .The factors affecting the choice of path p i s, r include 1 the available energy function of each node, ene n , 2 distance function of the edge between adjacent nodes, dist e , 3 energy consumption function, ene e , 4 communication delay function of the node, delay n .Then, these parameters can determine the fitness function of p i s, r , fitness p i where f 1 is the ratio of the energy consumed by the edges of path p i and the energy consumed by all the edges in the subtree, f 2 is the delay of the edges and nodes of path p i versus the delay of all the nodes in the subtree, and f 3 is the distance of the edges of path p i versus the distance of all the edges in the subtree.ω 1 , ω 2 , ω 3 are the weight of effective energy, delay and distance constraints in the fitness function, and ω 1 ω 2 ω 3 1.We set ω 1 0.4, ω 2 0.2, ω 3 0.4.The higher fitness value indicates the more suitable path.As illustrated in Figure 2, we assume k 3, the three disjoint paths between source node node 2 and root node 30 are 2-3-9-15-20-25-28-30, 2-8-13-18-23-30, and 2-7-12-16-21-27-30, respectively.The detailed protocol dealing with routing recovery problem is presented in the following sections.

The Proposed Fault Model and Energy Model
We use the simple fault model proposed in 22 and identify the node failure in it.The faultmodel should be simple enough to analyze, but also sophisticated enough to capture the fault behavior effectively.The probability of sensor nodes failure of subtree is given by p node .As we use the more reliable macronodes to sustain the failure during transmission process, the probability of macronode failure is assumed to be p macro ≈ 0. If any of the sensor nodes fails, our routing recovery approach for node failure in subtree can be implemented.
We introduce the energy model adopted in  where d is the distance from the sensor node to the next-hop node, ene tx m, d and ene rx m are the energy consumption of sending and receiving m bits of data, a 11 , a 2 , and a 12 are energy consumption parameters of sending circuit, sending amplifier, and receiving circuit, and n is the channel attenuation index.We also define ene DF as energy consumption of data fusion and ene RT as energy consumption of updating routing table.For the ICPSOA, we define energy consumption of paticle update, immune clone, mutation, particle selection, and restrain per iteration as ene PU , ene IC , ene IM , ene PS , and ene PR , respectively.So, the total consumption of the ICPSOA is according to the actual iterated generations per round.

Fault-Tolerant Routing Problem Using the ICPSOA
As described in Section 2.2, the ICPSOA is used to provide a fast recovery mechanism from path failure due to physical damage or energy depletion with an alternative path.It chooses a path with optimal fitness from the optional sensor nodes.The ICPSOA is the kernel of our fault-tolerant routing protocol.Its flowchart is shown in Figure 3, and its framework is shown in Algorithm 1.The detailed procedures are described in the following subsections. (

1) Initialization
The principle of the ICPSOA is to search, respectively, in different D-dimensional target spaces using k independent particle swarms.To initialize the algorithm, we set the population size of particle n, the division factor k, and each particle swarm includes n/k particles.Then, the D-dimensional vector vector of particle's position and velocity is divided into k swarms.We define a matrix by D × 2n to represent the initial particle swarm, in which the former n columns are the position of particle, and the latter n columns are the velocity of particle.In  Input: P STo : The information parameters of nodes P Gen : The iterated generations for searching process Output: fitness p i : The global optimal fitness Process: Step 1: Initialization: Generate initial particle swarm parameter.
Step 3: If termination criterion conditions are satisfied, go to Step 5; else go to Step 4. Step 4: Update: Update the velocity and position of each sub-swarm and particle.
Step 5: Output: Output the global optimal fitness of the particle swarm.Ends.

Algorithm 1:
The ICPSOA for fault-routing problem.
Algorithm 2, b g is a complete vector function consisting of all subswarms' optimal position vector, x m S i represents position vector of the mth particle in the ith swarm, p m S i is the optimal history position vector of the mth particle in the ith swarm, and p g S i represents optimal experience position vector of the ith swarm. (

2) Immunization
In this step, each particle can be considered as an antibody, resulting in the clonal mutation set C. The clone number and the fitness of particleare proportional.The clonal number N c is

Input:
P STo : The information parameters of nodes n: The population size of particle k: The population size of swarm Output: S i : The vector of the ith particle swarm b g : Each sub-swarm's optimal position vector function Process: Particle's D-dimensional vector is divided into k particle swarms.b L, i p g S 1 , . . ., p g S i−1 , L, p g S i 1 , . . ., p g S k Algorithm 2: Initialization mechanism in the ICPSOA.
usually calculated as follows: where α is the clone factor and is proportional to particle's fitness value.N is the number of particles.Mutation rule can be setup according to experience.The particle mutation rule for the function optimization problem is where c i is the clonal individual, x i is the original antibody, β represents the mutation factor, and rand is uniformly distributed in 0, 1 .
For the particles replacement rule, we need to calculate the antigen stimulus degree of the original particles and select clonal mutation particles.The Euclidean distance between any particle C t and antigen Y t is

3.5
Therefore, the stimulus degree of antibody particle is After that, each particle is compared with stimulus threshold; the higher one will maintain in the subswarm, and the lower one will be replaced called restrain .The process of this step is as shown in Algorithm 3.Then, go to Step 2 in Algorithm 1.

(3) Termination Criterion
If the solution is satisfied with the termination criterion, fitness p i is the optimal fitness or P Gen decreases to zero, the optimal path p i will be the desired optimal solution, and this procedure ends; otherwise, returns to Step 4 in Algorithm 1.Then, the kth path is established.
Input: n: The population size of particles P Gen : The iterated generations for searching process k: The population size of swarm Output: The allele of the offspring's antibodies particles Process: For Clone operation: N c αN Mutation operation: c i x i βrand Replacement restrain operation: If A i, j > threshold, the particle antibody is replaced End For End For Algorithm 3: Immune mechanism in the ICPSOA.

(4) Update
In this step, the velocity and position of the particle is updated as 2.1 .The process is as shown is Algorithm 4. The updating equation of particles' optimal position vector in each subswarm is as follows: Equation 3.8 indicates that the optimal position of the mth subswarm will select the personal optimal position with the optimal fitness of particle in the swarm.
Inertia weight w plays an important role to the convergence of the result among the adjustable parameters.The larger weight can help the particle escape from the local best solution, and the smaller one is better for the convergence, thus the inertia weight can achieve balance between global search and local search.To overcome the limitations of other general strategies, the linear differential decreasing strategy is used 23

3.9
Input: P STo : The information parameters of nodes S i : The ith particle swarm b L, i : Each sub-swarm's optimal position vector function P Gen : The iterated generations for searching process Output: v t 1 id and x t 1 id : The velocity and position of each sub-swarm and its particle fitness p i : The global optimal fitness Process: For The computational complexity is an important issue in designing our optimization algorithms.In the nth iteration of the ICPSOA, the time to calculate fitness function for immune clone is N c , the time to calculate fitness function for particle mutation and selection is βN c , and the time to calculate fitness function for particle update is tN.So the total calculating time P n in the nth iteration should be Therefore, the computational complexity of the ICPSOA is O N c , which indicates that the size of clone group has a direct impact on the search speed of the ICPSOA with the same size of particle.

The ICPSOA-Based Fault-Tolerant Routing Protocol Framework for H-WSNs
The ICPSOA is the kernel of fault-tolerant routing protocol.As shown in Figure 2, once n fail node 18 fails, the macronode n r node 30 constructs subgraph G G ⊂ G according to the current topology information of nodes and extracts the set of nodes N p which can be used to construct an alternative path p i s, r from G .Each node represents a particle, and the population size of particle is n.Some nodes of N p can form a particle sequence {n p i 1 , n p i 2 , n p i 3 . . ., n p i m } m ≤ n according to their order, which can construct a path p i s, r from source n s to n r .The algorithm ICPSOA would optimize the particle sequence to obtain the optimal path p b s, r with optimal fitness fitness p b , and p b s, r includes the following nodes {n s , n p b 1 , n p b 2 , . . ., n p b m , n r }.Each node owns a routing table recording the paths it belongs to and the nodes' information on these paths.We now demonstrate with an example how the routing recovery process is accomplished in our protocol.In the example Figure 2 , n fail 's child node n fail−c and parent node n fail−p are node 23 and 13.
Step 1. n fail−c reports the failure of n fail to n r , and n fail−p reports the failure to n s node 2 , then n s starts up another backup path to transmit data.n s broadcasts a path request PR packet, with routing table including its own available energy and coordinate.
Step 2. If an intermediate node n i receives PR, it will relay the packet according to its own state of information: if n i is on one of the other existed k − 1 paths between n s and n r , it will ignore the packet; else, n i will calculate dist e , ene e and delay e between n i and n i−1 according to the information provided by n i−1 .Then, it continues to relay packet RP, with routing table including above information, n i and n i−1 's ID, and its ene n .
Step Step 4. If n p b i has received PR ACK, it checks whether its ID is in the packet's routing table.
Then it establishes a connection between child n p b i−1 and parent n p b i 1 and delivers PR ACK to parent until n s receives the packet.Go to Step 5.
Step 5. n s broadcasts packet PR END, and n p b i on p b delivers it to n r .Once n r receives PR END, the kth path from source node to its root in the subtree is established, the network topology is reconstructed, and protocol ends.During this process, n r will broadcast one packet and receive three packets, n s will broadcast two packets and receive two packets, a part of relay nodes n i in the subtree will deliver four packets.We assume the number of hops of p i s, r i ∈ 1, k − 1 is N p i s,r i , then the number of the packets received by n r before running the ICPSOA is In this way the energy consumption of packet receiving and broadcasting of n r can be calculated.

Simulation Model
To evaluate the performance of the ICPSOA, we design a corresponding simulation scenario upon Matlab.The simulation experiment is constructed on Windows XP with Intel Pentium 4 processor 2.4 GHz and 2 GB RAM.The goal of the simulation is to show that the ICPSOA can provide a more stable transport environment in an error-prone network.The results are also compared to the protocols of ICE, CPEQ, and EARQ.
In Table 2, we present the parameters configured for the conducted simulation experiments.The sensor nodes are randomly deployed on area A, and the macronodes are located at known coordinates.500 rounds are taken and five packets are delivered in each round.The size of the network is the same for different algorithms and the fitness function is then measured.The parameters used for the ICPSOA are function dimension D 30, iterated generations P Gen 1000, division factor k 5, clone factor α 4, mutation factor β 0.5.According to the description of the ICPSOA in Section 3.1.

Evaluation of the Simulation Results
To illustrate the effect of the proposed protocol, we take a snapshot during a simulation.Figure 4 shows a small area 2000 m × 2000 m , which illustrates a subtree with the existed three paths between source node node 29 and macronode node 18 .We can see when an intermediate node node 24 fails, source node immediately establishes an alternative path to connect the macronode in order to replace the previous 3rd path.
The simulation ends after 1000 rounds.We compare the number of alive nodes per round for these four protocols.As shown in Figure 5 for different network sizes, the number of nodes died in the ICPSOA, ICE, and CPEQ is less than EARQ over the same number of rounds.This is because comparing with heterogonous WSNs, all the nodes only need to transmit data to its root macronode of the subtree in the H-WSNs, which indirectly shortens the transmission distance between sensor nodes to the sink, and prolongs their lifetime.The fast routing recovery mechanism of the ICPSOA also makes its number of alive nodes 5% ∼ 10% more than that of ICE, and CPEQ in the same rounds.Then, we would only compare the ICPSOA, ICE, and CPEQ with the same network style H-WSNs in the remaining simulation process.As shown in Figure 6 for different network sizes, energy depletion ratio of the ICPSOA based protocol is 5% ∼ 15% smaller than that of ICE and CPEQ.And the dispersion between them is more obvious as the size of the cluster increases.That is because firstly, each source node has k paths to the macronode, and the total energy consumed is minimized; secondly, the ICPSOA can select the nodes with better QoS parameters such as more available energy and less distance of path to establish alternative path and construct a more reliable transmission environment to reduce the retransmission caused by unstable paths, therefore, prolong the network lifetime as compared to ICE and CPEQ. Figure 7 shows the average delay of packet delivery average delay of each packet delivered from source node to the sink .We can observe that the ICPSOA outperforms ICE and CPEQ in terms of average delay for the same networks.The ICPSOA has demonstrated a lower delay when network size grows.A low delay of packets can be explained by the multipath property and shortest alternative path selection of the proposed ICPSOA-based protocol for fault tolerance.

Mathematical Problems in Engineering
Figure 8 a shows that the H-WSNs with the ICPSOA can deliver more packets to the sink than the network with EARQ and ICE with the value of 0.02 of p node .In most cases, the ICPSOA can send 5% ∼ 15% more packets to the sink.A bigger value of packet delivery ratio indicates a lower packet dropout probability 24, 25 and a better network capability of delivering useful information.This result can be explained by the fact that the ICPSOA provides a fast recovery from path failure with an optimal alternative path, which improves the success rate of data transmission.Note that the packets in the ICPSOA experience a higher delivery ratio as the size of the network grows, which indicates the ICPSOA-based protocol of the H-WSNs is more feasible for practical deployment of large-scale WSNs than ICE and CPEQ.
We should also compare the performance trend of the three algorithms with different probability of node failure p node .We plot the packet delivery ratio against the number of nodes in Figure 8 for various p node value of 0.02, 0.05, and 0.08 .As shown in Figure 8 a , 8 b , and 8 c , the observed packet delivery ratio of the proposed schemes degrades as p node Mathematical Problems in Engineering ascends, which means the performance of proposed scheme is reduced as the percentage of failed nodes increases.But the ICPSOA can still deliver more packets than ICE and CPEQ for different size of the sensor network.

Conclusions
We propose the ICPSOA-based fault-tolerant routing protocol for H-WSNs, which focuses on a solution to the problem of energy depletion and packet delivery of nodes, by trying to reconstruct the topology structure and recover the routing for the path failure and achieve energy conservation by avoiding unnecessary retransmission.The conserved energy can be used to increase the quantity of information received by the sink.The experiment presents the promising ability of the ICPSOA, and better solutions of fault tolerance and prolonging the network lifetime can be obtained by the ICPSOA-based protocol than the protocols of EARQ, ICE and CPEQ.The results have illustrated the advantage of H-WSNs and backup disjoint multipath, which can reduce the risk of data delivery loss and energy consumption on the path exploring.It also aims at shortening delay of packet delivery, evening energy dissipation among the nodes by constructing the optimal alternative paths in the H-WSNs with the swarm intelligence algorithm.The strength of the ICPSOA is its simplicity, robustness and effectiveness for fast routing recovery compared to other approaches and makes the ICPSOA a potential solution to meet the requirements of critical conditions monitoring applications.
As for future studies, the following directions are under the way: firstly, the proposed protocol ignores the fault-tolerant routing between macronode-macronode communications, which could be considered to form a more complete protocol architecture; secondly, we should further reduce the computational complexity of the proposed ICPSOA such that it converges faster to a better solution, providing robustness against failure in the network.

Figure 3 :
Figure 3: The architecture of the ICPSOA for the H-WSNs.

7 where 1
S i , i , fitness b x m S i , i ≥ fitness b p m S i , i , b p m S i , i , fitness b x m S i , i < fitness b p m S i , i , 3.≤ i ≤ k.The updating equation of optimal position of each subswarm is b p g S i , i arg

3 .
Each intermediate node in the subtree repeats Step 2 until n r receives the PR.Then n r extracts the information, calculates fitness p i using the ICPSOA and selects the path p b with optimal fitness.Then, it broadcasts packet RP ACK, including the IDs of selected nodes {n p b 1 , n p b 2 , n p b 3 , . . ., n p b n } on p b path 2-8-14-19-24-30 in Figure 2 in routing table.

Figure 4 :Figure 5 :
Figure 4: Snapshot of establishing the alternative path using ICPSOA.

Figure 6 :Figure 7 :
Figure 6: Experimental results for energy depletion ratio per round with variant scale of networks.a Size of 50 nodes.b Size of 250 nodes.

Figure 8 :
Figure 8: Experimental results for average successful packet delivery ratio with variant failure probability.a p node 0.02.b p node 0.04.c p node 0.08.

Table 1 :
The main symbols.
i The ith subtree of the tree of the H-WSNs N STo The number of the sensor nodes in ST i P STs The state information of all the nodes in ST i n s One of the source nodes in ST i n r The root node macronode in ST i P s, r The set of all the possible paths between n s and n r in ST i p i s, r The ith path between n s and n r in ST i n fail The failed relay node of p i s, r in ST i n fail−c The child node of n fail of p i s, r in ST i n fail−p The parent node of n fail of p i s, r in ST i n i The ith sensor node of p i s, r in ST i p b 18, and the equation of energy model of a sensor node is as follows: ene m, d ene tx m, d ene rx m a 11 a 2 d n m a 12 m, 3.2 Update velocity and position of each sub swarm's particleIf fitness b x m S i , i ≥ fitness b p m S i , i , b p m S i , i b x m S i , i Else If fitness b x m S i , i < fitness b p m S i , i , b p m S i , ib p m S i , i Calculate fitness p i of the particle path The metrics that we use in our experiments are average number of alive nodes per round, average energy depletion ratio per round measured as the energy dissipation versus