## 3 System Model  
Let us consider having a set \(\mathcal{U}\) composed of \(N\) users and a set \(\mathcal{V}\) composed of \(M\) videos available for their requests. The deployed network is composed of a set \(\mathcal{F}\) of \(K\) fog nodes; in addition, one remote cloud facility is considered. Each user is able to request one video with a certain quality level, so that each request can be mapped to a given target quality level, identifying the user request QoE. We consider that there are a limited number of quality levels corresponding to \(Q\) where \(q=1\) corresponds to the worst quality and \(q=Q\) corresponds to the highest quality. Let us define \(\rho_{n}=\langle m,q\rangle\) as the tuple identifying the requested \(m\)th video with the \(q\)-level quality by the \(n\)th user. By leveraging on the distributed fog nodes facility, each video is supposed to be segmented, where the \(m\)th video is segmented in \(P_{m}\) segments whose size can be fixed or change depending on the considered encoder and video characteristics [29]. Moreover, transcoding and scalability functions are foreseen to be used in the deployed scenario. While transcoding allows to receive a given video segment with a target quality lower than that of the video already deployed, the scalability allows to request an enhanced video stream able to cope with the missing information for achieving higher quality with respect to the quality of the stored video. We can consider an allocation matrix \(A(k,p_{m})\) as a function allowing us to map the presence of the \(p_{m}\)-th segment belonging to the \(m\)-th video on the \(k\)-th fog node. Since each segment can be stored with different quality levels, it is possible to define the allocation matrix as:  
\[A(k,p_{m})= \begin{cases}q&\text{if $C_{1}$ is true}\\ 0&\text{otherwise}\end{cases}  \tag{1}\]  
where \(C_{1}\) is the condition stating that the \(p_{m}\)-th segment belonging to the \(m\)-th video is stored on the \(k\)-th fog node with quality level \(q\). Since fog nodes are supposed to be storage-capacity constrained, a maximum amount of data can be stored in each node. Let us assume that the generic \(k\)-th node can buffer up to \(B_{k}\) bytes. Based on the video request table \(\mathbb{P}\), composed by \(n\) records, each one identifying the video and the quality requested by each user, each video segment will be mapped on a given fog node in order to minimize the overall delay for receiving the requested video from the user's side. To this aim, the cost of any deployment configuration can be modeled as the overall time needed for receiving all the segments of the requested video with the target quality level  
and \(d_{p_{m}}^{\dagger}\) is the size of the \(p_{m}\)-th segment of the \(m\)-th video with quality level \(q\), \(r_{i,j}\) is the data rate between node \(i\) and node \(j\), \(\bar{q}_{n}\) is the target quality of user \(n\), and \(\delta_{tc}(d_{p_{m}}^{\dagger},d_{p_{m}}^{\dagger n})\) is the time requested for transcoding the segment \(d_{p_{m}}^{\dagger}\) to the target quality segment \(d_{p_{m}}^{\dagger n}\). Figure 1 depicts the architecture of the proposed fog-assisted DASH scenario. We have considered having one transcoding node, identified with index \(T\) able to process multiple segments at the same time. This node can be identified with an edge computing facility collocated with the access point (AP) in the area. Moreover, a remote cloud facility is considered, as identified with index \(0\), where the up-scaling data are stored, identified as \(d_{p_{m}}^{(\bar{q}_{n}-q)}\), needed for scaling up the quality from level \(\bar{q}_{n}\) to level \(q\). The data rate of the links is a function of the distance between node \(i\) and node \(j\) such as:  
\[r_{i,j}=r\cdot\left(\frac{10}{d_{i,j}}\right)^{2} \tag{4}\]  
derived from the log-distance path loss model [30].