The two most important factors that must be considered in the wireless sensor networks are energy efficiency and fault tolerance. Multipath routing is an effective method to improve the fault tolerance in wireless sensor networks. By taking the energy consumption into consideration, in this paper, a multipath routing algorithm for the wireless sensor networks based on the genetic algorithm is proposed. The proposed algorithm computes the fitness function by using the distance between nodes in the network and then generates the routing scheme at the base station. The routing scheme is shared with all the nodes of the entire network, to realize the multipath routing for each node. Finally, the simulation experiment is used to verify the validity of our method, and the results show that the routing method in this paper has a better effect.

1. Introduction

The wireless sensor network (WSN) is a wireless network composed of a large number of fixed or mobile sensors in the form of self-organization and multihop [1, 2]. This kind of network covers the information of sensing objects in the geographical area through collaborative sensing, collection, processing and transmission network and finally sends the information to the network owner. In the process of wireless sensor network processing, node energy consumption [3, 4] is an important problem to be considered. Since most of the nodes in wireless sensor networks work through batteries or collected energy, the energy of each node is usually limited. In addition, sensor networks usually work in a harsh environment, so the nodes in the network are prone to failure. Therefore, energy consumption and fault tolerance play an important role in the long-term operation of sensor networks [5]. People have made special research on these two aspects [6, 7].

In the process of message routing in wireless sensor networks, in order to improve fault tolerance, the multipath routing mechanism is usually used to replace the original single path routing mechanism [8, 9]. In multipath routing, packets can be routed through two or more paths, which can reduce the packet loss rate [10, 11]. In addition, multipath routing can reduce packet tampering or malicious attacks in the routing process and improve the security of data transmission [12, 13].

Aiming at the research of wireless sensor network routing, a multipath routing method based on next hop is proposed in [4]. The algorithm transmits messages according to the hierarchical structure of the loop in which the nodes are located and does not consider the energy consumption and multipath problem of the nodes. In [6], a fault-tolerant routing protocol is proposed, which includes error recovery and error detection. The cost function used in this method only depends on the distance between nodes, which may cause some nodes to run out of energy due to extra workload. Therefore, when the next hop route is selected, the energy utilization of sensor nodes will be unbalanced. In order to solve the problem of unbalanced energy consumption in wireless sensor networks, a multipath routing protocol based on three-dimensional space and regional coevolution was proposed in [7]. The protocol divides the one hop neighborhood space of a node into several subspaces through the region partition model and then selects the local optimal node of each subspace according to the region coevolution algorithm to determine the optimal next hop node. In addition, in [14], a multipath cost function model was proposed by comprehensively considering the statistical parameters of energy standardization between nodes, energy consumption on the path, total energy of nodes, and routing hops. Greedy algorithm minimizes the number of nodes in the path by selecting the next hop. However, the abovementioned two methods are not considered from the global optimal, and there is a local optimal problem. In [9], a multipath routing algorithm based on directional diffusion routing algorithm is proposed. The algorithm establishes multiple paths between the source node and the destination node and gives each path a certain selection probability according to the three characteristic values of energy consumption, time delay, and bandwidth of the network link, so that the data are always transmitted in multiple paths and has better link performance. However, this method directly depends on the artificial definition of path probability, which is prone to errors [15].

In the field of multifactor wireless monitoring network, in order to transmit monitoring information efficiently, in [16], the design of multi- routing was optimized in the network, and it was proposed to use gradient-oriented heuristic information to guide the establishment of the routing path, so as to improve the energy efficiency of path establishment. This method is not suitable for general methods because it aims at problems in specific fields. For the demand of data aggregation query in wireless sensor networks, a clustering multipath routing algorithm in wireless sensor networks is proposed in [17]. This method takes into account the residual energy of the node, the deviation angle, the distance between the three in the process of wireless sensor network data transmission, the influence of time delay, the energy consumption in the multipath structure, and other factors. Based on all the neighbors of the sensor node, a comprehensive evaluation is made, but the method of how to obtain the multipath structure is not introduced.

To sum up, there is still a lack of a method to study the global optimal multipath routing from two aspects of fault tolerance [18] and energy consumption [19]. In order to solve this problem, this paper proposes a multipath routing method based on genetic algorithm to improve the fault tolerance of wireless sensor networks. In order to reduce the energy consumption of nodes in the routing process, this method considers the distance parameters between various types of nodes in the network and establishes an effective fitness function. These parameters include the distance between the sending node and the receiving node, the distance from the next hop to the base station, and the number of hops. Finally, the effectiveness of the routing method is verified by simulation analysis. The results show that the proposed routing method has a good effect.

