###### Abstract  
This paper investigates two resource allocation problems in cognitive relaying networks where both secondary network and primary network coexist in the same frequency band and adopt orthogonal frequency division multiplexing (OFDM) technology. The first one is the sum rate maximization problem of a secondary network under total power budget of a secondary network and tolerable interference constraint of a primary network. The second one is the sum rate maximization problem of a secondary network under separate power budgets of a secondary network and tolerable interference constraint of a primary network. These two optimization problems are completely different from those in traditional cooperative communication due to interference management constraint condition. A joint optimization algorithm is proposed, where power allocation and subcarrier pairing are decomposed into two subproblems with reasonable cost. The first one is a closed form solution of power allocation of the secondary network while managing the interference to a primary network  
secondary users was optimized. The authors proved the equivalence of throughput maximization and delay minimization and developed a line search method. Different from traditional power allocation in previous works, the authors in [4] chose the number of power levels as optimization variables to define the throughput of secondary users. An energy efficiency problem was studied in [5] in cognitive relay networks with energy harvesting, where the secondary user was allowed to collect energy from the primary user. The goal of [6] was to obtain an approximate symbol error probability in a multi-antenna relay system. However, the direct link between a source and a relay was absent. Although a direct link was included in [7], power allocation was absent due to the simplicity in the process of deriving approximate symbol error probability. Incorporation of orthogonal frequency division multiplexing (OFDM) technology in broadband communications can alleviate multipath fading against fluctuating channel conditions. In [8], the optimal power allocation, subcarrier pairing, and relay selection matrix were found in OFDM cognitive two-way relay networks with imperfect spectrum sensing. However, the authors in [8] operated a discrete searching method instead of a closed form solution to find optimal power due to the complex rate formula in the presence of imperfect spectrum sensing. In addition, the step size needs to be adjusted according to the actual implement to ensure the power precision. A similar sum rate maximization problem of secondary users was considered in [9] in OFDM based two-way cognitive relaying networks, where a per subcarrier interference constraint was introduced to protect the primary users. A full duplex relaying mode was provided in [10], where a secondary relay established a two-way link for a pair of primary users. As a reward, this full duplex relay station acted as a secondary user and transmitted its own messages with the remaining OFDM subcarriers. This mutually beneficial cooperation not only satisfied the requirements of primary users, but also benefited secondary users. A carrier aggregation technology was investigated in [11] to overcome spectrum limitation challenges. Different frequency bands were treated differently: low frequency band for direct link and high frequency band for dual-hop link. A bit error rate constraint was incorporated in [12] in OFDM based cooperative cognitive radio networks, where the secondary user adapted its constellation size according to the distance to primary user. The heterogeneous genetic algorithm was adopted in [13] to resolve a non convex problem in cognitive decode and forward (DF) relay networks. An interference control problem was proposed in [14; 15] in cognitive radio networks, but they were both based on traditional point to point communication instead of cooperative communication. In [16], the system capacity was optimized under the constraints of total power and interference level.