Quantum Firefly Secure Routing for Fog Based Wireless Sensor Networks

Wireless Sensor Networks (WSNs) become an integral part of Internet of Things (IoT) and finds their applicability in several domains. As classical WSN faces several issues in service-based IoT applications, fog computing has been introduced in real-time, enabling local data processing and avoid raw data transmission to cloud servers. The Fog-based WSN generally involves advanced nodes, normal nodes, and some Fog Nodes (FN). Though the Fog-based WSN offers several benefits, there is a need to develop an effective trust-based secure routing protocol for data transmission among Cluster Heads (CHs) and FNs. In this view, this paper presents a Quantum Firefly Optimization based Multi-Objective Secure Routing (QFO-MOSR) protocol for Fog-based WSN. The main intention of the QFO-MOSR technique is to derive an optimal selection of routes between CHs and FNs in the network. The QFO-MOSR technique has incorporated the concepts of quantum computing and Firefly (FF) optimization algorithm inspired by the flashing behaviour of FFs. In addition, a multi-objective fitness function is derived by the QFO-MOSR technique using seven objectives: distance, inter-cluster distance, energy, delay, intra-cluster distance, link lifetime, and trust. The proposed routing technique derives a fitness function including trust factor from ensuring security. The design of the QFO-MOSR technique with a multi-objective fitness function shows the novelty of the work. To validate the performance of the QFO-MOSR technique, a series of experiments were carried out, and the results are investigated in terms of different measures. The experimental analysis ensured that the QFO-MOSR technique is superior to other methods in terms of different measures.


Introduction
Next-generation Wireless Sensor Networks are expected to be placed in Internet of Things (IoT). The IoT has transformed the present world of technology. The electronic devices such as home appliances, medical equipment, cameras etc., can interact via the internet connecting several Sensor Nodes (SN). Therefore, these devices have few restrictions and involve processing power, bandwidth, storage, and a to attain the tradeoff between security energy consumption and transmission efficiency. The presented tradeoff could efficiently choose the secure and robust transmit node, specifically the trust managementbased secure routing system. Additionally, the proposed method is also appropriate to defend against badmouthing attacks. Arapoglu et al. [10] proposed a GDTMS for FIWSN. Moreover, in this trust management, the analytical hierarchy procedure is presented to attain the tradeoff between energy consumption security and transmission efficiency. The presented trade-off could efficiently choose the robust and secure transmit node. In Fang et al. [11], a Lightweight Trust Management Scheme (LTMS) is presented depending upon binomial distribution for protecting from internal attacks. Concurrently, environment, energy, distance, and security domains are assumed and presented to a Multi-dimensional Secure Clustered Routing (MSCR) system by utilizing dynamic dimensional weight in hierarchical WSN. Revanesh et al. [12] proposed a distributed protocol named Secure Coronas Based Zone Clustering and Routing (SC-ZCR). Abidoye et al. [13] proposed an effective routing protocol for data transmission in WSN known as energy effective hierarchical routing protocol for WSN based on fog computing. Fog computing is combined with the presented system because of its ability to enhance the restricted power source of WSN and the need for IoT applications. Furthermore, they proposed an enhanced ACO method to construct an optimum path for effective data transmission to SN. Cara et al. [14] developed and designed a wireless SN for fog computing architecture to address two significant problems: deployment and development of strong transmission facilities, such as network resilience provisioning and energy consumption. The implementation is directed by investigating the related macro architectural feature and functioning limitations of the network architecture. Wang et al. [15] presented a Fog-based hierarchical trust method for this cybersecurity deficiency. This hierarchical method comprises two divisions, trust among Cloud Service Providers (CSP) and trust in the basic framework and Sensor Service Provider (SSP). Rafi et al. [16] presented an enhanced LEACH protocol called LEACH with Dijkstra's Algorithm (LEACH-DA) in a cloud platform that enhances the power utilization/energy use depending upon shorter path selection. Similarly, the presented architecture includes load balance by selecting a suitable CH node between its alternative by estimating its traffic condition with the base station or cloud. Moreover, they utilize a fog computing module for this condition (i.e., LEACH-DA-Fog) to raise the network lifetime related to the actual execution of the basic protocol. Borujeni et al. [17] presented a novel technique depending upon Fog-based energy-efficient routing protocol for WSNs (P-SEP) that utilizes ACO-based routing of FN (FEAR) and PEGASIS-based routing of FN (FECR) methods in execution. This method develops the efficiency of fog enabled WSN and extends the network lifespan. The efficiency of the presented technique is calculated towards P-SEP. Though several techniques are available in the literature, there is still a need to design a new protocol to achieve energy efficiency and security in Fog-based WSN. Besides, most of the works have not considered the interrelated metrics and trust factors to select CHs. Fig. 1 showcases the overall working process of the QFO-MOSR model. The proposed QFO-MOSR model aims to select the routes to the destination optimally. Once the presented model derives a fitness function, the possible paths towards the destination are identified. Followed by that, the QFO-MOSR model chooses an optimal route to the destination from the available paths. A significant component in introducing the technique is solution encoding. The proposed technique for detecting an optimum path from source (S) to destination (D) is assumed as a binary search problem. Here, D = {p_1, p_2, … , p_k} denotes destination containing 'k' paths created using an intermediate node among S and D nodes [18]. The number in the network is based on node count N, thus the interval 0 ≤ p_k ≤ N. Henceforth, the solution count present in the network among S and D is denoted by S^E = {1, 2, …, k}, in which 'k' indicates the overall number of paths. The k solution count is present among S and D pairs. This technique detects an optimal path with maximal trust, and another chosen objective utilizes multi-objective FF, which is determined by the following sections.

