## 3 Proposed System Model
### Proposed Solution and Algorithm Design  
The algorithms estimate the total latency and cost from the local model, and also the total latency and cost from the offloading model. In the offloading model, first, the process starts by initializing all the parameters needed for resource allocation, such as the available computational resources, the tasks that need to be performed, and the constraints on the allocation [45]. Second, is the resource allocation problem. This step is implemented to solve the resource allocation problem. It involves assigning tasks to the available computational resources at the edge server in a way that optimizes total latency and meets with the requirement of IoT time constraints. Third is the offloading decisions. Once the resource allocation problem is solved, the next step is to extract the offloading decisions from the solution, which is the local model or the offloading model. Finally, after the decision is selected, the optimal solution can be obtained in terms of energy and latency saving. Figure 2 shows more details of the flowchart of the algorithm in the proposed approach of LDROA. First, the process starts by initializing all the parameters needed for resource allocation, such as the available computational resources, the tasks that need to be performed, and the constraints on the allocation. The next step is to solve the resource allocation problem, which involves assigning tasks to the available computational resources in a way that optimizes some objective function, such as minimizing the total time or energy required to perform the tasks. Once the resource allocation problem is solved, the next step is to extract the offloading decisions from the solution. This involves determining which tasks should be offloaded to edge and which tasks should be performed locally on the device. In some cases, the resource allocation problem may be too complex to solve directly. In these cases, Lagrange Duality can be used to simplify the problem and find an approximate solution. This involves introducing Lagrange multipliers to convert the constraints of the problem into the objective function, which can then be optimized using standard methods. After the resource allocation problem is solved, the computational resources may need to be adjusted to ensure that the tasks are performed optimally. This involves iteratively adjusting the resources and evaluating their performance until the optimal resource allocation is reached. Once the optimal resource allocation is determined, the tasks can be mapped to the allocated resources, and the computation can be performed. If the adjusted resources do not converge to the minimum, the process will need to be repeated until the optimal solution is reached. Algorithm 1 shows the flow of our proposed approach. In the described context, the algorithm focuses on predicting the total cost of local task computation and offloading it to the edge server, taking into account the time constraints of the IoT application. The aim of the algorithm is the prediction of the total cost, which encompasses various factors such as computation expenses, data transmission costs, and resource utilization fees. By accurately estimating these costs, the algorithm can make informed decisions regarding task offloading, ensuring that the chosen strategy aligns with the overarching objectives of minimizing expenses while meeting performance requirements. Importantly, the algorithm considers the unique time constraints inherent in IoT applications, where timely data processing and response are paramount. By incorporating these constraints into the decision-making process, the algorithm ensures that offloaded tasks are executed within the stipulated time limits, thereby guaranteeing the timely delivery of services and maintaining the integrity of the application. The algorithm accounts for the dynamic nature of edge computing environments, where resource availability and network conditions may vary over time.