This paper first introduces the problems to be studied and the research status quo, introduces the related concepts of the methods used in the second quarter and the multipath routing method based on genetic algorithm used in the third quarter, and the effectiveness of the method proposed in this paper is verified by experiments in the fourth quarter. Finally, the full text is summarized.

2. The Basic Theory

2.1. Multipath Routing Method

Figure 1 shows a wireless sensor network with 1 base station and 9 relay nodes. There are two different paths for source node 1 in the network: 1 -> 4 -> 5 -> BS and 1 -> 2 -> 6 -> 9 -> BS. Apart from the source node and the destination node, these paths do not have a single middle node. These two paths are called two independent paths of the node.

2.2. Genetic Algorithm

Genetic Algorithm is a computational model that simulates natural selection and biological evolution in the process of biological evolution, and it is a way to search for optimal solutions. Genetic algorithms start by characterizing a population of possible solutions to a problem that consists of individuals encoded by genes. So, each individual can actually be thought of as a characteristic entity with a chromosome. The genetic algorithm follows the principle of survival of the fittest and survival of the fittest. After the initial population is generated, the genetic operator is used for combination crossover and mutation operation to generate the population with new solution set. This process will result in the solution set population such as the natural evolution of the epigenetic population more suitable for the solution of the problem than the previous generation (expressed by fitness function) and, thus, can be used as the approximate optimal solution of the problem.

The multipath routing problem in wireless sensor networks can be regarded as a genetic process. In addition, the energy consumption and fault tolerance of each network node should be considered when searching for a path to choose an optimal path, which can be realized by crossover and mutation operators in genetic algorithms.

2.3. Wireless Sensor Network

The concept used in the wireless sensor network is defined as follows:(1)R = {r1, r2, r3, ..., rm} expresses relay nodes in the wireless sensor network (WSN), which expresses the base station node.(2) defines the spatial distance between node and node .(3)Range defines the relay node communication range(4) indicates a node where the relay node has a message exchange with the node . can be expressed as follows:where and belong to . defines the communication range on the relay node.(5)K represents the number of different paths in the network.(6) represents the next hop from node to the base station node. If can communicate directly with the base station, then . is defined as follows:where , , and belong to .(7)Falt (ri, rj) represents the sum of packets of all errors that occurred during the transmission from the node to the node .(8)Engy (ri, rj) represents the sum of energy consumption on all nodes during the transmission from the node to the node .

2.4. Definition of the Cost Function

Since the routing algorithm proposed in this paper needs to generate a multipath with less energy consumption between all relay nodes and target nodes, the cost function on each path is firstly defined according to the distance between sending nodes and receiving nodes, the distance between the next hop to the base station, and the parameters of hops as follows:where represents the cost required for data transmission from node to node . The selection of the next hop node for any node depends on the cost function, and the next hop node with the lowest cost is selected for routing.

In particular, if a node can communicate directly with the base station node, then the cost function can be directly expressed in the following form:

3. Multipath Routing Method Based on Genetic Algorithm

The following is to introduce the multipath routing method based on genetic algorithm proposed in this paper.

First, chromosomes are used to represent relay nodes in the network, and the length of chromosomes represents the number of paths in the network. For a network with m relay nodes, the length of chromosomes in K multipaths is m × K. For example, for the example in Figure 1, there are nine relay nodes in the network, so if we want to generate two paths from different source nodes to base station nodes, then the length of chromosome is 18.

On a chromosome, the location of each gene represents the location of a node in the network, such as gene 3 represents node 3 in the network. The value of the gene at each location represents the next hop node on the node corresponding to that location. In this way, each chromosome represents a sequence of successive nodes in the network, namely, a path corresponding to a solution in the wireless sensor network. A set of chromosomes is called the initial population. In the present method, a set of effective chromosomes is randomly generated as the initial population of the genetic algorithm. A chromosome is called a valid chromosome if and only if all the paths in the chromosome have no rings and the gene value on the chromosome represents a valid next hop on the corresponding relay node.

The quality of the chromosome is judged by the fitness degree, and the fitness function representing the fitness is defined as follows:where denote the -th and -th relay node and denotes the cost of data transmission from node to node .

The fitness of the chromosomes is calculated by equation (4), and chromosomes with higher fitness are cross operated as the next-generation population. In the crossover operation, two parent chromosomes are selected and their genetic information is exchanged to generate two new child chromosomes. If the swapped child chromosome has a better fitness than the original parent chromosome, then the child chromosome is selected to replace the parent chromosome according to the crossover probability . Otherwise, the resulting chromosome is discarded at the probability of . The crossover probability is defined according to the fitness of the subchromosomes after exchange, and the higher the fitness, the greater the corresponding probability.