Design of QFO Algorithm
FF is a moderately novel technique that is established in [19]. This method is based on specific behavioural patterns, mainly flashing features of fireflies in the tropical summer sky. Fireflies belong to the insect family known as Lampyridae. Firefly is a type of beetle, which uses the concept of bioluminescence for attracting prey/mates. The luminance made by FF allows other fireflies to trail their path after prey.
Few flashing features of fireflies have been idealized to improve the FF method. Every FF is considered unisex to an individual FF that would attract another FF.
1. The attraction of an individual FF to other is relative to its intensity, by increasing the distance among them; subsequently, the one with lesser intensity would often move towards high brightness. When there is no brighter FF than a provided FF, it will move arbitrarily. 2. The brightness/light intensity of FF is defined using the landscape of objective function to be improved.
The light intensity of one FF is caused by the nature of the encoded cost function, and the intensity is about the value of FF. The main problem in FF growth is the creation of objective function (i.e., attractiveness) and difference in the light intensity. Hence, reduction of light intensity is because of distance among fireflies that results in differences of intensity and thus, reduce the attraction between them. Eq. (1) is utilized for representing light intensity with changing distance: where I represents brightness of S at D r from firefly, I 0 denotes early light intensity if r ¼ 0; and C indicates light absorption coefficient that describes the difference of attraction and impacts the cFF algorithm's convergences speed and entire performance [20]. C usually differs from 0.1 to 10. Since FF attraction is related to brightness witnessed by nearby FFs, they could denote attraction b at Cartesian distance r from FF, which is given by Eq.
where b 0 represents attraction at a distance r ¼ 0: The light intensity I and attraction β are similar manners. The distance among two FFs i and j at x i and x j is given by Eq. (3): The motion of FF i attracted by another brighter FF 'j' is given as: where t represents iteration. The initial term is performed in Eq. (4) due to attractiveness. Another term a N rand À 0:5 ð Þ denotes randomization and increases the search space. a indicates the randomization coefficient and arbitrary amount vector acquired from Gaussian Distribution a 2 ½0, 1. The value N rand denotes in '0' and '1'. The succeeding motion of FF i is upgraded by Eq. (5): The motion of FFs includes; the present location of i th FF, attracted to other fireflies, and arbitrary walk containing randomization variable α and arbitrarily created number from the range '0' and '1'. Where b 0 ¼ 0, the motion is based on the arbitrary walk. In contrast, variable C contains a critical effect on convergence speed. Besides the initial step, each performance is continually executed till the optimization procedure is terminated.
For improving the effectiveness of the FF algorithm, the QC concept is integrated into it. QC is current research on quantum computers by occurrences of quantum methods like the quantum gate, state superposition, and entanglement [21]. The primary data unit in QC is the Q bit. It might be in state |0>, |1> or superposition of states |0> and |1> concurrently. With Dirac notation, the Q bit denoted by the integration of states |0> and |1> is given as Eq. (6): where a and b represent complex numbers. a j j 2 (resp. b j j 2 ) denotes likelihood for finding Q-bit in state zero (denoted in state one). A quantum register of size n is later established from a group of nQ bits. It denotes as the superposition of nQ bits, and mainly it comprises till 2 n probable values concurrently. A quantum register is as follows Eq. (7): The amplitude C x fulfils the succeeding Eq. (8): The Q bit state is altered using a Quantum gate (Q gate) [22]. A Q gate is a reversible gate denoted by unitary operator U act on Q bit basis state fulfilling U þ U ¼ UU þ , in which U þ indicates Hermitian adjoint of U. There are several Q gates, like the controlled-NOT, Hadamard, Rotation, NOT gate, and so on. Fig. 2 demonstrates the QFO technique's flowchart. They utilize rotation angle in Q bit depiction, whereas every quantum FF solution Qf i (i th quantum FF in a quantum population) relates to vector Every quantum FF solution Qf i represents a string of quantum bits, evaluated by: Eq. (9) The likelihood amplitude of a single quantum bit is determined by a pair of amounts (cos h ij À Á ; sin h ij À Á ) in which jcos h ij À Á j 2 denotes the likelihood of eliminating item x j and sin h ij À Á 2 that embodies the likelihood of choosing the item x j (i th binary firefly). cos h ij À Á and sin h ij À Á fulfil Eq. (10): Firefly Algorithm Generate an early population of n fireflies with d dimension search: Calculate the population fitness ðf x i ð Þ, which is equivalent to the brightness I i ); while (not end criteria) Do

