## 5 Proposed Model
### MTD-Based Secure Two-Way Routing
Furthermore, the fitness score \(\mathrm{fi}(. )\) can be computed by updating the \(\mathrm{b}^{\mathrm{rob}(j)}_{t}\), which can be formulated as:  
\[\mathrm{b}^{\mathrm{ro}b(j)}_{t}= \begin{cases}\mathrm{r}^{j}_{t}&\mathrm{iff} \mathrm{(r}^{j}_{t+1})\geq\mathrm{fi}\Big{(}\mathrm{b}^{\mathrm{rob}(j)}_{t} \Big{)}\\ \mathrm{b}^{\mathrm{rob}(j)}_{t}&\mathrm{iff}\mathrm{(r}^{j}_{t+1})<\mathrm{fi} \Big{(}\mathrm{b}^{\mathrm{rob}(j)}_{t}\Big{)}\end{cases}  \tag{27}\]  
In the second case, the optimal routes can be determined based on energy value, link stability, and direction of the routes. At that case, the route position can be updated by:  
\[\mathrm{r}^{j}_{\mathrm{t+1}}=\mathrm{tdis}^{t}[(\mathrm{up}_{\mathrm{i}}- \mathrm{lb}_{\mathrm{i}})\mathrm{RA}+\mathrm{lb}_{\mathrm{i}}] \tag{28}\]  
In this case, there is better knowledge on selecting the optimal routes in the SDWSN environment. To further improve the global and local search rate, the optimal routes can be obtained by computing the energy value, link stability, direction, and trust value. Algorithm 4 provides the detailed pseudocode for AFT-based optimal route selection. In that case, the optimal route position can be updated by:  
\[ro^{j}_{t+1}=gl^{best}-\Big{[}tdis^{t}\Big{(}besl^{j}_{t}-\mathrm{b}^{\mathrm{ ro}j}_{t}\Big{)}RA^{1}+tdis^{t}\Big{(}\mathrm{b}^{\mathrm{ro}j}_{t}-\mathrm{b}^{ \mathrm{ro}b(j)}_{t}\Big{)}RA^{2}\Big{]}sgn(RA-0.5) \tag{29}\]Once the set of multiple optimal routes is determined, the optimal routes are ranked using the MCDM algorithm based on metrics such as link stability (\(\mathrm{ls}\)), direction (\(\mathrm{dir}\)), trust (\(\mathrm{tru}\)), and energy (\(\mathrm{ene}\)). The proposed MCDM utilized the Topsis method for ranking the optimal routes. At first, the assessment matrix is created with e-alternatives and q-criteria, which can be denoted as \(\big{(}\mathbb{y}_{\bar{\mathrm{ii}}}\big{)}_{e\times\mathrm{q}}\). The matrix \(\big{(}\mathbb{y}_{\bar{\mathrm{ii}}}\big{)}_{e\times\mathrm{q}}\) gets normalized using formulation  
\[\mathrm{Nor}_{\bar{\mathrm{ii}}}=\frac{\mathbb{y}_{\bar{\mathrm{ii}}}}{\sqrt{ \sum_{k=1}^{n}\mathbb{y}_{\bar{\mathrm{ki}}}^{2}}},\,\mathrm{j}\in[1,n],\mathrm{ i}\in[1,m] \tag{30}\]  
From Equation (30), the normalized route matrix can be denoted as \(\mathbb{N}=\big{(}\mathrm{Nor}_{\bar{\mathrm{ii}}}\big{)}_{e\times\mathrm{q}}\). Once normalized, the weights are provided for every route based on their criteria \(\mathrm{We}_{\bar{\mathrm{i}}}\in[0,n]\) in which the n determines the n-number of selected optimal routes. Upon providing the weights for the route criteria, the normalization performed for the weighted matrix can be formulated as:  
\[\mathrm{Nwe}_{\bar{\mathrm{ji}}}=\mathbb{y}_{\bar{\mathrm{ii}}}\frac{\mathrm{ We}_{\bar{\mathrm{i}}}}{\sqrt{\sum_{k=1}^{n}\mathrm{We}_{k}}} \tag{31}\]  
where \(\mathrm{Nwe}_{\bar{\mathrm{ji}}}\) denotes the normalized weight matrix. After that, we tend to obtain the best and worst route criteria from the weighted matrix that can be denoted as \(\mathrm{Nwe}_{\mathrm{best}}\) and \(\mathrm{Nwe}_{\mathrm{worst}}\), respectively. Based on that, we have determined the L2 norm distance among the \(\mathrm{Nwe}_{\bar{\mathrm{ji}}}\) as well as \(\mathrm{Nwe}_{\mathrm{best}}\) and \(\mathrm{Nwe}_{\mathrm{worst}}\).