Robust Node Localization with Intrusion Detection for Wireless Sensor Networks

Wireless sensor networks comprise a set of autonomous sensor nodes, commonly used for data gathering and tracking applications. Node localization and intrusion detection are considered as the major design issue in WSN. Therefore, this paper presents a new multi-objective manta ray foraging optimization (MRFO) based node localization with intrusion detection (MOMRFO-NLID) technique for WSN. The goal of the MOMRFO-NLID technique is to optimally localize the unknown nodes and determine the existence of intrusions in the network. The MOMRFO-NLID technique encompasses two major stages namely MRFO based localization of nodes and optimal Siamese Neural Network (OSNN) based intrusion detection. The OSNN technique involves the hyperparameter tuning of the traditional SNN using the MRFO algorithm and consequently increases the detection rate. In order to assess the enhanced performance of the MOMRFONLID technique, a series of simulations take place and the results reported superior performance compared to existing techniques interms of distinct evaluation parameters.

applications prospect, like ecological observation, national defense, volcano observation, space exploration, medical security, city management, architecture, environmental monitoring, and so on. The WSNs could realize realtime sensing, monitoring, and gathering data of different monitoring objects/environments via the support of several incorporated micro sensor nodes [3]. Later, process the data through embedded systems. Fig. 1 shows the framework of WSN model. WSN node localization technique could be categorized as to the range free and range based localization methods based on the distance measure is required in the localization procedure [4]. The previous need is to measure the distance among the anchor and unknown nodes while measuring the positions of unknown nodes. Later, estimate the positions of unknown nodes through the entire network's connectivity. Thus, the precision of range based localization methods is effective when compared to range-free localization methods. Ranging approaches used commonly in the range based localization methods are received signal strength indicator (RSSI), angle of arrival (AOA), and time of arrival (TOA) [5,6]. In realtime applications, combination of multiple measurement approaches is an efficient way to enhance the localization effects. Based on the anchor nodes move or not, it is separated into dynamic and static anchor node localization methods [7]. The usage of dynamic anchor node localization could highly decrease the numbers of anchor nodes as well enhance the localization effects. To decrease the number of static anchor nodes, decrease the cost of operations of entire networks, also enhance the localization effects, the localization method depends on dynamic anchor node has clear benefits [8,9]. An energy effective, range free, localization method on the basis of mobile anchor node for largescale machinemachine environments. An RSSI dependent localization method employed the RSSI value attained through sensors from mobile anchor nodes for estimating the location of the sensors [10]. The concept of localizing target nodes by shifting individual anchor nodes through computation intelligence based applications of H-best particle swarm optimization and particle swarm optimization.
At present, the security of WSNs has become primary concern. How to find different network attacks is one of the basic technologies which should be resolved [11]. The security study of WSN focus largely on the succeeding factors: (1) network intrusion detection systems and response models; (2) different network defense and attack models; (3) key management, authentication technology, and encryption algorithm; and (4) the security of data fusion and network routing [12,13]. Currently, various intrusion detection systems (IDSs) for WSN is rule based system in which the performances are based highly on the rule determined by means of security expert. Because of the large number of network traffics, the procedure of encoding rule is slow and expensive. For overcoming the limitations of rules based scheme, data mining technique is employed in IDSs for WSNs [14]. Data mining is an effective result to detect active network attacks on the basis of features hidden in the data of network behaviors. This paper presents a new multi-objective manta ray foraging optimization (MRFO) based node localization with intrusion detection (MOMRFO-NLID) technique for WSN. The MOMRFO-NLID technique encompasses two major stages namely MRFO based localization of nodes and optimal Siamese Neural Network (OSNN) based intrusion detection. The OSNN technique involves the hyperparameter tuning of the traditional SNN using the MRFO algorithm and consequently increases the detection rate. The MOMRFO-NLID technique has the ability to optimally localize the unknown nodes and determine the existence of intrusions in the network. For examining the enhanced performance of the MOMRFO-NLID technique, a comprehensive experimental analysis is carried out and the results are inspected interms of distinct measures. In short, the key contributions are listed as follows.
A novel MOMRFO-NLID technique consists of MRFO based localization of nodes and OSNN based intrusion detection is presented. To the best of our knowledge, the MOMRFO-NLID technique has been never presented in the literature. An intelligent MRFO based localization technique is designed to optimally localize the sensor nodes in WSN. The parameter tuning of the SNN model using MRFO technique using cross-validation (CV) helps to improve the predictive performance of the MOMRFO-NLID technique for unseen data.
The rest of the paper is arranged as follows. Section 2 provides the literature review and section 3 discusses the proposed model. Section 4 offers the performance validation and section 5 draws the conclusion.