Application of QFO Algorithm for Secured Routing Process
The FF is calculated to find an optimum solution from the collection of variables. The fitness calculated for the presented QFO-MSR model utilizes 7 variables, such as link lifetime, delay, distance, energy, intracluster distances, trust model, and inter-cluster distances are utilized for routing. Now, the fitness is assumed by maximization operation. Henceforth, the solution offering maximal value of fitness is assumed to multihop routing. It is Eq. (11) as, where W 1 ; W 2 ; W 3 ; W 4 , W 5 , W 6 , and W 7 denotes weight calculated by fuzzy membership operation. P denotes node energy, T indicates transmission delay, X Ã represents inter-cluster distance, D indicates distance among two hops, X denotes intra-cluster distance and M indicates link time, and the trust module is represented by N. Eq. (12) calculates the weight, where p, q, and r denotes vertices of triangular membership function T f ð Þ. Now, p indicates low boundary, q represents medium boundary with membership value one, and r denotes upper boundary with membership value '0' [23]. i) Energy: The network energy is determined by the energy summation of each hop that denotes energy continued in nodes. The energy contains higher value, and it is Eq. (13) as: where b denotes hop count, which cooperates in multi-hop routing and E J n ð Þ denotes energy of n th hop.
ii) Delay: The delay is calculated by hop, which plays in routing and the delay have to be lesser to perform effectual routing. The delay calculated by the ratio of hop essential for routing overall nodes limited in WSN is Eq. (14) as: where l denotes overall nodes existing in WSN, and b represents the overall hop count required for routing.
iii) Intra-cluster Distance: It can be estimated using the summation of distance among hops, and the separate node existing in the hop is minimum. When it is minimal, the node is nearer to the hop; thus, the energy and data loss decrease. It is Eq. (15) as: where, b denotes regularization factor, X J n ; L t ð Þdenotes distance among n th hop and t th node and the overall nodes are denoted by s: iv) Inter-cluster Distance: The ratio of distance calculated among 2 clusters is the so-called inter-cluster distance, and it has to be maximum to provide an efficient routing. It is Eq. (16) as follows, where X G x ; G t ð Þdenotes distance among two clusters, and no denotes overall CHs.
v) Distance: The summation of distance calculated amongst two hops is given by Eq. (17). The distance has to be maximum to multi-hop routing as follows, vi) Link Lifetime: The network lifetime is acquired from the link lifetime and must be maximum for attaining an efficient routing. It is given in Eq. (18).
where, M J n ; J nþ1 ð Þdenotes link lifetime of n th and n þ 1 ð Þ th hops. vii) Trust model: It gives security to the proposed method in the routing procedure. It is utilized for calculating the trust of agents with suspicious behaviour. Numerous variables are assumed for calculating the trust that includes integrity and forwarding rate factors, direct and indirect trusts. Now, every hop in WSN gives a high trust degree to evaluate the trust level among hops and adjacent hops. It is Eq. (19) as: where, N d denotes direct trust, N i indicates indirect trust, N F denotes forwarding rate factor, and N I represents integrity factor.
viii) Direct Trust: It is called local trust, and it presents the trust value of agent computed from familiarity while communicating with targeted agents Eq. (20). N d À Á z y n; n þ 1 ð Þ¼fun z y n; n þ 1 ð Þ (20) where, N d À Á z y denotes direct trust for y th transaction and z th the time interval, fun denotes satisfaction measure, y represents transaction, z indicates time interval, n denotes calculation hop, and n þ 1 indicates hop to be calculated. The fulfilment measures are utilized for computing fulfilment degrees of an agent, which contain stated service. Therefore, the fulfilment measures keep the record of fulfilment level using exponential average upgrade functions as follows Eq. (21), fun z y n; n þ 1 ð Þ¼g Â fun v þ 1 À g ð ÞÂfun z yÀ1 n; n þ 1 ð Þ where, fun v denotes fulfilment value of the current transaction, and fun z yÀ1 n; n þ 1 ð Þdenotes fulfilment value of y À 1 transaction at z th time interval, g represents weight Eq. (22).
if transaction is thoroughly unsatisfactory 1; if the transaction is fully satisfactory 2 0; 1 ð Þ; otherwise 8 < : The weight g differs according to accumulated deviations Z z y n; n þ 1 ð Þas follows where Y denotes threshold and pose set value fixed to 0.25, j represents user-defined constant factor, c z y n; n þ 1 ð Þ indicates a current error, and Z z y n; n þ 1 ð Þ denotes accumulated deviations. Initially, the weight g is fixed to one, and it alters based on Eqs. (23)-(25) ix) Indirect Trust: It is evaluated from knowledge attained using other hops. All hops use the knowledge of other hops for providing effective decisions to all transactions. For attaining this approach, each hop requests other hops for offering suggestions regarding other hops. The resulting hop gathers the recommendations from another hop together with feedback credibility of the suggested hop. Therefore, the indirect trust of n th hop regarding n þ 1 ð Þ th hop is as follows Eq. (26), where, V denotes the collection of agents communicated with n þ 1, a denotes hop that communicates with other hops to make forecast regarding marinating trust, feedback creditability is represented by H z y The feedback credibility is used to compute the accurateness of feedback data which suggests hop given to the evaluator. Therefore, it is Eq. (27) where, S z y denotes similarity. The similarity measures are defined by determining that the two hops are equivalent. The comparison is calculated via detecting the customized variance depending upon fulfilment rating regarding the communicated agent and later uses the variance rating to describe comparison. Consequently, the comparison of two hops n and n þ 1 ð Þis as follows Eq. (28), S z y n; n þ 1 ð Þ¼ S z yÀ1 n; n þ 1 ð Þþ 1 À S z yÀ1 n; n þ 1 ð Þ x ; if R z y n; n þ 1 ð Þ< l S z yÀ1 n; n þ 1 ð Þþ S z yÀ1 n; n þ 1 ð Þ d ; otherwise where l denotes comparison deviation constant, E denotes collection of agents, x and d denote reward and punishment factors, and R z y n; n þ 1 ð Þdenotes customized variance as follows Eq. (29), R z y n; n þ 1 ð Þ¼ ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi P a2E n;nþ1 ð Þ fun z y n; a ð ÞÀ fun z y n þ 1; a ð Þ x) Forwarding Rate Factor: The nodes in WSN have lesser energy distribution while transferring and sensing the information. Therefore, the collection of information finds out the possibility for examining and judging whether the node is assailed or not. Therefore, it is equated as follows Eq. (30), where, A z n; n þ 1 ð Þdenotes the number of feedback packets, B z n; n þ 1 ð Þdenotes the number of packets to forward, n indicates calculation hop, and n þ 1 represents hop to be estimated. xi) Integrity Factor: If the data packet is relocated to an adjacent node, the S node studies whether the data packet interferes or not and finds whether the data packet is relocated in a particular time and guarantees reliability and accuracy of the data packet information. It is given by Eq. (31), where, U z n; n þ 1 ð Þdenotes the amount of wholly forwarded packets and E z n; n þ 1 ð Þdenotes the number of packets to forward.
Simultaneously, under 150 nodes, the QFO-MOSR technique has reached a lower packet loss of 0.0308, whereas the FEAR, P-SEP, QACMOR, and AFA models have exhibited higher packet loss 0.215, 0.16, 0.08, and 0.06, respectively. Along with that, under 300 nodes, the QFO-MOSR technique has reached a lower packet loss of 0.0628, whereas the FEAR, P-SEP, QACMOR, and AFA models have exhibited higher packet loss of 0.279, 0.23, 0.17, and 0.14, respectively. Eventually, under 500 nodes, the QFO-MOSR methodology has reached a lower packet loss of 0.1267, whereas the FEAR, P-SEP, QACMOR, and AFA techniques have exhibited higher packet loss 0.489, 0.28, 0.26, and 0.22 correspondingly.

Conclusion
This paper has developed an effective QFO-MOSR protocol for Fog-based WSN. The proposed QFO-MOSR protocol derives an optimal set of routes to the destination using a fitness function involving seven parameters. The QFO-MOSR technique is derived from the concepts of quantum computing and the FF optimization algorithm. The proposed routing technique derives a fitness function including trust factor from ensuring security. To investigate the effectual outcome of the QFO-MOSR technique, simulations occur, and results are examined under diverse dimensions. The experimental analysis ensured that the QFO-MOSR technique is superior to other methods in terms of different measures. Therefore, it can be employed as an effective tool in several real-world applications. As a part of future work, the secrecy of the Fog-bases WSN can be guaranteed using the design of deep learning-based intrusion detection methodologies.
Funding Statement: The authors received no specific funding for this study.