# Social Milieu Oriented Routing: A New Dimension to Enhance Network Security in WSNs
## 3 Algorithm Description
### Problem Representation  
First, some assumptions are given as follows to eliminate some secondary factors, which will increase unnecessary complexity and may influence the performance of the WSNs:  
**Assumption 1**. : _Before searching the OSTP, the values of trust and the recommendation of third party nodes have been already obtained through mining techniques [27]._  
**Assumption 2**. : _Since the transverse Ising spin glass (TISG) model is the simplest model in which quantum effects in a random system can and have been studied extensively and systematically [28], here we concentrate our attention only on the TISG._  
**Assumption 3**. : _The large scale WSNs studied here are symmetric. Symmetric means that each pair of adjacent nodes, trustor and trustee, can reverse their roles without changing their trust values. For example, in Figure 1, we set \(T_{AC}=T_{CA}\)._  
_Definition of Quantum Hamiltonian_  
In the TISG model, the total Hamiltonian can be written as:  
\[H_{OSTP}=H_{pot}+H_{kin} \tag{4}\]  
where \(H_{pot}\) represents the classical potential energy of a given configuration, and \(H_{kin}\) is a suitable kinetic energy operator providing the necessary quantum fluctuations to escape local minima. In QA, we seek to minimize \(H_{pot}\) as side effect of minimizing \(H_{OSTP}\). A suitable configuration is reached if and only if \(H_{pot}\) is zero. In the TISG model, the total Hamiltonian in Equation (4) can be rewritten as:  
\[H_{OSTP}=H_{\text{TISG}}+H_{TF}(t) \tag{5}\]  
where \(H_{\text{TISG}}\) denotes potential energy of TISG model, and \(H_{TF}(t)\) is a fictitious kinetic energy introduced typically by the time-dependent transverse field. Figure 1: An example of WSN. A TISG model consists of a set of spins, each of which can only be in one of two states. Each of these spin variables usually takes on the value of either +1 or -1, also known as an up-spin and a down-spin, respectively. Formally, for a WSNs with \(N\) nodes each configuration of the system (a feasible social trust path) is associated to a \(N\times N\) matrix \(U\) with 0/1 entries in the following way: for each pair of the participants \(m\) and \(n\), if the directed social trust path (an ordered sequence of participants in WSNs) goes through the link between \(m\) and \(n\), then \(U_{mn}=1\), or else \(U_{mn}=0\). Here, for the sake of simplicity, we renumber the independent variables as \(U_{k}(k=1,\,...,K)\) and the other dependent variables can be expressed by using \(U_{k}\). Then, in quantum mechanics, the quantum Hamiltonian of the OSTP selection problem can be expressed as a \(K\)-spins TISG model through the transformation \(U_{k}\rightarrow(1+\sigma_{z}^{k})/2\), where \(\sigma_{z}^{k}\) is the Pauli matrix of qubit \(k\). In addition, the possible social trust paths can be represented by different quantum states of the \(K\) spins:  
\[H_{\text{TISG}}=\sum_{m=1}^{K}v_{m}\sigma_{z}^{m}+\sum_{m=1}^{K}\sum_{n=m+1}^{ K}J_{mn}\sigma_{z}^{m}\sigma_{z}^{n} \tag{6}\]  
where \(m\) and \(n\) represent two randomly selected participants, that is, two qubits in the TISG model, \(v_{m}\) is the off-resonance term related to \(m\), \(\sigma_{z}^{m}\) and \(\sigma_{z}^{n}\) describe the Pauli matrix of qubit \(m\) and \(n\), \(J_{mn}\) denotes the spin-spin coupling between qubit \(m\) and \(n\). We use Figure 2 and Table 1 as a demonstration to describe this kind of correspondence. In Figure 2 four participants compose a WSN: Node 1 is the trustor node; Node 4 is the target trustee node; Node 2 and Node 3 are two intermediate participants. Here, weights of the two QoT parameters (trust and recommendation) are set as \(w_{\text{T}}=0.6\), \(w_{\text{R}}=0.4\), respectively. There are two possible social trust paths between trustorNode1 and trustee Node4, that is, path 1--3--4 and path 1--2--4. The utility values of these two social trust paths determined by the utility function (3) are 0.384 and 0.616, respectively.