Related Work
Li et al. [15] presented a novel heuristic approach called PCCSO through 3 individual transmission approaches. The advantages of PCCSO reflect in improving the capability of local search, as well as in storing the computer memory. The experiment result shows that the PCCSO is increasingly high to CSO, PSO, as well as enhanced CSO in getting convergent. Next, the PCCSOs are used for DVHop to efficiently enhance the localization performance of unknown nodes when storing WSNs memory. In order to decrease the errors in the distance estimate phase, a node localization method for WSN based VP-DC is developed [16]. In distance estimate phase, first, the distance of all hops on the shortest transmission paths among the beacon and unknown nodes are estimated through the deployment of virtual partition method; Next, the length of shortest transmission paths is attained by adding the distance of all the hops; lastly, the unknown distance between nodes is attained on the basis of distance correction formula and optimum path search method.
In Annepu et al. [17], non-linear ANN methods like MLP and RBF are employed efficiently to nonlinear node localization problems. Also, ANN based localization techniques can able to localize the mobile UN. Furthermore, the RBF using Gaussian activations has a small edge on the MLP using sigmoid activation since the wireless network is modelled usually by Gaussian random variables. Hao et al. [18] proposed node location models on the basis of SVM and Voronoi diagram. The main concept is to split the regions into various segments via anchor node and Voronoi diagram. The range of primary location of the targeted nodes is attained by localizing the targeted nodes in all the regions and the SVM is employed for optimizing the location of the targeted nodes precisely. The localization accuracy is examined through realtime experiments and simulations. The experiment result shows that the localization method is effective when compared to the optimum region election strategies based Voronoi diagram based on localization system as well as Weighted Voronoi diagram based on localization system localization algorithm with respect to localization precision.
Song et al. [19] presented a Monte Carlo node localizing method based on enhanced QUATRE optimization. Firstly, the model selects the higher quality node in the range of single hop of unknown node as temporary anchor node, and take the temporary anchor node and anchor node as the reference node to localization, for constructing a precise sampling region; Later, the enhance QUATRE optimization is employed for obtaining the calculated position of unknown node in the sampling region. Safaldin et al. [20] proposed an improved IDS through the adapted binary GWOSVM. This model employed three wolves, five wolfs and seven wolves for finding an optimal amount of wolves. The presented model's aim is to improve the detection rate and IDS accuracy as well as decrease the runtime in the WSN environments by minimizing false alarm rate, and the amount of feature results from the IDS in the WSN environments.
Alruhaily et al. [21] proposed a multilayer IDS for WSN; where they adapt a defense indepth security approach, in which 2 layers of detections were placed. The initial layers are placed on the network edge sensor is distributed; it uses NB classifiers to make realtime decisions of the investigated packet. Next, it is placed on the cloud and utilizes RF multiclass classifiers for an indepth analysis of the investigated packet. Gavel et al. [22] proposed a method which employs the integration of multivarying kernel density estimate using distributed computing. This integration analyses the single possibility of the survival of data and calculates the global value of the PDF. PE model is used for effective in-network estimation and detection of intrusions at lower FPR.
Zhang et al. [23] proposed an IDS based TVP-IPSO method using PCA and SVM models. The PCA is intended at the data reduction dimension through compressing the data to decrease the power utilization, and IDS based SVM is deliberated for ensuring higher detection precision. In order to improve the SVM method and find its optimum parameter, the TVP-IPSO is employed for improving the convergence speed and IDS accuracy.

