# Sustainable Data-Driven Secured Optimization Using Dynamic Programming for Green Internet of Things
## 3 Sustainable Data-Driven Secured Decision Protocol with Dynamic Programming
### Model Discussion  
In this Section, we present a novel solution for routing the IoT data with the support of dynamic programming. The sensors sense the surrounding data and execute the next-hop selection process in a distributed way, unlike most of the proposed solutions that do not track the congestion and traffic-related information in the decision system. Our proposed data-driven model keeps such information while reaching an optimal decision. Accordingly, the SDS-GIoT model offers a sustainable approach to attaining a timely wireless system with load balancing. In the SDS-GIoT model, the nodes are arranged in the multistage graph such that each node has some neighbors until it reaches the destination state. We consider states are denoted by \(S_{i}\) that comprised on \(N_{i}\) and cost \(C_{i}\). The nodes in the same stages cannot communicate with each other. The objective function can be computed by exploring dynamic programming as given in Equation (1). \[f(S_{i},\ N_{i})\rightarrow\ (S_{i+1},K)\,:\,\min\,C(N_{i},K_{i}\ )) \tag{1}\]  
subject to:  
\[K\ \varepsilon\ S_{i+1}\]  
In Equation (1), \(S_{i}\) is the current stage, \(N_{i}\) denotes visited vertex, \(S_{i+1}\) is the next stage, and \(K\) denotes the visited vertex in the next stage. \(C(N_{i},K_{i})\) represents the cost from the vertex \(N_{i}\) to vertex \(K_{i}\). It is an iterative process and is executed until achieving optimal end-to-end routing performance. The SDS-GIoT model performs the main role by cost value to select the optimal path. Unlike most of the existing approaches that choose the routes without adopting the realistic factors for the formulation of the route, the SDS-GIoT model explores traffic prediction for the computation of cost value. With the support of traffic prediction \(TP\), the SDS-GIoT model efficiently identifies the most optimal link for forwarding IoT data. Moreover, along with traffic prediction, it also integrates the priority of link status \(LS\) for nodes \(i,\ j\), as given in Equation (2). \[C(i,\ j)=\ TP+LS \tag{2}\]  
To evaluate priority \(Pr\) for \(LS\), the SDS-GIoT model utilizes the waiting time and packet reception information, as defined in Equation (3). \[Pr(LS)=no.\ of\ packets/waiting\ time \tag{3}\]  
A connection is not taken into account by the decision-making algorithm if the \(Pr\) of \(LS\) is less than a certain threshold. In Equation (3), if waiting time increases, then, accordingly, the priority for a specific link decreases. On the other hand, to determine the \(Pr\) for \(TP\) on the communication link, the SDS-GIoT model utilizes bandwidth \(B\) and queued packets \(P\) as Equation (4). \[Pr(TP)=B/P \tag{4}\]  
According to Equation (4), when the queued packets increase, the priority value of \(TP\) decreases. Also, if \(TP\) is below a specified threshold, the decision-making mechanism excludes that particular communication channel. In the SDS-GIoT model, each node establishes and maintains its routing table and updates it when certain conditions occur. All the nodes are associated with their edge devices and can be monitored intelligently. Whenever residual energy \(e\) of any forwarded node \(fn\) is less than the predefined threshold, then the edge device initiates the request to the source node for route re-formulation, as defined in Equation (5). \[e(fn)<\ threshold;RREQ=true \tag{5}\]Figure 2 depicts the flowchart of the SDS-GIoT model for sustainable routing using dynamic programming. The main phases are multistage graphs, initiate iterative routing, cost function, and route updating. In the beginning, nodes are arranged in multistage graphs and divide the network structure into stages. Then, the source node needs to determine the optimal node in the next stage dynamically, and this process is iterative until data are delivered to their destination. Moreover, the cost function is a key parameter in achieving a sustainable and efficient routing scheme.