Multi-Path Routing Algorithm for Wireless Sensor Network Based on Semi-Supervised Learning

Multi-path transmission can well solve the data transmission reliability problems and life cycle problems caused by single-path transmission. However, the accuracy of the routing scheme generated by the existing multi-path routing algorithms is difficult to guarantee. In order to improve the accuracy of the multi-path routing scheme, this paper innovatively proposes a multi-path routing algorithm for a wireless sensor network (WSN) based on the evaluation. First, we design and implement the real-time evaluation algorithm based on semi-supervised learning (RESL). We prove that RESL is better in evaluation time and evaluation accuracy through comparative experiments. Then, we combine RESL to design and implement the multi-path routing algorithm for wireless sensor networks based on semi-supervised learning (MRSSL). Then, we prove that MRSSL has advantages in improving the accuracy of the multi-path routing scheme through comparative experiments.


Introduction
Wireless sensor networks consist of a large number of sensor nodes. These sensor nodes use wireless communication to form a multi-hop self-organizing network system, so as to realize cooperative sensing, collection and processing of the information of sensing objects in the geographical area covered by the network [1].
The structure of wireless sensor network is generally simple, as shown in Figure 1. The data transmission of the whole network is mainly the transmission process between the sink node and the source sensor node. Multi-path transmission can well solve the data transmission reliability problems and life cycle problems caused by single-path transmission [4]. References [4,5] have proposed solutions to the problems caused by single-path transmission. Reference [5] proposed a graph routing algorithm with enhanced lifecycle (hereinafter referred to as QGRLE). The algorithm effectively alleviates the life cycle problem and considers the reliability of data transmission but does not effectively solve the problem of data transmis- In the process of designing the traditional routing method of the wireless sensor network, the optimal path from the source sensor node to the sink node is generally 2 of 11 used for data transmission. There are many problems with the traditional single-path transport mechanism. First, single-path transmission cannot guarantee the reliability of data transmission. Once the current path fails, the reliability of data transmission cannot be guaranteed because there is no backup path available. The rerouting caused by this consumes more (communication) energy, which is undoubtedly fatal to sensor nodes that are already short of energy. Second, single-path transmission puts more pressure on the network. If a large amount of data needs to be transmitted between the source sensor node and the sink node, blindly relying on a certain path for data transmission will make the energy consumption of each network node vary greatly. It often causes premature aging of some nodes [2], which eventually leads to a shortened network life cycle [3].
Multi-path transmission can well solve the data transmission reliability problems and life cycle problems caused by single-path transmission [4]. References [4,5] have proposed solutions to the problems caused by single-path transmission. Reference [5] proposed a graph routing algorithm with enhanced lifecycle (hereinafter referred to as QGRLE). The algorithm effectively alleviates the life cycle problem and considers the reliability of data transmission but does not effectively solve the problem of data transmission reliability. Reference [4] proposed a classical energy multi-path routing mechanism (hereafter referred to as CEMRM). The mechanism establishes multiple paths between the source node and the destination node and assigns a certain selection probability to each path according to the communication energy consumption of the nodes on the paths and the remaining energy of the nodes. This mechanism effectively alleviates life cycle issues and data transmission reliability issues. Reference [6] proposed a multi-path routing algorithm based on the genetic algorithm, which dynamically selects the optimal path with the minimum distance and minimum energy dissipation according to the cost function. Reference [7] proposed a multi-path routing algorithm based on quadratic programming. The algorithms proposed in references [6,7] can reduce energy consumption and routing overhead, but they are difficult to ensure the accuracy of the routing scheme.
Compared with single-path transmission, multi-path transmission has obvious advantages. However, the accuracy of the routing scheme generated by the existing multi-path routing algorithms is difficult to guarantee [8]. After the multi-path routing scheme is generated, the paths are selected in order for data transmission. Each additional selection is a waste of energy, and an inaccurate routing scheme will lead to a large amount of energy waste. The node energy in wireless sensor networks is limited, so the accuracy of the routing scheme is very important, but the existing schemes have not been deeply researched on this problem.
For the accuracy of the routing scheme, this paper considers using evaluation to improve the accuracy of the routing scheme. We evaluate the initial routing scheme immediately after it is generated and make adjustments to the schemes with abnormal evaluation (that is, the routing scheme is inaccurate), thereby effectively improving the accuracy of the final routing scheme. At present, the common algorithms used to evaluate routing schemes include fuzzy evaluation algorithm [9], adaptive evaluation algorithm [10] and so on.
Multi-path transmission can well solve the problems caused by single-path transmission. However, existing multi-path routing algorithms are difficult to ensure the accuracy of the generated routing scheme. The innovation of this paper is to solve the problem of low accuracy of multi-path routing schemes in wireless sensor networks (WSN) by means of evaluation.
The main research contents are as follows: (1) Section 2 covers the design and implementation of the real-time evaluation algorithm based on semi-supervised learning (RESL) with the goal of reducing evaluation time and improving evaluation accuracy. Then, we compare RESL with the two evaluation algorithms proposed in references [9,10]. The experimental results show that RESL is better in evaluation time and evaluation accuracy.
(2) Section 3 combines RESL to design and implement the multi-path routing algorithm for wireless sensor networks based on semi-supervised learning (MRSSL). Then, we compare MRSSL with the two wireless sensor network multi-path routing algorithms proposed in references [4,5]. The experimental results show that MRSSL is better in the accuracy of the routing scheme.