The Proposed MOMRFO-NLID Technique
In this study, a new MOMRFO-NLID technique is derived to achieve optimal node localization and intrusion detection in WSN. The MOMRFO-NLID technique encompasses a two-stage process namely MRFO based localization of nodes and OSNN based intrusion detection. The detailed working of these modules is given in the following sections.

Overview of MRFO Algorithm
The stimulus of MRFO is dependent on the smart foraging performances of MR. It contains 3 exclusive foraging rules of manta ray (MR) to recognizing optimum food sources. A few of the objectives were explained in the following: Chain foraging: At this point, a huge amount of MRs begins foraging, and it stands individually as a straight line development. The small male MR is supported by female MR and swims on top of abdomen and strikes the pectoral fin of female MR. Eventually, the plankton which is left by previous MR will be scooped up next MR. By cooperating with one another, it funnels maximal plankton as to its gills and improves the food resource.
Cyclone foraging: During this component, when the concentration of plankton was superior, set of MRs are collected. The end of all plankton tails are related to head and it reproduces the spiral development to create the spiraling vertex from cyclone and the attained water has been pushed to top surface. It pulls plankton to its opened mouths. Somersault foraging: This metric has much splendid scenery obviously. When the MR classifies better food sources, afterward, it will conduct sequential backward somersault, surrounding the plankton to grab them near MRs. The somersault is a random, sequential, local and cyclical performance which guides MR to utilize optimum food. However, these foraging performances are extremely unseen at maximal times.
At this point, the MR is said that exist the ornamental species in sea world. However, its form is dreadful. It has a flat body and a couple of pectoral fins that are helpful to swimming freely. Besides, the couple of cephalic lobes was presented in front of its big, incurable mouths. Without sharp teeth, the MR feed planktons with small animal existing in the water. Whereas foraging, funnel the water as well as prey to mouth with horn-shaped cephalic lobe. The MR utilizes massive amount of planktons regularly. The well grown up MR is eating 5 kg of plankton daily. Besides, the MR is travel either solely or together with over 50, and the foraging rule was observed collected.
The MRFO has been operated by 3 foraging performances as Chain foraging, Cyclone foraging, and Somersault foraging. A few numerical techniques are provided below.

Chain Foraging
In MRFO, the MR monitors the place of plankton and move concerning it. When plankton concentration is superior, next the place is optimum in that, all places are upgraded with remarkable solutions recognized. This numerical technique of chain foraging was demonstrated as: where represents the location of xth individuals at time n in dim is a dimensionality, rand implies an arbitrary vector from [0, 1], φ stands for weight coefficients, signifies the plankton with maximal focus.

Cyclone Foraging
During this approach, the MR was moved spirally to the location of food sources; the MR swim from the plankton [24]. It follows the one in front of it and swims near food spirally. The numerical notion of spiralshaped event of MR was explained in the subsequent; This performance upgrades to d space. The arithmetical method of cyclone foraging has been demonstrated as: C dim x ðn þ 1Þ ¼ C dim best þ rand:ðC d best ðnÞ À C d x ðnÞ þ aC dim best ðnÞ À C dim x ðnÞÞ: C dim x ðn þ 1Þ ¼ C dim best þ rand:ðC d best ðnÞ À C d x ðnÞ þ aC dim best ðnÞ À C dim x ðnÞÞ: where α implies the weight coefficients, T illustrates the superior amount of iterations, and rand1 demonstrates the rand value from [0,1]. All the individuals explore the new place away from current optimum one by assigning a novel arbitrary place from the search space place. This procedure was extremely concentrated on MRFO for accomplishing wider global search; the mathematical operation was presented as: where refers the arbitrary place, LB and UB refers the lower and upper restricts of dimensional correspondingly.

Somersault Foraging
All MRs propose to move and somersault to novel place. Therefore, it maximizing the places and creates better places. The numerical illustration of this performance is showcased as: where som depicts the somersault factor that elects a somersault threshold of MRs and Som= rand2 and rand3 determines 2 arbitrary values from [0, 1].
Therefore, the whole time complexity of MRFO was represented as: where T implies the superior amount of iterations.

