4.1. Results of Benchmark Functions
This paper uses 28 classical mathematical test functions from CEC2013 to verify the performance of the new algorithm. CEC2013 has a total of 28 test functions. F1–F5 are ordinary unimodal functions. F6–F20 are some basic multimodal functions that can effectively detect whether the algorithm can escape from the local optimal solution. Moreover, F21–F28 are some complex functions, which can effectively test the global search ability of the algorithm. All experiments have been tested and executed using the Matlab R2018a, laptop computer running Windows 10 64-bit with an Intel Core i7-8750H 2.20 GHz processor and 8.00 GB RAM.
To evaluate the performance of the new algorithm in detail, we compare OPGTO with the traditional optimization algorithms PSO, WOA, SCA and the original GTO algorithm.
Table 1 describes the initial parameters [
32,
40] for these comparison algorithms. In order to ensure the fairness of the test, each algorithm is independently run 20 times under the same hardware environment to obtain the average value, which represents the performance of the algorithm.
The OPGTO algorithm proposed in this paper uses opposition-based learning for expanding the search range and two communication strategies for communication. The first communication strategy of OPGTO is multi-group merge communication strategy, which reduces the number of groups from 4 to 1. Since the number of iterations is 2000, set
R to 700. The second communication strategy of OPGTO is multi-group competition communication strategy (OPGTOS2), which requires multiple individuals to gradually approach the optimal individual. So
R is set to 100 and
R is set to 250. In this way, inter-group communication is more frequent and the algorithm is more likely to escape from local optimal solutions. Algorithm 1 introduces the execution process of OPGTOS1 and Algorithm 2 introduces the execution process of OPGTOS2.
Algorithm 1 OPGTOS1 |
Input: The maximum number of iterations T, the population size N, the lower boundary lb, the upper boundary ub, the dimension dim, the objective function fobj; |
1: | Initialization: Generate the individual . |
2: | %Opposition-based learning |
3: | Calculate the opposition-based individual using Equation (14). Select N individuals with the best fitness from X and X; |
4: | Divide the population into g groups, every group is ; |
5: | The best gorilla in each group is Group(j).silverback and its fitness value is Group(j).bestfit; |
6: | t = 1; |
7: | while t < T do |
8: | %Multi-group merge communication strategy |
9: | if t == R then |
10: | j = 0 |
11: | for i = 1:2:g do |
12: | j = j + 1 |
13: | Merge groups |
14: | %Update the optimal individual for each group |
15: | Group(j).silverback = BestGorilla |
16: | Group(j).bestfit = BestFitness |
17: | end for |
18: | g = g/2 |
19: | end if |
20: | for i = 1:g do |
21: | Update Group(i) using GTO |
22: | Mutate Group(i).silverback using Equation (15) |
23: | Select the best fit individual from Group(i).silverback and Group(i).silverback |
24: | %Update the optimal individual for the entire population |
25: | if Group(i).BestFitness<BestGorilla then |
26: | BestGorilla=Group(i).silverback |
27: | BestFitness=Group(i).bestfit |
28: | end if |
29: | if t > 100 then |
30: | Opposition-based learning with sliding window strategy |
31: | end if |
32: | end for |
33: | end while |
Output:BestGorilla and BestFitness. |
Algorithm 2: OPGTOS2 |
Input: The maximum number of iterations T, the population size N, the lower boundary lb, the upper boundary ub, the dimension dim, the objective function fobj; |
1: | Initialization: Generate the individual . |
2: | %Opposition-based learning |
3: | Calculate the opposition-based individual using Equation (14). Select N individuals with the best fitness from X and X; |
4: | Divide the population into g groups, every group is ; |
5: | The best gorilla in each group is Group(j).silverback and its fitness value is Group(j).bestfit; |
6: | t = 1; |
7: | while t < T do |
8: | %Multi-group competition communication strategy |
9: | for i = 1:g do |
10: | if t == R then |
11: | Randomly select some individuals in Group(i) |
12: | Mutate the selected individuals using Equation (18) |
13: | Update Group(i).silverback using Equation (19) |
14: | end if |
15: | if t == R then |
16: | Update BestGorilla using Equation (20) |
17: | Update Group(i).silverback using Equation (21) |
18: | end if |
19: | end for |
20: | for i = 1:g do |
21: | Update Group(i) using GTO |
22: | %Update the optimal individual for the entire population |
23: | if Group(i).BestFitness<BestGorilla then |
24: | BestGorilla=Group(i).silverback |
25: | BestFitness=Group(i).bestfit |
26: | end if |
27: | if t > 100 then |
28: | Opposition-based learning with sliding window strategy |
29: | end if |
30: | end for |
31: | end while |
Output:BestGorilla and BestFitness. |
In the experiment, in order to test the optimization ability of the new algorithm in different dimensions, the new algorithm and the comparison algorithm were tested in 10, 30 and 50 dimensions respectively. In
Table 2, all algorithms are tested in 10 dimensions. Compared to other algorithms, OPGTOS1 achieves 16 better solutions and 2 identical solutions, while OPGTOS2 achieves 7 better solutions and 2 identical solutions. Compared with the GTO algorithm, OPGTOS1 achieved 24 better solutions and 2 identical solutions, and OPGTOS2 achieved 22 better solutions and 2 identical solutions, which shows that the improved strategy proposed in this paper is effective.
As shown in
Table 3, all algorithms are tested in 30 dimensions. Among the 28 tested functions, OPGTOS1 achieves 10 better solutions and 2 identical solutions, while OPGTOS2 achieves 8 better solutions and 1 identical solution compared to other algorithms. Compared with the GTO algorithm, OPGTOS1 has achieved 20 better solutions and 2 identical solutions, and OPGTOS2 has achieved 21 better solutions and 1 identical solution. In order to analyze the iterative process of different algorithms more clearly, the experiment records the data of the optimal solution every 100 iterations in detail in 30 dimensions and draws it as
Figure 6,
Figure 7 and
Figure 8. In these figures, the horizontal axis is the number of iterations of the algorithm and the vertical axis is the optimal solution for the corresponding number of iterations.
According to
Table 3, and
Figure 6, the experimental results show that multi-group merge communication strategy is the best choice for finding the optimal value of a unimodal function. The test results of functions F1, F3, F4 and F5 show that the optimal value searched by OPGTOS1 is much smaller than the traditional optimization algorithm and the original GTO algorithm. Especially in function F4, the convergence speed of OPGTOS1 increases significantly around 700 generations and 1400 iterations, because the algorithm performs group merging every 700 generations. Experiments show that the merged group not only inherits the advantages of the original group, but also achieves effective mutation.
OPGTOS1 and OPGTO2 perform extremely well when solving multimodal functions. For functions F11 and F12, OPGTOS2 not only has the fastest convergence speed and convergence stability, but also achieves the optimal value far smaller than other algorithms, which indicates that the algorithm has strong global exploration ability. In the mutation and update phase of strategy 2, many individuals will learn from the optimal individual, which is beneficial for the algorithm to quickly approach the optimal solution. In the test functions F13 and F14, compared with other algorithms, both OPGTOS1 and OPGTO2 achieve better optimal solutions. For functions F15 and F16, OPGTOS1 has the fastest convergence speed and the most suitable solution. It can be seen from
Figure 7 that strategy 1 converges quickly when merging groups, which indicates that the merging operation brings more possibilities for the algorithm to find the optimal solution.
F21–F28 belong to more complex combinatorial functions, and in the experimental results of these functions, OPGTOS1 and OPGTOS2 have achieved all the leading positions. In functions F22–F26, the solution found by OPGTOS1 is much smaller than other algorithms. It can be seen from the
Figure 8 that OPGTOS1 will have some rapid declines on the convergence curves of these functions, which indicates that the Gauss-Cauchy mutation strategy has achieved good results, and the algorithm has found a better solution. Among the functions F27 and F28, OPGTOS2 has the fastest convergence speed, and the obtained optimal solution is also the smallest.
In
Table 4, all algorithms are tested in 50 dimensions. Compared to other algorithms, OPGTOS1 achieves 12 better solutions and 1 identical solution, and OPGTOS2 achieves 7 better solutions. Compared with the GTO algorithm, OPGTOS1 achieved 20 better solutions and 1 identical solution, and OPGTOS2 achieved 18 better solutions. OPGTOS1 shows far better performance than other optimization algorithms on single-modal functions and complex combination functions, and OPGTOS2 has better performance on multi-modal functions.
We take the average solution time of each algorithm for all functions of CEC2013 as the resource consumption of the algorithm. In
Table 5, PSO, WOA, and SCA have simple exploration and development mechanisms, so the average solution time of the algorithm is shorter, but the optimal solution is poor. GTO has more complex operations, which leads to longer solution times. Compared with GTO, our proposed OPGTOS1 and OPGTOS2 have more mutation and update mechanisms. Although the resource consumption of the algorithm increases, a more suitable optimal solution is obtained.
4.2. Simulation Results of OPGTO in 3D Localization
In this section, OPGTO is applied to optimize node localization in a piece of actual 3D terrain. The terrain chosen for the experiment is Bijia Mountain in Qingdao. The terrain of this mountain is complex and rugged with peaks, ravines and valleys. It is very suitable for simulating node localization in real terrain and can also test various performances of the algorithm more efficiently. The 3D terrain used in this paper is first extracted using Google Maps and then drawn using Matlab, as shown in
Figure 7. When a node in WSN communicates with other nodes in the area, the node may not be able to communicate properly. The reason may be that the communication distance exceeds the transmission distance of the node or the signal will be blocked by objects on the mountain. Therefore, we need to first detect whether the nodes can communicate normally. In three-dimensional space, the communication range of sensor nodes resembles a sphere. If the communication distance between two nodes is greater than the transmission distance of the nodes, it indicates that the communication ranges of the two nodes do not cover each other. As a result, the nodes cannot communicate properly. Then using the LOS method, we can effectively determine whether there are obstacles between nodes.
Figure 9 shows the result of this process,
x,
y and
z represent the three-dimensional space coordinates of a point in the terrain.
In
Figure 10, 25 anchor nodes and a randomly generated unknown node are included. The green square represents an unknown node, the black marker represents the anchor node that the unknown node can communicate with normally, and the red marker represents the anchor node that the unknown node cannot reach. In order to represent the localization error, the fitness function calculation formula is proposed in this paper as follows:
In Equation (
27),
error is calculated by Equation (
24) and
N represents the number of anchor nodes that the unknown node can communicate normally. The experiment sets 25 anchor nodes, which are uniformly distributed in a 3D terrain of size 100 × 250 × 250. To comprehensively test the performance of OPGTO in TDOA, we randomly sprinkle unknown nodes into the terrain and locate them. At the same time, we change the signal transmission distance of the node and detect the change of localization error under different transmission distances. Signal transmission distance is a crucial factor for normal communication between sensor nodes. If the transmission distance of the signal is too long, the node will consume more energy to transmit information to anchor nodes. In addition, for anchor nodes that have established communication connections. Too long transmission distance will inevitably increase the time error of signal arrival, which will have an impact on the final node location accuracy. If the transmission distance is too short, the node cannot communicate with any anchor node and send its own location information.
In
Figure 11, the x-axis represents the detection radius of the node and the y-axis represents the corresponding localization error.
Figure 11 shows the errors of TDOA, PSO, WOA, SCA, GTO, OPGTOS1 and OPGTOS2 under different detection radius, and we can see that the error rate of the optimization algorithms is much smaller than TDOA.
Figure 12 shows the positioning errors of PSO, GTO, OPGTOS1 and OPGTOS2. When the detection radius is between 60 m and 120 m, the localization error rate of OPGTOS1 is smaller than other algorithms. In addition, its variation range is smaller than other algorithms, which indicates that the stability of the algorithm is better.