# Deep Reinforcement Learning-Based Video Offloading and Resource Allocation in NOMA-Enabled Networks
## 3 System Model
### Problem Formulation  
In order to optimize multiple conflicting goals equally, a common approach is to give different weights to these conflicting goals, and then to weigh and sum the goals. In this article, improving user accuracy and reducing processing latency are the basic goals. According to the reference [46], the analytical accuracy \(\varphi_{m}\) of task \(D_{m}\) is expressed as the ratio of the number of objects that are correctly identified to the total number of objects in a video frame, which can be expressed as  
\[\varphi_{m}=1-1.578e^{-6.5\times 10^{-3}\eta_{m}}, \tag{10}\]  
which is widely used in the relevant references [47; 48; 49]. Combined with Equations (4) and (6), the total latency generated by UE \(m\) offloaded to the MEC server is composed of the transmission delay and computation delay, which can be expressed as  
\[t_{m}^{off}=t_{m}^{U}+t_{m}^{C}=\frac{l_{m}}{R_{m}}\cdot\frac{1}{\gamma_{m}}+ \frac{c_{m}}{\kappa_{m}F}, \tag{11}\]  
Combined with Equations (5) and (7), the total energy consumption generated by UE \(m\) offloaded to the MEC sever is composed of transmission energy consumption and computation energy consumption, which can be expressed as  
\[e_{m}^{off}=e_{m}^{U}+e_{m}^{C}=p_{m,k}\cdot t_{m}^{U}+v\cdot(\kappa_{m}F)^{2} \cdot c_{m}, \tag{12}\]  
According to the assigned calculation model and communication model, the total latency required for task \(D_{m}\) to be processed at \(t\) is expressed as  
\[T_{m}=\left(1-\sum\limits_{n=1}^{N}x_{m,n}\right)t_{m}^{loc}+\sum\limits_{n=1} ^{N}x_{m,n}t_{m}^{off}, \tag{13}\]  
At the same time, the total energy consumption of the task \(D_{m}\) at \(t\) can be expressed as  
\[E_{m}=\left(1-\sum\limits_{n=1}^{N}x_{m,n}\right)e_{m}^{loc}+\sum\limits_{n=1} ^{N}x_{m,n}e_{m}^{off}, \tag{14}\]  
The states and video content are constantly changing, causing the offloading decision and resource allocation strategies to need to be constantly adjusted to accommodate the dynamics of our environment. When designing adaptive algorithms, our goal is to optimize the cost function, consisting of delay \(T_{m}\), energy consumption \(E_{m}\), and video analysis accuracy \(\varphi_{m}\), under long-term resource constraints. Based on the design of the utility function in [47], the cost minimization function can be modeled as  
\[ \begin{array}{rl}\min&\frac{1}{m}\sum\limits_{m=1}^{M}[\omega_{t}T_{m}+ \omega_{e}E_{m}-(1-\omega_{t}-\omega_{c})\varphi_{m}]\\ s.\ t.&C_{1}:x_{m,n}\in\{0,1\},\forall m\in\mathcal{M},n\in\mathcal{N}\\ &C_{2}:\sum\limits_{n=1}^{N}x_{m,n}\leq 1,\forall m\in\mathcal{M},n\in \mathcal{N}\\ &C_{3}:T_{m}\leq T_{m}^{\max},E_{m}\leq E_{m}^{\max},\forall m\in\mathcal{M}\\ &C_{4}:0<g_{m,k}\leq P_{m}^{\max},\forall m\in\mathcal{M},k\in\mathcal{K}\\ &C_{5}:\sum\limits_{m=1}^{M}\kappa_{m}\leq 1,\forall m\in\mathcal{M}\\ &C_{6}:\eta_{m}\geq\eta_{m}^{\min},\forall m\in\mathcal{M}\end{array} . \tag{15}\]  
In the cost function, \(\omega_{t}\) is the weight for the delay, and \(\omega_{c}\) is the weight for the energy consumption, where \(\omega_{t}+\omega_{e}<1\). Constraint \(C_{1}\) in the objective function guarantees that a UE can only be assigned to a NOMA cluster. Constraint \(C_{2}\) denotes that the UEs can only select computed locally or offloaded to the MEC server. Constraint \(C_{3}\) ensures that themaximum total delay of UE \(m\) must be less than the tolerance time \(T_{m}^{max}\) of task \(D_{m}\), and the total energy consumption of UE \(m\) cannot exceed the threshold \(E_{m}^{max}\). Constraint C\({}_{4}\) guarantees that the transmit power of UE \(m\) cannot exceed the threshold \(P_{m}^{max}\). Constraint C\({}_{5}\) ensures that the allocated computation capacity cannot exceed the total capacity of the MEC server. Constraint C\({}_{6}\) guarantees that the minimum video frame resolution of task \(D_{m}\) must be higher than the threshold \(\eta_{m}^{\min}\).