Real-Time Evaluation Algorithm Based on Semi-Supervised Learning (RESL)
In this section, we design and implement the real-time evaluation algorithm based on semi-supervised learning (RESL). We verify the advantages of this algorithm in reducing evaluation time and improving evaluation accuracy through comparative experiments.

Algorithm Design and Implementation
In order to improve the applicability of the evaluation algorithm (applicable to singlepath transmission and multi-path transmission), this section considers converting the routing scheme into a single piece of data and performs real-time evaluation. When a node generates a routing scheme, routing scheme is converted into a single piece of data before transmitting data according to the scheme. To determine whether the data is abnormal is to evaluate in real time whether the routing scheme is feasible.
To improve evaluation accuracy and further reduce evaluation time, we employ machine learning algorithms to evaluate the routing scheme.
Unlabeled samples are more readily available than labeled samples. Since supervised learning requires all training data to be labeled, we chose semi-supervised learning with only a few labeled samples. Since there are only two types of labels, abnormal and nonanomalous, we chose a semi-supervised learning algorithm suitable for binary classification problems. Here, we chose the Semi-Supervised Support Vector Machine (S3VM). This type of algorithm has the following advantages: (1) There are less restrictions on the form of input data, which is conducive to reuse and training data generation. (2) The storage overhead is low, which is beneficial for us to process large-scale data. (3) It is simple and effective. Compared with other semi-supervised learning algorithms, the latency is relatively low, which can properly compensate for the timeliness shortcomings of evaluation methods.
The classic algorithm in the semi-supervised support vector machine is the Transduction Support Vector Machine (TSVM) [11].
In Equation (1), ξ is the relaxation vector; C n and C m are user-defined parameters for balancing the importance of labeled samples and unlabeled samples; (ω, b) determines a dividing hyperplane. TSVM continuously tries to assign labels to unlabeled samples, and the goal is to determine the partitioning hyperplane that maximizes the separation over all samples.
The flow of TSVM is shown in Algorithm 1. Algorithm 1 obtains the predicted labels for unlabeled samples and a final SVM model (hereinafter referred to as the TSVM model), which can be used to predict new samples.
We generate the initial multi-path routing scheme according to the wireless sensor network multi-path routing algorithm proposed in reference [4]. The scheme includes p paths sorted according to the selection probability from large to small, and each path must have a node with the smallest remaining energy. The unlabeled samples in this paper contain the energy consumption and remaining energy of these p nodes. Algorithm 1: TSVM 1: Input: labeled sample set D n = {(x 1 , y 1 ), (x 2 , y 2 ), . . . , (x n , y n )}, 2: unlabeled sample set D m = {x n+1 , x n+2 , . . . , x n+m }, 3: parameters C n and C m 4: Initialize C n and C m , C n C m ; 5: Train an initial model SVM0 with D n ; 6: Predict the label of D m with SVM0, obtainŷ = ŷ n+1 ,ŷ n+2 , . . . ,ŷ n+m ; 7: While C m < C n 8: Knowing D n , D m , C n , C m andŷ, obtain (ω, b) and ξ according to formula 1; 9: Knowing D n , D m , C n , C m andŷ, obtain (ω, b) and ξ according to formula 1; 13: End while 14: C m = min{2C m , C n }; 15: End while 16: Output:ŷ = ŷ n+1 ,ŷ n+2 , . . . ,ŷ n+m , TSVM = SVM final Due to the different training data sets (including labeled samples and unlabeled samples) corresponding to different p and the high cost of manually obtaining training data, it is difficult for us to obtain enough training data for all possible p. To ensure efficient operation of TSVM and avoid overfitting, we need to ensure that there is enough training data. Therefore, we employ data augmentation to improve TSVM in an attempt to effectively augment the training data.
Supervised data augmentation is to expand more labeled data from the original labeled data through some transformation method, and then use the original data and augmented data to jointly train the model. The current general method is to fit the real sample distribution by adding sample points to continuous discrete sample points. We build on this idea for data augmentation in semi-supervised tasks.
We expand positive labeled samples, negative labeled samples and unlabeled samples, respectively. We leave the markup the same and expand in the same way. The expansion method is to insert a sample point x new into the two discrete sample points x i and x j , and the calculation method of the interpolation is as shown in Equation (2).
In Equation (2), α and β are user-defined parameters, which are generally set to 0.5. The flow of data enhancement for TSVM is shown in Algorithm 2. It is assumed that the routing scheme involves p paths in total, and each path has a minimum residual energy node, so the scheme includes p minimum residual energy nodes. The energy consumption of the i-th node is load i , and the remaining energy is free i . The scheme to be checked is x = load 1 , free 1 , · · · , load p , free p . The label y equal to 1 indicates that x is abnormal. The equation for determining the label is Equation (3). When the load ratio of a node exceeds a predetermined threshold (which may cause the node to fail) or the variance of the load of all nodes exceeds a predetermined threshold (indicating that the energy distribution is unreasonable, which may eventually lead to node failure), the logical value of Equation (3) is 1, that is, x is abnormal. parameters C n and C m 5: Initialize C n and C m , C n C m ; 6: // Expand labeled samples 7: Train an initial model SVM0 with D n ; 8: Split D n into D n+ and D n− according to the positive or negative of y, and the number of samples are recorded as n+ and n− 9: Perform high-dimensional clustering on the de-labeled sample sets of D n+ and D n− ; 10: FOR k = 1 to n + /10 11: Randomly select a pair of samples x i , x j from the largest cluster of D n+ ; 12: Generate x new according to Equation (2) Combining Algorithms 1 and 2, we design and implement the real-time evaluation algorithm based on semi-supervised learning (RESL), whose flow is as in Algorithm 3.
When the training data is not enough to train an effective model, use formula (3) to obtain the label; when the training data is enough to train the model but not enough to train a better model, the label is obtained after the data is enhanced; when the training data is enough to train a good model, the label is obtained directly.

