## 7 Performance Evaluation
### Resource and Energy Distribution Returned by DeepFogSim
In order to provide fair comparisons, Figure 14b presents the bar plots of the total energy \(\mathcal{E}_{TOT}^{(MAX)}\), computation energy \(\mathcal{E}_{COP}^{(MAX)}\), and network energy \(\mathcal{E}_{NET}^{(MAX)}\) consumed in the case that all the available resources are set to their maximum values: \(f_{ij}^{(MAX)}\), \(\tilde{f}_{jm}^{(MAX)}\), and \(R_{m}^{(MAX)}\). These energies are evaluated by the _Static_Allocation_ function described in Section 5.2 and presented in Algorithm 2. A comparison of plots in Figure 14a,b demonstrates the noticeable energy saving offered by the adaptive Algorithm 1 implemented by the _DeepFogSim_ toolkit. Figure 11: Traces under topology \(T1\) of the: (a) transmission rates and (b) Lagrange multipliers. A synoptic view of the energy consumption under topology \(T1\), compared to the static allocation solution and the ratios between these two solutions, is analytically presented in the first row of Table 6. This table also shows the ratio between the optimized network energy and the total one: \(\mathcal{E}_{NET}^{(best)}/\mathcal{E}_{TOT}^{(best)}\). Regarding the network topology \(T2\), we have numerically ascertained that traces similar to those of the previous Figures 9-14 are obtained; hence, we do not show them here. However under topology \(T2\), Algorithm 1 converges within only 23 iterations. Once again, the number of needed iterations is very small. The energy performance under the network topology \(T2\) is also summarized in Table 6 (see the second row). Moreover, this table also presents the energy performance under topologies \(T1\) and \(T2\) by using a different Layer-to-Tier mapping vector \(\overline{L2T}_{map}^{(0)}\) and different maximum allowable resources. We named this new tested settings as \(T1a\) and \(T2a\), respectively (see the 3 rd and 4 th rows in Table 6). The new sets of values are: \(\overline{L2T}_{map}^{(0)}=[3,\,3,\,3]\), \(f_{im}^{(MAX)}=9\) (Mbit/s), \(\tilde{f}_{im}^{(MAX)}=8\) (Mbit/s), and \(R_{m}^{(MAX)}=8.2\) (Mbit/s) under topology \(T1a\); and \(\overline{L2T}_{map}^{(0)}=[3,\,3,\,2,\,1]\), \(f_{im}^{(MAX)}=9\) (Mbit/s), \(f_{im}^{(MAX)}=8\) (Mbit/s), and \(R_{m}^{(MAX)}=9\) (Mbit/s) under topology \(T2a\). Figure 12: Values under topology \(T1\) of the: (**a**) optimized transmission rates and (**b**) actual-vs.-maximum tolerated delay ratios. By design, the returned optimized resource allocation is feasible if all these ratios are not larger than the unit. An examination of the related rows of Table 6 shows that the adaptive Algorithm 1, in all tested cases, allows a considerable energy saving with respect to the benchmark static one of Algorithm 2. In addition, Table 6 suggests that Fog topologies with higher numbers of tiers generally allow greater savings with respect to topologies with fewer numbers of tiers. This is justified by the fact that better distributions of the workload may be attained over a greater number of nodes at the first tier and greater fractions of the workload undergo to early exit for increasing number of the topology tiers. Figure 14: Values under topology \(T1\) of the: (**a**) optimized energy consumption returned by the \(DynDeF\_RAS\) function and (**b**) energy consumption returned by the _Static_Allocation_ function. Figure 13: Traces under topology \(T1\) of the: (**top**) total energy \(\mathcal{E}_{TOT}\); (**middle**) computing energy \(\mathcal{E}_{COP}\); and (**bottom**) network energy \(\mathcal{E}_{NET}\) returned by the \(DynDeF\_RAS\). An examination of Table 7 confirms that, since, by design, the static allocation strategy fixes at their maxima all the available resources regardless of the actually enforced constraints, then, the corresponding consumed total energy \(\mathcal{E}_{TOT}^{(MAX)}\) does not depend, indeed, on the allowed maximum inference times.