## 2 System Model and Problem Formulation  
We define a primary transmitter (PT) and its corresponding primary receiver (PR) as a PL; a secondary transmitter (ST) and its corresponding secondary receiver (SR) are referred to as an SL. This paper considers a scenario with multiple PLs and SLs. Figure 1 illustrates an example of our system model and its corresponding frame structure as an application for D2D communications in cellular networks based on OFDMA. In this example, a CU and the BS serve as a PL, while a D2D pair--consisting of a D2D transmitter (DT) and a D2D receiver (DR)--acts as an SL. A D2D pair can opportunistically access licensed bands in the overlay mode. Since cellular downlink transmission operates at relatively high power levels and has a sufficient energy budget, our focus will be on uplink transmission. For simplicity, the transmission directions of all the SLs remain unchanged. We denote \(\mathcal{P}=\{\rho_{1},\ldots,\rho_{M}\}\) and \(\mathcal{S}=\{\mathit{s}_{1},\ldots,\mathit{s}_{N}\}\) as the sets of the PLs and SLs, where \(M=|\mathcal{P}|\) and \(N=|\mathcal{S}|\). A list of the main symbols in this paper can be found in Table 2. \begin{table}
\begin{tabular}{c c c} \hline
**Comparison Dimension** & **Prior Work**[30] & **Current Work** \\ \hline Scenario & Cooperative spectrum sharing & Overlay spectrum sharing \\ Methodology & [PERSON]’s method + graphical method & [PERSON]’s method + KM algorithm \\ Optimization goal & WSP minimization & WSP minimization \\ Solution type & Low-complexity, suboptimal & Optimal \\ \hline \end{tabular}
\end{table} 
Table 1: Comparison between [30] and the current work. Figure 1: An illustration of system model and corresponding frame structure with two matched PL-SL pairs (The ellipses in the figure represent additional RBs or subframes not explicitly shown). \begin{table}
\begin{tabular}{c c} \hline \hline
**Symbol** & **Definition** \\ \hline \(\mathcal{P}\) & PL set \\ \(\mathcal{S}\) & SL set \\ \(M\) & Number of PLs \\ \(N\) & Number of SLs \\ \(\rho_{m}\) & PL \(m\) \\ \(\beta_{n}\) & SL \(n\) \\ \(\Delta p\) & Granularity of power levels \\ \(\Delta\theta\) & Granularity of spectrum-sharing factor levels \\ \(n_{0}\) & Additive white Gaussian noise power density \\ \(g_{\mu,m}\) & Channel gain between PT \(m\) and PR \(m\)(the BS) \\ \(g_{\beta,n}\) & Channel gain between ST \(n\) and SR \(n\) \\ \(p_{\rho,mn}\) & Transmit power of PT \(m\)(when \(\rho_{m}\) matches with \(\beta_{n}\)) \\ \(p_{\delta,mn}\) & Transmit power of ST \(n\) \\ \(\theta_{mn}\) & Spectrum-sharing factor for \(\rho_{m}\) and \(\beta_{n}\) \\ \(S_{\rho,mn}\) & Achievable SE of \(\rho_{m}\) within one subframe \\ \(S_{\delta,m}\) & Achievable SE of \(\beta_{n}\) within one subframe \\ \(P_{\rho,mn}\) & Power consumption of \(\rho_{m}\) within one subframe \\ \(P_{\delta,mn}\) & Power consumption of \(\beta_{n}\) within one subframe \\ \(\alpha_{mn}\) & Matching indicator for \(\rho_{m}\) and \(\beta_{n}\) \\ \(\mu_{m}\) & Weight of \(\rho_{m}\) \\ \(v_{n}\) & Weight of \(\beta_{n}\) \\ \(Q_{\rho,m}\) & QoS requirement of \(\rho_{m}\) \\ \(Q_{\delta,n}\) & QoS requirement of \(\beta_{n}\) \\ \(p_{min}\) & Minimum transmit power \\ \(p_{max}\) & Maximum transmit power \\ \(w_{mn}\) & WSP of link pair \(\rho_{m}\) and \(\beta_{n}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: List of main nomenclature. In LTE and 5G NR, resource blocks (RBs) are the basic units of wireless time-frequency resources allocated to user equipment (UE). Generally, the PR, i.e., the BS, allocates a single RB or contiguous RBs to a PT, i.e., a CU [31]. In this paper, referring to [12; 19], the number of RBs is assumed to equal \(M\), and the BS only assigns one RB to one PL. Furthermore, each SL can access only one RB, while the PL allows only one SL to occupy its RB, so the orthogonality of spectrum resources can be preserved. Our frame structure is compatible with LTE and 5G NR.