Comparative Experiment
Taking time and accuracy as evaluation indicators, we compared the evaluation algorithm (RESL) proposed in this paper with the evaluation algorithm proposed in references [9,10]. The fuzzy evaluation algorithm (FEA) proposed in reference [9] has a very low evaluation time, but the evaluation accuracy is not high; the adaptive evaluation algorithm (AEA) proposed in reference [10] has a high evaluation accuracy, but the evaluation time is not low.

Algorithm 3: Real-time evaluation algorithm based on semi-supervised learning (RESL)
1: Read the training data set according to the number of paths p involved in the routing scheme; 2: Input: labeled sample set D n = {(x 1 , y 1 ), (x 2 , y 2 ), . . . , (x n , y n )}, 3: unlabeled sample set D m = {x n+1 , x n+2 , . . . , x n+m }, 4: the scheme to be checked x 5: IF (n < 100) (m < 400) 6: Determine whether x is abnormal according to Equation (3) We measured and recorded the evaluation time and evaluation accuracy of the three algorithms for the same multi-path routing scheme.

Evaluation accuracy
We conducted a total of 500 trials and the results are shown in Table 1. We used three algorithms to measure each of the 50 sets of data corresponding to p = 1~10 and recorded the evaluation accuracy. If the path is selected more than twice (that is, the top two paths are not feasible), the actual result of the routing scheme is abnormal. We converted the routing plan to the corresponding data to be checked and used three evaluation algorithms to evaluate the data to be checked to obtain the judgment result (whether it is abnormal). If the judgment result is the same as the actual result, the evaluation is regarded as accurate. Since FEA and AEA both evaluate the multi-path routing scheme multiple times, if at least one abnormality occurs in the multiple evaluations, the judgment result is abnormal.
Plot Table 1 as Figure 2. It can be seen from Figure 2 that the evaluation accuracy of RESL is much higher than that of FEA and slightly higher than that of AEA.  Figure 2. It can be seen from Figure 2 that the evaluation accuracy of RESL is much higher than that of FEA and slightly higher than that of AEA.