Design of MRFO Based Node Localization Process
The MRFO based localization method is applied to estimate the coordinate of sensors. The major goal of node localization in WSNs is to compute the coordinate of preferred node by reducing the objective function. The localization problems of WSNs are assumed as optimization issues that have been evolved by different meta-heuristic approaches. The given strategy has been employed to localize the sensors in WSN: 1. Upload M targeted node as well as N anchor nodes in a random manner in the sensor fields. All anchor nodes are composed of position awareness for identifying the position. Every anchor node as well as target node contains a broadcast range R. 2. Distance between the anchor and target nodes are estimated as well modify by additive Gaussian noises. The targeted nodes determine the distance withd i ¼ d i þ n i where d i refers to the real distance that has been estimated among the position of the targeting nodes (x, y) and position of beacon (x i , y i ) with the help of the given function: The parameter n i defines the noise that affects the estimated distance from d i AE d i P n 100 À Á where P n implies the ratio of noise in the estimated distance.
3. The preferred nodes are named localized nodes when they contain three anchor nodes inside the transmission radius of the targeting nodes. A cause afterward this demand is that, depending upon tri-lateral localization method, coordinate of three anchor nodes (x 1 , y 1 ), B(x 2 , y 2 ) , and C(x 3 , y 3 ), as well as the distance among the targeting nodes d i as well three anchor nodes are recognized. Afterward, the applications of trigonometric law of cosine/sine, the coordinate of targeting nodes is determined. In a similar manner, in multi-lateral targeting node estimated method, distance metrics of massive anchor nodes are applied to reduce the error from an original distance as well as evaluated distance. 4. In the event of localizable nodes, the MRFO based approach is executed separately for identifying the position of the targeting nodes. The MRs are invoked using the centroid of anchor node inside a communication radius using the given functions: where N represents the overall count of anchor nodes inside the transmission range of the localizable targeting nodes.
5. The HSSO-DE approach is applicable to identify the coordinate (x, y) of the targeting nodes which reduces the localization errors. The primitive applied in localization problems is a mean square distance among targeting nodes as well as an anchor node that has been reduced with the application of given notion: where N ≥ 3 defines the count of anchor nodes inside a communication radius of targeting nodes.
6. The optimal measure (x, y) has been determined using HSSO-DE model once the number of rounds is limited. 7. The overall localization error can be determined after estimating the localizable target nodes N L . This is evaluated as a mean square of distance from determined node coordinate (X i , Y i ) whereas the actual node coordinates (x i , y i ) can be represented as: 8. The procedure of 2 to 6 is continued still the targeting node is positioned. The localized model depends upon the maximum localization error E 1 and count of unlocalized nodes N N L that is determined under the application of N N L ¼ M À N L . The minimum scores of E 1 and N N L develops an effective localization.
The localized node count gets enhanced as the iteration develops. Also, it maximizes the anchor nodes count inside the communication radius of the localizing targeted nodes as the evaluated location of the targeting nodes acts as anchor nodes in the successive iteration. It is used for limiting the issue of flip ambiguity that generates maximum localization error. Thus, processing duration for localization data of the targeting nodes enhances when the iterations are improved.

