## 4 DeepFogSim: The Considered System Model
### The Underlying Resource Allocation Problem
Hence, after introducing the dummy position \(\left[z\right]_{a}^{b}\triangleq\max\{a,\min\{z,b\}\}\), the \((k+1)\)-th update of the \(i\)-th scalar component \(x_{i}\), \(i=1,\ldots,(2Q+M-1)\) of the resource vector \(\vec{x}\) reads as:  
\[x_{i}^{(k+1)}=\left[x_{i}^{(k)}-\alpha_{i}^{(k)}\frac{\partial\mathcal{L}\! \left(\vec{x}^{(k)},\vec{\widetilde{\lambda}}^{(k)}\right)}{\partial x_{i}} \right]_{0}^{x_{i}},\quad k\geq 0,\ \ i=1,\ldots,2Q+M-1, \tag{24}\]  
while the \((k+1)\)-ththe iterations in (24) and (25), we implemented the following \"clipped\" relationships for updating the step sizes in (24) and (25):  
\[\alpha_{i}^{(k)}=\max\biggl{\{}a_{MAX};\,\min\biggl{\{}a_{MAX}\times\left(x_{i}^ {(MAX)}\right)^{2}\!;\,\left(x_{i}^{(k)}\right)^{2}\biggr{\}}\biggr{\}},\quad i=1,\ldots,2Q+M-1, \tag{26}\]  
and  
\[\xi_{i}^{(k)}=\max\biggl{\{}a_{MAX};\,\min\biggl{\{}a_{MAX}\times\max_{i} \biggl{\{}\left(x_{i}^{(MAX)}\right)^{2}\biggr{\}};\,\left(\lambda_{m}^{(k)} \right)^{2}\biggr{\}}\biggr{\}},\quad m=1,\ldots,M. \tag{27}\]  
The goal of the clipping factor \(a_{MAX}\) is to avoid both too small and too large values of the step-size in (24) and (25), in order to guarantee a quick self-response to operative changes and small oscillations in the steady state. _Remark--On the generality of the considered resource allocation problem and coverage area of the related_ DeepFogSim _toolbox_. Regarding the generality of the resource allocation problem in Equation (23), and then the related coverage area of the implementing _DeepFogSim_ toolbox, we stress that the proposed toolkit is flexible enough to be applied for the calculation of the optimized resource allocation and simulation of the inference phase of the overall family of the conventional (that is, early exit-free) family of the feedforward (convolutional or dense) DNNs [10]. In fact, a direct examination of the tackled optimization problem of Equation (23) leads to the conclusion that it suffices to set:  
* the per-classifier maximum processing frequencies: \(\{\hat{J}_{jm}^{(MAX)},\ j=1,\ldots,m_{m};\ m=1,\ldots,M\}\) in Equation (23d) to zero; and
* the per-exit maximum tolerated inference delays: \(\{T_{EXIT}^{(m)},\ m=1,\ldots,M-1\}\) in Equation (23b) to infinite,  
in order to turn out the afforded resource allocation problem over the CDNN with early exits of Figure 1a into the corresponding resource allocation problem over a conventional early-exit-free DNN equipped with \(L\) (convolutional or dense) layers. Furthermore, by setting the constraint: \(T_{EXIT}^{(M)}\) on the tolerated inference delay of the uppermost \(M\)-th tier in Figure 1b to infinite, then all the delay constraints in Equation (23b) are relaxed. As a consequence, the solutions of the afforded resource allocation problems returned by the _DeepFogSim_ toolbox under this setting are capable of featuring delay-tolerant application scenarios. Overall, the above considerations lead to the conclusion that the proposed _DeepFogSim_ toolbox is capable of properly covering a broad spectrum of delay-sensitive and delay-tolerant resource allocation problems involving both feedforward CDNNs with early exits and conventional early-exit-free DNNs.