## 4 Problem Formulation  
The purpose of this work is to improve network coverage by D2D cooperative relay communications with the aim of maximizing the total EE of the two-hop D2D TR pairs, while simultaneously satisfying the QoS requirements of both D2D and cellular links. Relay selection, spectrum allocation and power control are optimization variables or methodologies rather than the optimization objectives. To achieve the EE maximization, we need to design an approach to jointly optimize relay selection, spectrum allocation and power control for the two-hop links. We employ a four-dimensional variable \(\mathcal{X}=\{X_{m,r,c_{f},c_{s}}\}\) to denote the allocation of relay and spectrum resources, where \(m\in\mathcal{M}=\{1,2,\cdots,M\},X_{m,r,c_{f},c_{s}}\in\{0,1\}\). If \(X_{m,r,c_{f},c_{s}}=1\), the signal transmitted from TX \(m_{t}\) to RX \(m_{r}\) is relayed by RS \(r\), and meanwhile, RB \(c_{f}\) and RB \(c_{s}\) are reused by the first hop and the second hop D2D links, respectively. We define the EE as the ratio of SE to the total power consumption. The definition of SE is how many bits can be transmitted per second per Hz. The system bandwidth is 5 MHz in simulations. Then, the total throughput needs to be divided by the system bandwidth to derive the SE. Therefore, when \(X_{m,r,c_{f},c_{s}}=1\), the EE of the two-hop D2D link can be obtained by:  
\[EE_{m,r,c_{f},c_{s}}=\frac{\log_{2}\left(1+\gamma_{m_{t},m_{r}}\right)}{P_{m_{t }}+P_{r}+2P_{cir}}, \tag{6}\]  
and substituting (3) into (6), we have:  
\[EE_{m,r,c_{f},c_{s}}=\frac{\log_{2}\left(1+\frac{\gamma_{r}\gamma_{m_{r}}}{ \gamma_{r}+\gamma_{m_{r}}+1}\right)}{P_{m_{t}}+P_{r}+2P_{cir}}, \tag{7}\]  
where \(P_{cir}\) is the circuit power of D2D TXs or RSs. The numerator of (6), i.e., \(\log_{2}\left(1+\gamma_{m_{t},m_{r}}\right)\), represents the SE, which is calculated based on the effective SINR of the two-hop D2D link, defined by (3). The denominator of (6), i.e., \(P_{m_{t}}+P_{r}+2P_{cir}\), represents the total power consumption, which consists of the transmission power of D2D TX, the transmission power of RS and the circuit power. Based on the above derivation, we jointly design the binary allocation variable \(\{X_{m,r,c_{f},c_{s}}\}\), the continuous power variables \(P_{m_{t}}\) and \(P_{r}\) to maximize the total EE of the two-hop D2D links, thus formulating a mixed integer nonlinear programming (MINLP) problem as:  
\[\max_{\{P_{m_{t}},P_{r},\mathcal{X}\}}\sum_{m=1}^{M}\sum_{r=1}^{R} \sum_{c_{f}=1}^{C}\sum_{c_{s}=1}^{C}X_{m,r,c_{f},c_{s}}EE_{m,r,c_{f},c_{s}}\] (8) s.t. \[\quad\quad C1:P_{min,m_{t}}\leq P_{m_{t}}\leq P_{max,m_{t}},\forall m _{t}\in\mathcal{M}_{T},\] \[\quad\quad\quad P_{min,r}\leq P_{r}\leq P_{max,r},\forall r\in \mathcal{R},\] \[\quad\quad C2:X_{m,r,c_{f},c_{s}}\in\{0,1\},\forall m\in \mathcal{M},r\in\mathcal{R},c_{f},c_{s}\in\mathcal{C},\] \[\quad\quad C3:\sum_{r\in\mathcal{R},c_{f},c_{s}\in\mathcal{C}}X_{ m,r,c_{f},c_{s}}\leq 1,\forall m\in\mathcal{M},\] \[\quad\quad\quad\quad\sum_{m\in\mathcal{M},c_{f},c_{s}\in\mathcal{C }}X_{m,r,c_{f},c_{s}}\leq 1,\forall r\in\mathcal{R},\] \[\quad\quad\quad\quad\sum_{m\in\mathcal{M},c_{f}\in\mathcal{R}}X_{ m,r,c_{f},c_{s}}\leq 1,\forall c_{f},c_{s}\in\mathcal{C},\] \[\quad\quad C4:min\left(\gamma_{r},\gamma_{m_{r}},\gamma_{m_{t},m_{ r}}\right)\geq\gamma_{min}^{D},\] \[EE_{m,r,c_{f},c_{s}}=\frac{\log_{2}\left(1+\frac{\gamma_{r}\gamma_{m_{r}}}{ \gamma_{r}+\gamma_{m_{r}}+1}\right)}{P_{m_{t}}+P_{r}+2P_{cir}}, \tag{7}\]0 \[EE_{m,r,c_{f},c_{s}}=\frac{\log_{2}\left(1+\frac{\gamma_{r}\gamma_{m_{r}}}{ \gamma_{r}+\gamma_{m_{r}}+1}\right)}{P_{m_{t}}+P_{r}+2P_{cir}}, \tag{7}\]1  
\(C1\) gives the transmit power constraints of D2D TXs and RSs. \(P_{min,m_{t}}\), and \(P_{max,m_{t}}\) represent the lower and upper bounds on the transmit power for D2D TX \(m_{t}\). \(P_{min,r}\) and \(P_{max,r}\) represent the lower and upper bounds on the transmit power for RS \(r\).