Evaluation time
We conducted a total of 150 trials and the results are shown in Table 2. We used three algorithms to measure each of the 50 sets of data corresponding to p = 1~10 and recorded the running time of the evaluation algorithm.
Since both FEA and AEA are single-path evaluations, they need to perform multiple evaluations for the multi-path solution, so their evaluation time counts the total time of multiple evaluations.

Evaluation time
We conducted a total of 150 trials and the results are shown in Table 2. We used three algorithms to measure each of the 50 sets of data corresponding to p = 1~10 and recorded the running time of the evaluation algorithm.  169 9, 9, 9,9, 9 180, 180, 180, 179, 180 p = 10 180, 180, 180, 180, 180 10, 10, 10, 10, 10 200, 200, 199, 199, 200 Since both FEA and AEA are single-path evaluations, they need to perform multiple evaluations for the multi-path solution, so their evaluation time counts the total time of multiple evaluations.
Plot Table 2 as Figure 3. It can be seen from Figure 3 that the algorithm running time of RESL is lower than AEA but higher than FEA.
Although FEA has a great advantage in algorithm running time, its evaluation accuracy is not high. The time cost of evaluating errors introduced (rerouting time, etc.) is much higher than the running time of evaluating algorithms. Therefore, the overall evaluation time of using FEA in an evaluation-based routing algorithm is unstable and extremely time-consuming. 179, 169, 169, 169, 169 9, 9, 9,9, 9 180, 180, 180, 179, 180 p = 10 180, 180, 180, 180, 180 10, 10, 10, 10, 10 200, 200, 199, 199, 200 Plot Table 2 as Figure 3. It can be seen from Figure 3 that the algorithm running time of RESL is lower than AEA but higher than FEA. Although FEA has a great advantage in algorithm running time, its evaluation accuracy is not high. The time cost of evaluating errors introduced (rerouting time, etc.) is much higher than the running time of evaluating algorithms. Therefore, the overall evaluation time of using FEA in an evaluation-based routing algorithm is unstable and extremely time-consuming.

Assumption 1: Given that the running time of the algorithm is t, the evaluation accuracy is c and the time introduced by the evaluation error is f.
The evaluation time T for evaluating the routing scheme is defined as Equation (4).
Given different f, we combine Tables 1 and 2 to obtain the evaluation time of the three algorithms, as shown in Figure 4.
It can be seen from Figure 4 that the evaluation time of RESL is lower than that of FEA and AEA. Assumption 1: Given that the running time of the algorithm is t, the evaluation accuracy is c and the time introduced by the evaluation error is f.
The evaluation time T for evaluating the routing scheme is defined as Equation (4).
Given different f, we combine Tables 1 and 2 to obtain the evaluation time of the three algorithms, as shown in Figure 4. In conclusion, RESL outperforms the two comparison algorithms in evaluation time and evaluation accuracy. (1) Compared with FEA with extremely low algorithm running time, the evaluation accuracy of RESL is much higher than that of FEA. Although the algorithm running time of RESL is higher than that of FEA, the evaluation time is lower than that of FEA. (2) Compared with AEA, which has a higher evaluation accuracy, the evaluation accuracy of RESL is slightly higher than that of AEA and the evaluation time is lower than that of AEA. It can be seen from Figure 4 that the evaluation time of RESL is lower than that of FEA and AEA.
In conclusion, RESL outperforms the two comparison algorithms in evaluation time and evaluation accuracy. (1) Compared with FEA with extremely low algorithm running time, the evaluation accuracy of RESL is much higher than that of FEA. Although the algorithm running time of RESL is higher than that of FEA, the evaluation time is lower than that of FEA. (2) Compared with AEA, which has a higher evaluation accuracy, the evaluation accuracy of RESL is slightly higher than that of AEA and the evaluation time is lower than that of AEA.

Semi-Supervised Learning (MRSSL)
In this section, we design and implement a semi-supervised learning-based multipath routing algorithm for wireless sensor networks (MRSSL). We prove that the algorithm has significant effect in improving the accuracy of the routing scheme through comparative experiments.

Algorithm Design and Implementation
The basic idea of MRSSL is to use the RESL proposed in Section 2 (i.e., Algorithm 3) to evaluate the multi-path routing scheme, and then adjust the scheme that evaluates abnormally (i.e., y = 1) until the evaluation is normal (i.e., y = 0) or end of iteration.
According to this idea, we designed and implemented the multi-path routing algorithm for wireless sensor networks based on semi-supervised learning (MRSSL), whose flow is shown in Algorithm 4.

