Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 4, No. 3, 2023 100 Application of Improved Immune Particle Swarm Optimization in 3D Node Localization Minghong Xu * School of Electronics and Information Engineering, Soochow University, Suzhou, Jiangsu 215000, China * Corresponding Author Email: xmh2028410256@163.com Abstract: When 2D localization algorithm is extended to 3D space, it achieves node localization with better localization accuracy. An improved immune particle swarm optimization (IIPSO) localization algorithm is proposed to estimate the localization of nodes in wireless sensor networks (WSN). The results show that IIPSO algorithm outperforms the traditional two- dimensional localization algorithm based on iterative estimation of the center of mass by 3%-6%. The proposed algorithm has better resistance to RSSI measurement errors and can achieve more than 99% node localization coverage through multiple iterations, which is effective for WSN. Keywords: WSN; Three-dimensional Node Localization; Nonlinear Optimization; IPPSO. 1. Introduction One of the critical challenges in designing and deploying WSNs is location awareness. Knowing the node positions is essential for many WSN applications, such as tracking objects or events, routing data, and reporting anomalies [1]. The accurate and efficient localization of sensor nodes can contribute to better resilience of WSN, and further expand their application domains. Wireless sensors are used to collect data to a central storage node. Wireless sensors have been widely used in monitoring, control, and many other fields. WSN's storage nodes and ordinary nodes at the same level, data transmission is mainly done through the relay [2].Wireless sensor networks are widely used with its flexibility, scalability, and reliability as advantages that distinguish them from traditional wired networks [3]. In fact, two-dimensional node positioning faces a series of difficulties, such as large localization errors, the influence of environmental noise, etc [4]. Scholars have developed a number of solutions to the problems of two-dimensional node positioning, and the most commonly used algorithms are the triangulation method, wide-area least squares method, signal strength indicator-based algorithm, and time-of-flight measurement-based algorithm. These algorithms have different positioning accuracies, algorithm complexities, and implementation costs [5]. People need to research and analyze two-dimensional node positioning in different scenarios, propose more reasonable and effective algorithms and technologies, to meet accuracy, cost, energy consumption, and other needs. 3D node localization is more complex than 2D node localization because it requires accurate measurement of node height information. The height information of wireless sensor nodes is critical for many application scenarios, such as building interior monitoring, environmental monitoring, air traffic monitoring, and outdoor detection [6]. Researchers have proposed many 3D node localization methods, including polygon intersection method, stereo angle method, sound signal-based method, triangulation method, etc. [7]. In theory, the application of 3D node positioning also poses some challenges and difficulties, such as high energy consumption and positioning errors. This article aims to improve the adaptive PSO algorithm and introduces a new algorithm - IIPSO. Based on previous research, this algorithm introduces an immune protocol, enhancing search capabilities and addressing the issue of the original algorithm. 2. Improved Immune Particle Swarm Optimization Algorithm The PSO algorithm is to complete the selection for the optimal solution of more complex spatial problems through the collaboration, but in the process of searching, the excellent particles are too concentrated or the concentration reaches a certain degree [8]. To overcome the deficiency of similar particle variety, it is necessary to introduce the concept of immunization idea while keeping the particle concentration within a reasonable range [9]. An artificial immune mechanism can be introduced to assist in adjusting the algorithm. In this paper, based on the above principles, an improved localization algorithm based on IPSO algorithm is proposed. 2.1. Algorithm Initialization Table 1. Relationship between IIPSO and localization problem Immunity algorithm Particle Swarm Algorithm Localization problem Antigens Fit function Positioning errors and constraints Antibodies Particles Possible localization locations Identification of antigens Particle fitness assessment Analysis of localization problems Affinity Fitness value Match of feasible solutions Cell activation Particle Selection Selection of high- quality viable solutions Memory Cells Optimal particles Locating the optimal solution Immunomodulation Control of current solution concentration and affinity 101 The IIPSO generates diversity in the population by immunizing the particles in the process of iteration through the immune mechanism of the artificial immune algorithm, thus increasing the exploration ability and improving the search efficiency, making it more applicable to solve the localization problem (Table 1). The IIPSO can solve the defects of conventional PSO in the localization problem and achieve greater results [10]. Eq. (1) and (2) display the formulas that are utilized in IIPSO. Fig 1 illustrates the flow of the algorithm Fig 1. Flowchart of IIPSO algorithm ⋅ ⋅ ⋅ (1) (2) Where: v represents the velocity, while x is its position. The symbol w signifies the inertia factor used in the algorithm. Additionally, the variables c1 and c2 refer to the study variables that affect the magnitude. Moreover, and is the individual and general optimum locations attained by PSO. ⋅ is a memory term, ⋅ is the self-cognition term, ⋅ is the group cognitive term indicating that the particle moves according to the optimal experience in the global. In the traditional particle swarm algorithm, a fixed inertia weight is used to control the motion of the particles. By using nonlinear dynamic inertia weights, the search extent and velocity of particles may be properly raised, which perform a more comprehensive search in the global range, thus improving the global search capability. At the same time, the method is also able to adjust inertia weights according historical state and performance. So that it can solve various complex optimization problems more effectively. The expressions are shown in Eq. (3): max ⋅ max min max (3) Where: max and min is the limit of inertia factor. While max denotes the largest number of iterations. The optimal values of w, namely wmax=0.95 and wmin=0.4, have been determined through experimentation. The study variables and are employed to enable particles adapt their optimal flight direction at an individual and group level, respectively. In the conventional particle swarm algorithm, the learning factors are usually fixed at a value of 2. The adaptive learning factor proposed in Eq. (4) and (5) has been introduced: 1max ⋅ 1max 1min max (4) 2max ⋅ 2max 2min max (5) Where: 1max and 2max is the upper bound of learning factors for and , while 1min and 2min denote their lower bounds. The variables signify the number of iterations. The adaptive IPSO algorithm is divided into A and B. Subpopulation A performs speed update and position update to evolve the population to the optimal solution; subpopulation B is an inferior particle with small adaptation but large concentration, and requires vaccination to replicate the superior particle in memory cells to replace the original inferior particle. In this paper, we use the maximum concentration value based on the particles to rationalize the number of populations A and B. The antibody concentration is calculated by: ∧ , 1 (6) 1 ∧ (7) Where: x i and xi is the predicted and true value, respectively. n refers to the number of dimensions in the problem space, while xit represents the position of the ith antibody that has been selected in the tth generation. The number of populations among subpopulations A and B is calculated as: max (8) ′ (9) Where and are the counts of individual in subgroups A and , respectively. The variable stands for the maximum number of particles. M denotes the original size of the population. The fitness function is: 1 | (10) , (11) Where , is the coordinates to be estimated. 102 2.2. Adaptive Search Rules The adaptive IPSO takes the gbest stored in memory as the search center, and the random search is performed within its dynamic control. The search rules of the adaptive immune particle swarm algorithm are as follows: (12) ⋅ (13) Where is the vaccination, as the tth generation search radius, range(t) as the tth generation search range. indicates that each inoculation is one arbitrary value that is restricted to the population extreme value interval. The dynamic search radius range is regulated by the maximum concentration control, and the search rules are as follows: 1 max (14) 1 1 / max 1 / max (15) 1 2 max 0.8 1 1 0.2≤ max 0.4 1 max 0.4 (16) 1 2 max 0.8 1 1 0.6≤ max 0.8 1 max 0.6 (17) Where m and n are the expansion and reduction of the search radius, respectively. From the search rules can be obtained, when the maximum concentration is greater than the set value, then the particle is too dense diversity is poor, by adjusting the formula to make n larger, m remains unchanged, can make the search range larger; when the maximum concentration is moderate, indicating that the location of the particle population is also moderate, then m, n remains unchanged that the search range is also unchanged; when the maximum concentration is less than the set value, indicating that the particle population is more sparse, then make m increase When the maximum concentration is less than the set value, it indicates that the particle population is sparse, which makes m increase and n remain the same, that is, the search range can be narrowed. 3. Simulation Results and Analysis 3.1. Simulation Environment Setup In this paper, we use interactive data language to simulate a real wireless sensor network environment on a computer platform, the localization error of the algorithm is: (18) To better compare the positioning accuracy between wireless sensor networks with different node communication radii, the relative positioning error is defined on the basis of Eq. (18) as: ∑ (19) Here, K refers to unidentifiable node’s quantity. represents the radiation of network connectivity of individual node. Assuming that there are 1000 nodes that are evenly dispersed within a three-dimensional area spanning 100 meters by 100 meters by 100 meters, the Monte Carlo simulation experiment sets the algorithm's stopping criteria to be: ∧ or ∧ ∧ | ∧ ∧ | 0.01 (20) Where P1 denotes signal strength from the unknown node O. However, the simulation environments in which the nodes are located in the 2D plane and 3D space are different. The iterative termination conditions of the two-dimensional localization algorithm are set as follows: 1) Unidentified nodes are placed inside the planes enclosed by the connected nodes: ∧ (21) 2) Unidentified nodes lie outside the plane enclosed with connected nodes: ∧ ∧ ∣ ∧ ∧ ∣ 0.0 (22) At this point, both the wireless sensor network node distribution environment and the iterative termination condition of the localization algorithm, both algorithms have good consistency. The error of node localization can be obtained: (23) 3.2. Localization Accuracy Analysis Two cases, R = 25 with a small node communication radius and R = 40 with a large node communication radius, are selected to observe the relative positioning errors of the two algorithms under different node ratio conditions, as shown in Fig 2. Fig 2. Performance comparison of 2D localization algorithm and 3D localization algorithm The experimental outcomes demonstrate a marked rise in accuracy of 2D and 3D localization algorithms. Moreover, the algorithm introduced in this study yields a smaller relative positioning error than the 2D positioning algorithm. Fig 3. Effect of RSSI measuring error on location accuracy In real wireless sensor networks, interference from various 103 noises can lead to errors in the network's measurement of the received signal strength (RSSI). It is especially important to analyze the effect of measuring errors through simulation experiments. In order to more comprehensively analyze the impact of distance measurement error on the performance of 3D localization algorithm of wireless sensor network, two cases of R = 25 with small node communication radius and R = 35 with large node communication radius are selected. The impact of RSSI measurement error is shown in Fig 3. When R is small and the proportion of network nodes is low, the algorithm's relative localization error remains high. This experimental result aligns with the findings in Fig 2. The algorithm proposed in this paper estimates the value between the 3D spatial center mass and unidentified nodes. The influence of on algorithm's performance is mainly reflected in two aspects: (1) the algorithm needs to sort the connected nodes, so as to determine the nodes replaced by current 3D spatial center of mass during iterative process; (2) Compares it with the iteration termination threshold set by the algorithm to finally determine when the algorithm iterates to terminate. 3.3. Localization Coverage Analysis In addition to higher accuracy and better resistance to measurement error, the algorithm of WSN is also required to have good positioning coverage. The algorithm's LCR is: known all (24) Fig 4 shows the localization coverage of the algorithm in this paper under different conditions of connected node distribution. The RSSI-based localization algorithm and center-of-mass localization algorithm are chosen to provide a more comparison of localization. R is set to 35, with a focus on observing the localization accuracy of the three algorithms as demonstrated in Fig 5. Fig 4. Effect of number of nodes on LCR The algorithm presented in this research requires no information on the specific range or angle information of connected nodes and unknown nodes, making it a non- ranging-based localization algorithm. The simulation outcomes indicated in Fig. 5 reaffirm that the algorithm presented in this paper has higher resistance to RSSI errors. Fig 5. Performance of proposed algorithm 4. Conclusion 1) On the basis of the adaptive PSO, the immunization procedure is introduced to increase the population diversity of particles, balance the local search ability and global search ability, effectively solve the problem that particles easily fall into local optimum. 2) The proposed algorithm further increases the positioning precision, avoids mutual conversion between RSSI and physical distance in the positioning process, and decreases computational power and positioning energy consumption of nodes. 3) This algorithm offers good positioning precision and coverage, and is resistant to RSSI errors, which is a 3D localization algorithm to WSN with high accuracy and low energy consumption. References [1] Shahbazian R, Ghorashi S A. (2018) Three dimensional power efficient distributed node localisation in wireless sensor networks. International Journal of Sensor Networks, 28(2): 103-113. [2] Yildiz D, Karagol S, Ozgonenel O, et al. (2016) Three- Dimensional Sensor Localization Using Modified 3N Algorithm. 30th IEEE International Conference on Advanced Information Networking and Applications (IEEE AINA), pp. 334-338. [3] Li H B, Wang S F, Chen Q, et al. (2022) IPSMT: Multi- objective optimization of multipath transmission strategy based on improved immune particle swarm algorithm in wireless sensor networks. Applied Soft Computing, 121: 108705. [4] Walia G S, Singh P, Singh M, et al. (2022) Three Dimensional Optimum Node Localization in Dynamic Wireless Sensor Networks. Cmc-Computers Materials & Continua, 70(1): 305- 321. [5] Prashar D, Joshi G P, Jha S, et al. (2021) Three-Dimensional Distance-Error-Correction-Based Hop Localization Algorithm for IoT Devices. Cmc-Computers Materials & Continua, 66(2): 1529-1549. [6] Zhao S S, Chai S C, Zhang B H. (2016) Dynamic Differential Evolution Strategy Localization for Wireless Sensor Networks in Three-dimensional Space. 35th Chinese Control Conference (CCC), pp.8423-8427. [7] Liu W, Dong E Q, Song Y. (2016) Analysis of flip ambiguity for robust three-dimensional node localization in wireless 104 sensor networks. Journal of Parallel and Distributed Computing, 97: 57-68. [8] Mubaraka C M, Rejith K N, Gopakumar A, et al.(2015) Node Localization in Wireless Sensor Networks by Artificial Immune System. Fifth International Conference on Advances in Computing and Communications (ICACC), pp.126-129. [9] Erdemir E N, Tuncer T E, Ieee. (2015) Wireless Sensor Network Localization Using Alternating Minimization Algorithm. 23nd Signal Processing and Communications Applications Conference (SIU), pp. 2191-2194. [10] Han F R, Abdelaziz I I M, Liu X N, et al.(2020) A Survey on DV-Hop localization Techniques in Three-Dimensional Wireless Sensor Networks. International Journal of Online and Biomedical Engineering, 16(10): 23-39.