In this paper, binary crossover is adopted for evolution. This method first produces two random values , where represents the position of in the chromosome and represents the position of in the chromosome. , where represents the number of relay nodes. Then, during the cross operation, the relay node probability corresponding to the position of and the position of is cross operated.

Finally, through the crossover and mutation operation in the process of genetic algorithm, the route selection in the process of routing is carried out according to the final chromosome obtained. Then, the multipath routing method considering energy consumption and fault tolerance is realized in wireless sensor network. In genetic algorithm, the crossover operation realizes the evolution from nodes in the path to highly adaptable nodes. The mutation operation realizes the evolution of nodes in the path to low-cost nodes and finally realizes the search for the optimal solution.

4. Experimental

4.1. Experiment Introduction

During the experiment, the hardware platform used was the Intel dual-core processor with 3 ghz CPU and 6 GB RAM, and the software platform was MATLAB simulation software based on Windows 8 and implemented based on C language.

An area of 150150 square meter is firstly constructed as an application scenario of the wireless sensor network. The base station is located at the coordinate (75, 75). Other data used in the experiment come from the literature [20, 21]; that is, 10, 20, 30, 40, and 50 relay nodes are randomly generated in the network to form the network system. Each node has a random energy in the range of (0, 0.1). During the operation of the network, each node reduces energy at a fixed rate.

For the execution of genetic algorithm, the initial group of 100 chromosomes was studied, according to the number of nodes, each chromosome 10, 20, 30, 40, and 50 genes, and genes in each position value according to the length of the chromosome, respectively, from (0, 10), (0, 20), (0, 30, 40 (0), and (0, 50) within the scope of random generation. For cross operation, the roulette wheel selection model was adopted to select the top 8% of chromosomes with the best fitness for cross evolution. After completing the crossover operation, the uniform mutation operation (mutation probability set at 5%) is adopted to strengthen these chromosomes and conducted the multipath route lookup during the experiment.

4.2. Experimental Results and Analysis

The network system formed by 40 relay nodes is firstly selected to analyze the multipath routing scheme based on the genetic method in this paper. The experimental results are shown in Figure 2. In the figure, the X-axis and Y-axis, respectively, represent spatial positions, and the position of relay nodes in the grid is randomly generated. Through the algorithm proposed in this paper, two multipath routing solutions with the lowest energy consumption can be found out. In this routing scheme, the total energy consumption on the network node is 1.2 and 1.5, respectively, when the message can be delivered from the source node to the base station node. In addition, the data under the two path routing schemes can all be sent to the base station without causing data loss.

In addition, various network systems with 10, 20, 30, 40, and 50 relay nodes randomly distributed in the network space are also analyzed and simulation experiments are carried out for the number of active nodes and node energy consumption in the network system with different number of relay nodes.

As can be seen from Figure 3, with the increase of round in various network systems, the number of active nodes in the network will decrease. In a network with more nodes, the rate of decline of active nodes is faster. This is because for each simulation step of a network run, the energy on each relay node decreases at the same rate as defined in advance. However, the more nodes there are, the more likely there will be nodes running out of energy in the network, resulting in a more rapid decline rate of active nodes in the whole network.

The experimental results of energy consumption of nodes in the network are shown in Figure 4. As can be seen from the experimental results, with the increase of the number of simulation steps, the consumption of nodes in the network will increase. Moreover, in the whole experiment process, the network with more nodes consumes more total energy, which is consistent with the experimental results in Figure 3.

In addition, for network systems with 10 and 20 relay nodes in the network, the two types of systems tend to balance the capabilities consumed in the network after 500 simulation steps. This is because at this time, all nodes in the network have exhausted their energy, and thus, there is no more energy to be consumed in the whole network.

5. Conclusions and Future Work

In wireless sensor networks, node energy consumption is an important issue to be considered. This paper proposes a multipath routing method based on genetic algorithm for wireless sensor networks, which improves the fault tolerance of the network and reduces the energy consumption of nodes in the routing process. Then, considering the distance parameters between different types of nodes in the network, an effective fitness function is established. These parameters include the distance between the sending node and the receiving node, the distance from the next hop to the base station, and the number of hops. Finally, the effectiveness of the method is verified by simulation analysis.

Because there is a certain gap between theory and practice, the future work will be to verify whether the algorithm can also achieve the desired effect in practical application through experiments.

Data Availability

The labeled dataset used to support the findings of this study is available from the corresponding author upon request.

Conflicts of Interest

The author declares no conflicts of interest.


The author thanks Tangseng Huang for his contributions to the typesetting and proofreading of the text of this article. This work was supported by the CERNET Innovation Project (NGII20190121) and Shaanxi Province Soft Science Research Plan Project (2021 krm117).