Design of OSNN Based Intrusion Detection Process
At this stage, the OSNN technique is utilized for determining the presence of intrusions in the network. The networks comprise of 2 indistinguishable FFNN joined at their yield. Amid training, all networks peruse a profile composed of genuine value and form its value at all the layers. The network enacts some neurons according to this value and upgrades its weight via error backpropagation, and finally, it creates an output profile i.e., related to the output of another network. The last output could be related to ith its respective ground truth values.
The presented Siamese neural network architecture includes twin NN (top & bottom network), whereas all of them include 3 dense layers (excluding the input layer). The input layer includes sixty four neurons, and other layers include 128 neurons. The activation function employed for the 1st three layers is "tanh". In order to evade overfitting, dropouts are employed among layers 1 and 2, as well as layers 2 and 3 using 10% fraction. The 2 twin NN outputs are combined to make the output layer using single neuron, whereas the Euclidean distance is employed among the outputs of top and bottom network for measuring the comparison among the 2 outputs [25]. The datasets are divided into 2 partitions, thus two-third of the datasets are dedicated to training and remaining dedicated to testing. Random pair of record of the datasets are made; the pairs are positive when the 2 record belongs to the similar classes; or else the pairs are negative. This can be made by the contrastive loss functions: whereas L represents the loss function, (X, Y p ) denotes a positive pair, (X, Y n ) indicates a negative pair, D signifies the distance among 2 records of the similar pair, and m represents the margin value that shows 2 records of negative pairs are distant enough. In order to attain the value of networks weight where the loss is optimal, the RMSprop optimization algorithms are employed.
In order to update the weight parameters of the SNN model, the MRFO algorithm can be employed.
Step 1: Initialize the parameters of the MRFO algorithm.
Step 2: Train the SNN model and compute the fitness function (FF) using MRFO algorithm.
The 10-fold CV approach has been employ to evaluate the FF. In 10-fold CV, the trained dataset has been arbitrarily separated as to group of 10 mutually exclusive subsets of almost matching sizes where 9 subsets are employed to trained drives and the last subset has been employed for testing purposes. This procedure develops iterated ten times to all subsets are employed to testing method. The FF is demonstrated as 1 − CA validation of the 10-fold CV manner during the trained dataset as provided in Eq. (16). Besides, the solutions with superior CA validation outcomes in lesser fitness value.
where, y c and y f represents the true and false classifier count correspondingly.
Step 3: Updating the location of MRs. At this stage, the local and global best positions of the MRs are updated based on the value of the FF.
Step 4: Termination Condition The above steps 2-3 get iterated till the termination condition gets satisfied.

Performance Validation
This section investigates the performance of the proposed MOMRFO-NLID technique in MATLAB tool. In addition, the results are inspected under varying anchor node density (AND), communication range, and measuring distance. Besides, the intrusion detection results are examined on benchmark KDD Cup'99 dataset. Tab. 1 and Fig. 2    For instance, with the AND of 5%, the MOMRFO-NLID manner has received a lower ALE of 4.29 m whereas the RSSI, TOA, and RSSI-TOA techniques have gained a higher ALE of 12.54, 11.99, and 7.11 m correspondingly. In addition, with the AND of 15%, the MOMRFO-NLID system has received a lower ALE of 3.36 m whereas the RSSI, TOA, and RSSI-TOA manners have obtained a higher ALE of 11.06, 10.46, and 5.38 m respectively. Also, with the AND of 25%, the MOMRFO-NLID approach has received a reduced ALE of 2.02 m whereas the RSSI, TOA, and RSSI-TOA methods have reached a maximum ALE of 8.34, 7.06, and 3.06 m respectively.
Tab. 3 and Fig. 4 provides a detailed ALE analysis of the MOMRFO-NLID manner under distinct measuring position (MP).      0.660 correspondingly. From the above mentioned result analysis, it is proved that the MOMRFO-NLID technique is found to be an appropriate tool for effective node localization and intrusion detection in WSN environment.

Conclusion
This paper has presented an effective MOMRFO-NLID technique for WSN to optimally localize the unknown nodes and determine the existence of intrusions in the network. The MOMRFO-NLID technique encompasses two major stages namely MRFO based localization of nodes and OSNN based intrusion detection. The OSNN technique involves the hyperparameter tuning of the traditional SNN using the MRFO algorithm and consequently increases the detection rate. For examining the enhanced performance of the MOMRFO-NLID technique, a comprehensive experimental analysis is carried out and the results are inspected interms of distinct measures and accomplished a maximum accuracy of 0.921. The experimental values highlighted the better performance of the MOMRFO-NLID technique over the existing techniques interms of different evaluation parameters. In future, the performance of the MOMRFO-NLID technique can be boosted by the use of load balancing and scheduling approaches.
Funding Statement: The authors received no specific funding for this study.

Conflicts of Interest:
The authors declare that they have no conflicts of interest to report regarding the present study.