Algorithm 4:
Multi-path routing algorithm for wireless sensor networks based on semi-supervised learning (MRSSL) 1: Generate the initial multi-path routing scheme x according to the wireless sensor network multi-path routing algorithm proposed in reference [4]; 2: Read the training data set according to the number of paths p involved in the routing scheme; 3: Input: labeled sample set D n = {(x 1 , y 1 ), (x 2 , y 2 ), . . . , (x n , y n )}, 4: unlabeled sample set D m = {x n+1 , x n+2 , . . . , x n+m }, 5: parameter N 6: FOR n = 1 to N 7: Perform Algotithm 3, obtain y; 8: IF y = 0 9: break out; 10: Else 11: make an adjustment to x; 12: END IF 13: END FOR 14: Output: final x The initial scheme in Algorithm 4 is x = load 1 , free 1 , · · · , load p , free p . Every time the scheme is adjusted, the value pairs are reordered (load i , free i ). The abnormality of the initial scheme indicates that the top two paths in the scheme are infeasible, so the constraint condition of the adjustment scheme is to adjust the top two value pairs of the initial scheme to the end.
The output of Algorithm 4 is the final multi-path routing scheme. The multiple paths in the routing scheme are ordered from high to low probability of selection.

Comparative Experiment
In order to verify the advantages of MRSSL in improving the accuracy of multi-path routing schemes, we compared it with two classical multi-path routing algorithms (CEMRM proposed in [4] and RMBDP proposed in [5]).
We tested the routing schemes generated by three multi-path routing algorithms. In each test, the existence of feasible paths in the top two paths in the routing scheme indicates that the scheme is feasible. We grouped 50 different tests as a set and recorded the average feasibility rate. We conducted ten groups of tests, and the experimental results are shown in Table 3 (corresponding to Figure 5). The higher the average feasible rate of the routing scheme, the higher the accuracy of the routing scheme.  Executing the same number of schemes multiple times, a higher scheme feasibility rate indicates that there is a higher probability of including a feasible scheme, indicating that the scheme accuracy is higher.
It can be seen from Figure 5 that the average feasibility rate of the scheme generated by MRSSL is higher than that of the two comparison methods, indicating that MRSSL has advantages in improving the accuracy of the multi-path routing scheme.

Conclusions
Multi-path transmission can well solve the problems caused by single-path transmission. However, existing multi-path routing algorithms make it difficult to ensure the accuracy of the generated routing scheme. The innovation of this paper is to solve the problem of low accuracy of multi-path routing schemes in wireless sensor networks (WSN) by means of evaluation. First, we designed and implemented the real-time evaluation algorithm based on semi-supervised learning (RESL). We proved that RESL is better in evaluation time and evaluation accuracy through comparative experiments. Then, we combined RESL to design and implement the multi-path routing algorithm for wireless sensor networks based on semi-supervised learning (MRSSL). We proved that MRSSL has ad- Executing the same number of schemes multiple times, a higher scheme feasibility rate indicates that there is a higher probability of including a feasible scheme, indicating that the scheme accuracy is higher.
It can be seen from Figure 5 that the average feasibility rate of the scheme generated by MRSSL is higher than that of the two comparison methods, indicating that MRSSL has advantages in improving the accuracy of the multi-path routing scheme.

Conclusions
Multi-path transmission can well solve the problems caused by single-path transmission. However, existing multi-path routing algorithms make it difficult to ensure the accuracy of the generated routing scheme. The innovation of this paper is to solve the problem of low accuracy of multi-path routing schemes in wireless sensor networks (WSN) by means of evaluation. First, we designed and implemented the real-time evaluation algorithm based on semi-supervised learning (RESL). We proved that RESL is better in evaluation time and evaluation accuracy through comparative experiments. Then, we combined RESL to design and implement the multi-path routing algorithm for wireless sensor networks based on semi-supervised learning (MRSSL). We proved that MRSSL has advantages in improving the accuracy of the multi-path routing scheme through comparative experiments.
The method proposed in this paper can be well applied to the routing of WSN. In the research process, there are still shortcomings: (1) Due to the limited training data and time-consuming acquisition, the evaluation method proposed in this paper can only be a semi-supervised algorithm with lower evaluation accuracy. Later, if a lot of time can be used to further improve the training data, it can be replaced with a supervised algorithm with a higher evaluation accuracy. (2) Whether the method proposed in this paper is applicable to other network areas should be explored in the next work.