# D2D-Assisted Adaptive Federated Learning in Energy-Constrained Edge Computing
## 3 System Model and Problem Formulation
Thus, at any given time and among the servers participating in FL, at most \(Z_{1}\) servers are allowed to directly upload to the aggregation server without violating bandwidth capacity limitations, while at most \(Z_{2}\) servers can conduct D2D interactions. Differently from existing studies that are limited to one-to-one D2D communication, we consider that all servers are equipped with broadband wireless receivers, which can support many-to-one D2D communication and receive model parameters from multiple D2D paired servers simultaneously. When server \(n\) obtains a channel to communicate with server \(m\) its transmission rate can be expressed as  
\[r_{n,m}=B\log_{2}\left(1+\frac{p_{n}\xi_{0}d_{n,m}^{-\kappa}}{\sigma^{2}} \right), \tag{3}\]  
where \(p_{n}\) and \(d_{n,m}\) are the transmission power of server \(n\) and the distance between server \(n\) and \(m\), respectively; \(\sigma^{2}\) is the white noise of the channel; \(\xi_{0}\) is the channel gain at a reference distance of one meter; and \(\kappa\) is a constant. Let the the data amount of the model parameters generated by server \(n\) training be \(C_{n}\). Server \(n\) may also act as a relay node in round \(k\). In such a case, it will fuse the parameters passed to it by another client server \(n^{\prime}\) with the model parameters it has trained and then deliver the fusion result to server \(0\). The fused model parameter at server \(n\) is  
\[\omega_{n,k}=\frac{\sum\limits_{n^{\prime}\in\mathcal{N},n^{\prime}\
eq n}\rho _{n^{\prime},n,k}^{\text{del}}|\mathcal{D}_{n^{\prime},k}|\omega_{n^{\prime},k}+\mathbf{1}_{\tau_{n,k}\geq 1}|\mathcal{D}_{n,k}|\omega_{n,k}}{\sum\limits_{n^{ \prime}\in\mathcal{N},n^{\prime}\
eq n}\rho_{n^{\prime},n,k}^{\text{del}}| \mathcal{D}_{n^{\prime},k}|+\mathbf{1}_{\tau_{n,k}\geq 1}|\mathcal{D}_{n,k}|}, \tag{4}\]  
where \(\mathbf{1}_{\hat{z}}\) is an indicator function that equals \(1\) if \(\hat{z}\) is true and is \(0\) otherwise. It is noteworthy that the training and transmission process of server \(n^{\prime}\) and the local training of server \(n\) can be carried out simultaneously. Thus, the time cost for server \(n\) in the \(k\)-th round of FL, which consists of local model training time, D2D model gathering time, and model parameter transmission time, can be calculated as  
\[T_{n,k}=\max_{n^{\prime}\in\mathcal{N},n^{\prime}\
eq n}\left\{\{\rho_{n^{\prime},n,k}^{\text{del}}\mathcal{C}_{n^{\prime}}/r_{n^{\prime},n}+T_{n^{\prime},k}^{ \text{tra}}\},T_{n,k}^{\text{tra}}\right\}+\rho_{n,m,k}^{\text{del}}\mathcal{C} _{n}/r_{n,m}\enspace. \tag{5}\]  
When the FL system runs in a synchronous mode, in each round, the aggregation server needs to obtain the uploaded parameters from the latest client before it can aggregate the model. Therefore, the time consumption of the \(k\)-th round is expressed as  
\[T_{k}=\max_{n\in\mathcal{N}}\{T_{n,k}\}. \tag{6}\]  
Next, we discuss the energy cost of these clients. Let \(e_{n}\) denote the energy cost of server \(n\) to process a unit size of dataset in one local training iteration. The energy consumption of server \(n\) in round \(k\) is  
\[E_{n,k}^{\text{tra}}=\tau_{n,k}e_{n}\cdot|\mathcal{D}_{n,k}|. \tag{7}\]  
Moreover, in addition to the energy consumed by model training, there is also an energy cost when a client transmits model parameters to a relay server or the aggregation server. The transmission energy consumption is expressed as  
\[E_{n,m,k}^{\text{del}}=p_{n}C_{n}/r_{n,m}, \tag{8}\]  
where \(C_{n}\) is the data size of the model parameters trained by server \(n\), and \(m\in\{0\cup\mathcal{N}\}\) and \(m\
eq n\).