# Transmission completion time minimization in digital network coding assisted two-way relay OFDM networks

- Yu Zhang†
^{1}, - Ge Xiong†
^{2}Email author and - Xianwei Zhou
^{3}

**2018**:8

https://doi.org/10.1186/s13638-017-1014-0

© The Author(s) 2018

**Received: **13 August 2017

**Accepted: **18 December 2017

**Published: **5 January 2018

## Abstract

This paper investigates the two-way relay transmission over orthogonal frequency division multiplexing (OFDM) channels using digital network coding. For a given amount of data to be transmitted, we formulate an optimization problem to minimize the total transmission completion time by jointly allocating the power and assigning the subcarriers under individual power constraints. Due to the difficulty to derive the explicit solution to this optimization problem, we decompose it into two subproblems. Then, we design suboptimal algorithms with low complexity for the two subproblems, where subcarriers are assigned firstly and then the power is optimally allocated over the assigned subcarriers. The end-to-end delay is adopted to evaluate the system in a systematic view. Simulation results show that our proposed scheme achieves less than 1.06 times the minimal total transmission completion time achieved by exhaustive search for two-way relay OFDM systems and outperforms non-network coding schemes with a probability over 90%. Moreover, the corresponding distribution regions with performance gain are also discussed by simulations, which may give some insights in the application of network coding in OFDM systems.

## Keywords

## 1 Introduction

### 1.1 Background

Recently, two-way relay model, also termed as bidirectional relay model [1–6], where two sources exchange information via some assisting relays, has attracted more and more attention, because such model has popular applications in modern communication systems, including relay-assisted cellular networks, satellite communications, and peer-to-peer settings in wireless ad hoc networks [1, 6, 7]. Compared with two separated one-way transmissions [8–10], two-way relay transmission can further improve the spectral efficiency and energy efficiency by combining cooperative relay with either superposition coding or network coding [6, 7, 9, 10].

Network coding [11] is capable of exploring signal interference rather than avoiding or canceling it for throughput benefit. Specifically, the signals/data transmitted in the multiple-access stage can be combined at relay nodes and then forwarded to and recovered at the destination nodes in the broadcasting stage. Actually, network coding is applicable to different network levels. Network coding at the packet level is noted as digital network coding (DNC), while at the signal level, it is known as analog network coding (ANC). Over the past decade, both DNC and ANC have been widely investigated in the literature to achieve the maximum possible information flow for wired and wireless networks. A lot of works have shown great advantages of network coding in improving network performance, especially for two-way relay systems [12–15].

Orthogonal frequency division multiplexing (OFDM) is one of the key technologies for next-generation wireless communication systems and has been incorporated in the B3G and 4G standards, because of its high spectral efficiency and its advantages in combating frequency selective fading. Thus, to achieve higher performance for future wireless communications, some works recently started to combine the two technologies in two-way relay systems [16–18]. OFDM is a multi-carrier system, so it usually adopts such a policy to allocate the subcarrier, bit, and power to a flow based on the flow’s channel coefficient of each subcarrier. Thus, it may also provide more opportunities to improve system performance by using adaptive resource allocation with network coding.

### 1.2 Related work and motivations

There have been continuing interest in the resource allocation problem for network coding aware OFDM networks in the literature (see e.g., [19–23]). In [19] and [20], the authors studied the joint optimization problem of subcarrier-pairing-based relay selection, relay power allocation, and subcarrier assignment, where however, the network coding was not taken into account. In [21] and [22], network coding was involved, but only ANC was involved rather than DNC. In [21], the power allocation under total power constraint to maximize the MSR for ANC-based two-way relay networks and, in [22], the subcarrier-paring, relay selection, and power allocation were jointly optimized to maximum the MSR for two-way relay networks. In [23], energy-efficient resource allocation was studied for OFDMA-based two-way relay channel, where the physical-layer network coding was considered.

In [24–27], resource allocation was studied for DNC-based two-way relay OFDM systems. In [24], a multi-cell OFDMA network that comprises types of users were studied, where subcarrier assignment, subcarrier pairing, and power allocation were jointly optimized to maximize the weighted system sum rate. In [25], the transmission policies, including power allocation, transmission mode selection, and subcarrier assignment, were jointly optimized with QoS considerations for bidirectional relay networks. However, their goal was also to maximize the weighted sum rates of the two flows in the system. In [26], a joint subcarrier and power allocation for DF-based multi-user two-way relay networks was investigated. However, their goal was to achieve a low-complexity joint resource allocation scheme to improve the spectrum efficiency with an additional multi-user diversity gain.

In [27], a bit allocation algorithm was designed to minimize the total energy consumption for transmitting a bit successfully in two-way OFDM relay system under the constraints of quality-of-service and total transmit power.

In this paper, we focus on the resource allocation for DNC-based two-way relay networks over OFDM channels. Compared to the aforementioned previous works, some differences in our work are deserved to be stressed as follows.

*Firstly*, in most of the previous works (see, e.g., [22, 23, 25]), it was assumed that the sources always have a constant, stable, and equal mount of data to exchange. Therefore, all the data received at the relay node can be network coded and then forwarded. In real networks, however, different sources often has different traffic characteristics. As such, we consider a more realistic scenario, where the amount of data generated by the two sources within a time period are unequal (i.e., *unbalanced traffic*) and all the generated data is required to be exchanged as soon as possible due to consideration of real-time requirements. *Secondly*, unlike previous works (see, e.g., [25]), our goal is to minimize the total transmission completion time for two-way relay flows to guarantee their fairness by jointly optimizing system resource allocation, including subcarriers, powers, and flows’ transmission rates. As such, we investigate the resource allocation problem for both source phase and relay phase, for accomplishing a whole round of two-way relay transmission. Some of the aforementioned previous works (see, e.g., [23]) considered only the relay stage of the two-way relay transmission. *Thirdly*, in many other works, to achieve more coding opportunities, complex queue management was involved [28], which may lead to higher complexity of system implementation and larger transmission delay for flows. To avoid these types of problems, in our work, we assume that there is no data backlog at the relay node, which means that all data received in the source phase at the relay node must be transmitted in the relay phase. Consequently, complex buffer management and queueing delay can be avoided, and the system will always operate in a stable state. *Fourthly*, in some of previous works, only partial types of system resources are considered. For example, in [21], only system total power constraint was assumed but no subcarrier assignment was considered. Unlike these works, in our work, we consider a joint subcarrier assignment and power distribution resource allocation, where individual power constraints are assumed.

### 1.3 Contributions

*main contributions*of this paper are summarized as below.

- 1.
A two-phase joint resource allocation and network coding transmission protocol is presented to minimize the total transmission completion time for two-way relay flows. To do so, we formulate an optimization problem by jointly taking the resource allocation and flow’s fairness into account under individual power constraints.

- 2.
Since the optimization problem is too difficult to solve, we decompose it into two subproblems corresponding to the two correlated transmission phases. Moreover, we design suboptimal algorithms with low complexity for the two subproblems, where in the source phase, the subcarriers of the system are firstly assigned to the two sources and then the sources transmit their information to the relay simultaneously over their assigned subchannels under their individual power constraint. In the relay phase, the subcarriers are firstly assigned to two types of flows, i.e., the network coded (NC) and uncoded (UC) flows, and then the relay broadcasts the NC flow to the two sources and unicasts the UC flow to the corresponding target source node concurrently over their assigned subchannels under the relay’s power constraint.

- 3.
We consider the end-to-end transmission performance in a systematic view by combining the solutions in the source phase and relay phase together. Simulation results show that our proposed scheme achieves less than 1.06 times the minimal total transmission completion time achieved by exhaustive search for two-way relay OFDM systems and also outperforms non-network coding schemes with a very high probability (over 90%). Besides, the distribution regions of the performance gain are also discussed by simulations, which may give some insights in the application of network coding in OFDM systems.

The rest of this paper is organized as follows: Section 2 describes the system model and the proposed transmission protocol. Section 3 formulates an optimization problem on the basis of the proposed protocol and then decomposes the optimization problem into two subproblems. Section 4 analyzes the subproblems by using convex optimization methods and then gives low-complexity suboptimal algorithms that separate subcarrier assignment and power allocation for solving them. The performance of the proposed scheme is evaluated and compared by simulations in Section 5, and finally, Section 6 concludes this paper.

## 2 System model

*Ideally*, if A and B transmit an equal amount of data to R in the source phase, all data received at R can be XORed and then broadcasted to A and B in the relay phase. In most practical cases, however, two sources may transmit unequal amount of data to each other over the same time period. In these cases, one may apply a buffer at R to temporarily hold arriving data from one source and wait for data from the other source before XOR and broadcasting operation. Such approach may introduce excessive delay, which may not be acceptable to delay-sensitive applications. We assume in this work that all the data generated by two-way relay flows in a certain short time period must be completely exchanged within a round of two-way transmission. That is to say, all the data received at R in the source phase must be forwarded in the relay phase, and thus, no data can be saved at R after a round of transmission.

We adopt an OFDM-based signaling model, where the available frequency band is divided into a set of orthogonal subchannels. The two-way relay transmission over three orthogonal subchannels is illustrated in Fig. 1. In *source phase*, A and B transmit their information to R*simultaneously* over two disjoint sets of subcarriers. In *relay phase*, R performs DNC on the received packets. Since the amounts of the data transmitted by A and B in the source phase may be not equal, only a part of the data can be network coded by R, and the remaining part will not be coded. To forward all the data received in the source phase, R will broadcast the network-coded data to A and B over a common set of subcarriers and unicast the uncoded data to its target receiver over the remaining subcarriers, concurrently. Note that each subcarrier is only allowed to be assigned to one flow in the source phase. So the interflow interference can be completely avoided in source phase.

*N*. \(\overline {P}_{\textsf {\tiny {A}}}\), \(\overline {P}_{\textsf {\tiny {B}}}\), and \(\overline {P}_{\textsf {\tiny {R}}}\) are used to denote the transmission power constraints of A, B, and R, respectively. The transmission powers of flow

*k*on subcarrier

*i*in the source phase is denoted by \(p_{k, i}^{\textmd {\tiny {(I)}}}\), where

*k*∈{A,B} and

*i*=1,...,

*N*, and the transmission power on subcarrier

*i*in the relay phase is denoted by \(p_{g, i}^{\textmd {\tiny {(II)}}}\), where

*g*∈{NC,UC}

^{1}. Then, the instantaneous power distribution vectors

**P**

_{A},

**P**

_{B}and

**P**

_{R}can be expressed as

**P**

_{A}={

*p*A,

*i*(I)}

_{1×N},

**P**

_{B}={

*p*B,

*i*(I)}

_{1×N}, and \(\mathbf{P}_{\textsf {\tiny {R}}}=\left \{p_{g,i}^{\textmd {\tiny {(II)}}}\right \}_{2\times N}\), respectively. Let

*h*A,

*i*(I),

*h*B,

*i*(I),

*h*A,

*i*(II), and

*h*B,

*i*(II) denote the complex channel coefficients at the subcarrier

*i*from A to R, from B to R, from R to A, and from R to B, respectively. The channel gains are assumed to be flat within a subchannel and unchanged over some OFDM frames, so that perfect channel state information of all links is available and the subcarriers and powers can be feasibly allocated by a centralized scheduler for the transmissions. It is assumed that the additive noises at A, B, and R are independent circular symmetric complex Gaussian random variables with zero mean and variance

*n*

_{0}

*W*, where

*n*

_{0}is the power spectral density of the additive white Gaussian noise (AWGN) and

*W*is the bandwidth of a subcarrier. For clarity, we define \(H_{k,i}^{\textmd {\tiny {(I)}}}=\left (\left |h_{k,i}^{\textmd {\tiny {(I)}}}\right |^{2}/(n_{0}W)\right)\) and \(H_{g,i}^{\textmd {\tiny {(II)}}}=\left (\left |h_{g,i}^{\textmd {\tiny {(II)}}}\right |^{2}/(n_{0}W)\right)\) as the carrier-to-noise ratio (CNR) of flow

*k*on subcarrier

*i*in the source phase and the CNR of flow

*g*on subcarrier

*i*in the relay phase, respectively. \(r_{k,i}^{\textmd {\tiny {(I)}}}\) is the transmission rate allocated to flow

*k*at subcarrier

*i*, and \(R_{k}^{\textmd {\tiny {(I)}}}\) is the total rate achieved by flow

*k*in the source phase. Then, we have

*θ*

_{ k,i }∈{0,1} indicate whether subcarrier

*i*is assigned to flow

*k*or not. If subcarrier

*i*is assigned to flow

*k*,

*θ*

_{ k,i }=1. Otherwise,

*θ*

_{ k,i }=0. Since each subcarrier is only allowed to be assigned to one flow,

*θ*

_{A,i}+

*θ*

_{B,i}=1. Moreover, suppose that the traffic transmitted by A and B in the source phase are

*M*

_{A}and

*M*

_{B}, respectively. Then, the minimum required transmission completion time of the source phase is

*M*

_{NC}= min(

*M*

_{A},

*M*

_{B}) and the amount of UC traffic is

*M*

_{UC}=|

*M*

_{A}−

*M*

_{B}|, where |·| is the absolute value operator. Since broadcast’s transmission rate is bounded by the channel with lower achievable rate in the relay phase, the transmission rate on the

*i*th subcarrier when allocated to coded data is given by

*i*th subcarrier when allocated to uncoded data, i.e.,

*g*=UC, is given by

*g*in the relay phase is then given by

*ϕ*

_{ g,i }∈{0,1} is the subcarrier assignment indicator variable of the

*i*th subcarrier in the relay phase. If subcarrier

*i*is assigned to coded data, i.e.,

*g*=NC,

*ϕ*

_{NC,i}=1. When subcarrier

*i*is assigned to uncoded data, i.e.,

*g*=UC,

*ϕ*

_{UC,i}=1. Similar to source phase, since each subcarrier is only allowed to be assigned to one flow in the relay phase, the transmission completion time of relay phase is given by

Obviously, the total transmission completion time to accomplish a round of two-way transmission is *D*_{Tot}=*D*_{I}+*D*_{II}.

## 3 Problem formulation and decomposition

*D*

_{Tot}of one-round two-way relay transmission for a given source traffic

*M*

_{A}and

*M*

_{B}. Therefore, we formulated an optimization problem as

where Θ={*θ*_{
k,i
}}_{2×N} and Φ={*ϕ*_{
g,i
}}_{2×N} are the subscarrier assignment indicator vectors of source phase and relay phase, respectively. To minimize *D*_{Tot} of (2), we explore both the optimal subcarrier assignment and the optimal power allocation. In fact, the constraints of (3) and (4) state that the available transmission power at each of the nodes, A, B, and R, is limited. The constraints of (5) and (6) indicate that the allocated power at each subcarrier should be nonnegative. The constraints of (7), (8), (9), and (10) reflect the subcarrier assignment limitations that each subcarrier is only allowed to be assigned to one flow.

The optimization problem in (2) is a combinational optimization problem involving both continuous variables \(p_{k,i}^{\textmd {\tiny {(I)}}}\) and \(p_{g,i}^{\textmd {\tiny {(II)}}}\) and binary variables *θ*_{
k,i
} and *ϕ*_{
g,i
}. Such an optimization problem is referred to as a mixed binary integer programming problem, which usually has high computational complexity. Moreover, the nonlinear nature of discrete constraints in the problem also increases the difficulty in finding the optimal solution, due to the nonconvexity of the feasible set.

*D*

_{I}and

*D*

_{II}are limited by two sets of disjoint power and subcarrier constraints. Specifically,

*D*

_{I}is only affected by the constraints of (3) and (7) whereas

*D*

_{II}by the constraints of (4) and (8). Therefore, problem (2) is decomposed into the following two subproblems,

Specifically, the goal of problem (11) is to minimize *D*_{I} by optimally assigning the subcarriers to A and B and allocating their powers to the assigned subcarriers in the source phase. The goal of problem (12) is to minimize *D*_{I} by optimally assigning the subcarriers to the NC data and the UC data and allocating the relay’s power to the assigned subcarriers optimally in the relay phase. The subproblems in (11) and (12) are still hard to solve, which are mixed binary integer problems. An exhaustive search for the optimal subcarrier assignment will have an exponential complexity of \(\mathcal {O}\left (2^{N}\right)\) and thus becomes infeasible in practical OFDM networks. Hence, we develop low-complexity suboptimal algorithms to solve these problems in the following sections.

## 4 Suboptimal resource allocation schemes

In this section, we propose suboptimal solutions to the two subproblems in (11) and (12), where subcarrier allocation and power distribution are separately treated. By the separation treatment, the number of variables in each of the objective functions of (11) and (12) is almost reduced by half. Therefore, the complexity can be greatly reduced.

### 4.1 Resource allocation for source phase

#### 4.1.1 Subcarrier assignment algorithm for source phase

*θ*

_{ k,i }so that it takes a real value in [0, 1] [29]. Then, the relaxed problem of (11) can be described as

*s*, the problem of (13) above can be formulated into

which is a standard convex optimization problem, and the convex optimization problem can be solved by using some standard packages, such as AMPL [30], but these packages often require intensive computations. For the purpose of practical application, new algorithms with low complexity should be designed.

*α*

_{1},

*α*

_{2}], β=[

*β*

_{1},

*β*

_{2}], and ν=[

*ν*

_{1},...,

*ν*

_{ N }] be Lagrangian multipliers. Then, the Lagrangian for the optimization problem in (14) is given by

*L*w.r.t.

*θ*

_{ k,i }and

*s*, the following

*Karush-Kuhn-Tucker*(KKT) conditions [29] for the optimal solution can be obtained as follows:

From the conditions of (19)–(22) above, one can see that the following Proposition 1 holds.

###
**Proposition 1**

The Lagrange multipliers in equations of (19)–(22) satisfy the following claims:

(a) For each flow *k*, it satisfies that *α*_{
k
}≠0, because if *α*_{
k
}=0, the constraint of (15) will become inactive.

(b) There must be at least one non-zero feasible solution *s* such that \(M_{k}/(1/s) =\sum \limits _{i = 1}^{N} {\theta _{k,i}r_{k,i}^{\textmd {\tiny (I)}}}=R_{k}^{\textmd {\tiny (I)}}\), where 1/*s* actually is a feasible solution of the transmission completion time for flow *k* in the source phase.

(c) For each flow *k* with a feasible solution *s*>0, \(\sum \limits _{k = 1}^{2} {{\alpha _{k}}{M_{k}}}=1\).

(d) When the optimal solution is obtained, all available power must be utilized.

###
**Theorem 1**

When the minimal transmission completion time of the relaxed optimization problem in (13) is achieved, the two sources have equal transmission completion time and all of their available power is utilized. In other words, the optimal solution *s*^{∗} of the problem in (14) satisfies that 1/*s*^{∗}=*M*_{A}/*R*A(I)=*M*_{B}/*R*B(I).

###
*Proof*

According to Proposition 1 (a), *α*_{
k
}≠0. By using Eq. (21), it is found that \({M_{k}}s^{*} =R_{k,i}^{\textmd {\tiny {(I)}}}\). Combined with the result in (d) of Proposition 1, Theorem 1 is therefore proved. □

Theorem 1 claims such an important fact in the view of network planning: to obtain the minimal transmission completion time in the source phase, the two sources should proportionally allocate their transmission rates, satisfying that *R*A(I):*R* B(I)=*M*_{A}:*M*_{B}. This gives us an insight to design the suboptimal resource allocation schemes for source phase.

Assume that the power of source *k* is equally distributed with \(\overline {p}_{k}^{\textmd {\tiny {(I)}}}\) over all subcarriers. Let *Π*_{
k
} be the set of allocated subcarriers for flow *k* in the source phase. Then, we derive a suboptimal subcarrier allocation scheme for the transmission in the source phase, described in *Algorithm* 1.

#### 4.1.2 Power allocation for source phase with fixed subcarriers

*k*, the optimization power allocation problem can be formulated to be

*λ*and

*𝜗*are Lagrangian multipliers. After differentiating

*L*w.r.t. \(p_{k,i}^{\textmd {\tiny {(I)}}}\), we have that

*Π*

_{ k }with \(\hat {N}_{k}\). Without loss of generality, we assume that \(H_{k,1}^{\textmd {\tiny {(I)}}} \leq H_{k,2}^{\textmd {\tiny {(I)}}} \leq...\leq H_{k, \hat {N}_{k}}^{\textmd {\tiny {(I)}}}\). Thus, (26) can be written as

*k*on the

*i*th subchannel, in which more power should be distributed for the subchannels with higher CNR. This is in consistent with the water-filling algorithm [31] in frequency domain. Moreover, since

### 4.2 Resource allocation for relay phase

#### 4.2.1 Subcarrier assignment algorithm for relay phase

*ϕ*

_{ g,i }so that it takes a real value in [0, 1]. Then, the relaxed problem of (12) can be described as

*z*, the problem of (29) turns into a standard convex problem:

It can be observed that both the objective function and the constraints of the problem (30) has a similar form with that of (14). That is to say, the analysis for the problem in (14) is also valid for the problem in (30). Consequently, we can infer that the discipline described in Theorem 1 also can be applied to the transmission of relay phase. For emphasis, we extend it in Theorem 2 for relay phase as below.

###
**Theorem 2**

When the minimal transmission completion time of the relaxed optimization problem in (29) is achieved, the NC traffic and the UC traffic are allocated all available resources such that the two types of traffic experience equal transmission completion time. In other words, the optimal solution *z*^{∗} of the problem in (30) satisfies that 1/*z*^{∗}=*M*_{NC}/*R*NC(II)=*M*_{UC}/*R*UC(II).

Theorem 2 indicates that to obtain the minimal transmission completion time in the relay phase, the two types of traffic should be allocated proportionally in their transmission rates, satisfying that *R*NC(II):*R* UC(II)=*M*_{NC}:*M*_{UC}, which this gives us an insight to design the suboptimal resource allocation schemes for relay phase.

Suppose equal power \(\overline {p}_{\textsf {\tiny {R}}}^{\textmd {\tiny {(II)}}}\) is distributed across all subcarriers and *Λ*_{
g
} is the set of determined subcarriers for flow *g* in the relay phase. Then, a suboptimal subcarrier allocation algorithm based on Algorithm 1 for the transmission in the relay phase can be derived as shown in *Algorithm* 2.

#### 4.2.2 Power allocation for relay phase

Once the subcarriers are determined for the two types of traffic, \(\overline {P}_{\textsf {\tiny {R}}}\) can be distributed to them. Compared with source phase, the power distribution in the relay phase is much more complex, because the power constraints in the source phase are for two separated source nodes, while the power constraint in the relay phase is the total available power at the relay node R. To solve the power allocation problem in the relay phase, we consider to distribute \(\overline {P}_{\textsf {\tiny {R}}}\) to the two flows, i.e., the NC data and the UC data, at first, and then allocate their assigned power over the predetermined subcarriers.

*d*, the optimization problem in (31) can also be formulated to be a convex optimization problem of seeking the maximum of the following Lagrange cost function:

*g*,

*Λ*

_{ g }with \(\hat {N}_{g}\). Without loss of generality, we assume that \(H_{g,1}^{\textmd {\tiny {(II)}}} \leq H_{g,2}^{\textmd {\tiny {(II)}}} \leq...\leq H_{g, \hat {N}_{g}}^{\textmd {\tiny {(II)}}}\). Thus, (36) can be written as

*g*on the

*i*th subchannel, in which the subchannels with higher CNR should be distributed more power. This is also in accord with the water-filling algorithm in frequency domain. Let \(P_{g}^{\textmd {\tiny {(II)}}}\) be the total allocated power for flow

*g*in the relay phase. Then, we have

*g*. Moreover, from Eq. (34), it can be concluded that

*d*is obtained. Consequently, it can be inferred that when the optimal solution of the problem of (29) is achieved,

*R*

_{NC}and

*R*

_{NC}satisfy that

To understand this problem more clearly, we firstly consider two special cases as follows:

**Special case 1**:

*Linear case*. If \(M_{\textsf {\tiny {NC}}}\hat {N}_{\textsf {\tiny {UC}}}=M_{\textsf {\tiny {UC}}}\hat {N}_{\textsf {\tiny {NC}}}\), i.e., \(M_{\textsf {\tiny {NC}}}:M_{\textsf {\tiny {UC}}}=\hat {N}_{\textsf {\tiny {NC}}}:\hat {N}_{\textsf {\tiny {UC}}}\), then Eq. (47) can be transformed to be

Substituting Eq. (49) into Eq. (39), the power allocated to flow *g* in the linear case can be given by

**Special case 2**:

*High SNR case*. When the CNR or signal-to-noise ration (SNR) is relatively high, from Eq. (44), it can be inferred that

*Q*

_{ g }is relatively small compared to \(P_{g}^{\textmd {\tiny (II)}}\). In this case, if adaptive subchannel allocation is used, the best subchannels will be chosen, and they have relatively small differences among channel gains. Thus,

*Q*

_{ g }can be approximated to be 0. Moreover, as SNR≫1, log2(1+SNR)≃ log2(SNR). So, Eq. (44) can be approximately expressed as

Since every item in the higher order function monotonically increases and Eq. (53) achieves different signs at *P*NC(II)=0 and \(P_{\textsf {\tiny {NC}}}^{\textmd {\tiny (II)}}=\overline {P}_{\textsf {\tiny {R}}}\), some numerical algorithms, such as Newton’s root-finding method [32] or the false position method [32], can be adopted to find the solution of the function in Eq. (53). The complexity of finding the solution will primarily rely on the choice of the numerical algorithm and the precision required in the results.

**General case**: Although the complexities of Special case 1 and Special case 2 are not high, these two cases, especially the Special case 1, rarely happen. In most cases, the set of equations of (44)–(47) can not be simplified. However, since the equations are nonlinear in general, iterative methods such as Newton-Raphson or quasi-Newton methods [33] can be used to obtain the solution with a certain amount of computational effort. In the Newton-Raphson method, the computational complexity primarily comes from finding the update direction. Fortunately, the computational complexity of each iteration is \(\mathcal {O}(1)\). Moreover, from Eq. (35), it can be observed that the optimal scheme must utilize all available power, because if not all available transmission power is used, the unused power can be redistributed to the flow with longer transmission completion time for a higher transmission rate, due to the continuity of \(R_{g}^{\textmd {\tiny (II)}}\left (P_{g}^{\textmd {\tiny (II)}}\right)\) w.r.t. \(P_{g}^{\textmd {\tiny (II)}}\) for all *g*. Moreover, from Eq. (44), it can be seen that \(P_{g}^{\textmd {\tiny (II)}}>Q_{g}\), which means when \(P_{g}^{\textmd {\tiny (II)}}<Q_{g}\), *P*_{
g
} becomes non-feasible. In fact, if the Newton-Raphson method returns a non-feasible \(P_{g}^{\textmd {\tiny (II)}}\), the set *Π*_{
g
} and the associated \(\hat {N}_{g}\), *Q*_{
g
}, and *X*_{
g
} are required to be updated. Thus, the Newton-Raphson method should be performed until \(P_{g}^{\textmd {\tiny (II)}} > Q_{g}\), for all *g*.

### 4.3 Complexity analysis and equivalent problem extension

#### 4.3.1 Complexity analysis

It is known that the best subchannel assignment scheme can be found by exhaustive search, i.e., for each subchannel allocation in the source phase, one would run the optimal power allocation algorithm shown in Fig. 2 for source phase and, also for each subchannel allocation in the relay phase, one would run the optimal power allocation algorithm shown in Fig. 3 for relay phase, since both the power distribution schemes in Figs. 2 and 3 are with the computational complexity of \(\mathcal {O}(1)\). In a *N*-subcarrier two-way relay OFDM system, there are 2^{
N
} possible subchannel allocations, so the complexity of the optimal resource allocation based on exhaustive search is \(\mathcal {O}\left (2^{N}\right)\). In contrast, the complexity of our proposed suboptimal scheme consists of four parts, namely, the subchannel allocation with the complexity of \(\mathcal {O}(2N)\) in the source phase, the power allocations with the complexity of \(\mathcal {O}(1)\) in the source phase, the subchannel allocation with the complexity of \(\mathcal {O}(2N)\) in the relay phase, and the power allocations with the complexity of \(\mathcal {O}(1)\) in the relay phase. Besides, because that the power allocations for the two phases in our methods are only executed once, the complexity of our proposed suboptimal scheme is approximately on the order of 2^{
N
} times less than that of the exhaustive search-based optimal method.

#### 4.3.2 Equivalent problem extension

Let us review the problem explored this paper. Our objective is to obtain the minimal *D*_{Tot}. Since the total traffic amount to be exchanged in the system, i.e., (*M*_{A}+*M*_{B}), and channel state information are known, when *D*_{Tot} reaches the minimum, (*M*_{A}+*M*_{B})/*D*_{Tot} will be the maximum. Actually, (*M*_{A}+*M*_{B})/*D*_{Tot} is the average transmission rate of the two-way relay system. If we define *M*_{A}/*D*_{Tot}=*R*_{AB} and *M*_{B}/*D*_{Tot}=*R*_{BA}, *R*_{AB} and *R*_{BA} can be regarded as the average end-to-end transmission rates from A to B and from B to A, respectively. In this case, one can see that when the minimal *D*_{Tot} is achieved, *R*_{AB}:*R*_{BA}=*M*_{A}:*M*_{B}. Furthermore, if we treat \(\frac {1}{M_{k}}\) and \(\frac {1}{M_{g}}\) as the rate weights or rate proportional fairness factors for source phase and relay phase, respectively, the objectives of the problems in (13) and (29) can be considered as the max-min fairness problems which aim to maximize the weighted minimal transmission rate. Thus, we can derive the following conclusions.

###
**Corollary 1**

The objective to seeking the minimal transmission completion time *D*_{I}, *D*_{II}, and *D*_{Tot} in the problem of (11), (12), and (2) is equivalent to finding the maximal average transmission rate with proportional fairness for the source phase transmission, the relay phase transmission, and the end-to-end two-way transmission in a two-way relay OFDM system.

So we can state that, although we explore the resource allocation schemes towards minimal transmission completion time, our proposed schemes also can be used to achieve maximal average transmission rate with proportional fairness for two-way relay OFDM transmission systems.

## 5 Simulation results

We simulated our algorithms over Matlab2016a, where a frequency-selective channel model consisting of *N* independent Rayleigh subschannels is considered. The total available bandwidth *NW* is 1 MHz, and the average transmission SNR of each channel is 20 dB. *E*(ch_{A}) and *E*(ch_{B}) are defined to describe the average channel power gains of the links between A and R and between B and R, respectively. Assume *M*_{A}+*M*_{B}=1, which indicates that the total traffic amount in the two-way system is fixed. Thus, the smaller the value of *M*_{A}/*M*_{B} is, the more data B has to sent than A.

### 5.1 Comparison with the optimal results achieved by exhaustive search

*D*

_{Tot},

*D*

_{I}, and

*D*

_{II}as a function of

*E*(ch

_{A})/

*E*(ch

_{B}), respectively, where both the suboptimal results and the optimal results are plotted.

*N*is set to be 6 for reducing the computational time of the exhaustive search. The results are averaged over 300 simulations.

*E*(ch

_{B}) is fixed to be 1. So if

*E*(ch

_{A})/

*E*(ch

_{B})=0, there is no path loss difference between the two channels, i.e., the channel between A and R and that between A and R. Otherwise, the path loss fading experienced by the two channels are different.

In Figs. 4, 5, and 6, it is shown that the proposed suboptimal scheme achieves less than 1.06, 1.07, and 1.01 times the optimal result in terms of *D*_{Tot}, *D*_{I}, and *D*_{II}, respectively. One also can see that the higher the value of *E*(ch_{A})/*E*(ch_{B}) is, the lower the values of *D*_{Tot}, *D*_{I}, and *D*_{II} are, because with a fixed *E*(ch_{B}), a high value of *E*(ch_{A})/*E*(ch_{B}) implies a relatively good average channel condition of the system.

Although in practical wireless network systems, the number of subchannels is much larger, the proposed scheme is still expected to perform close to the optimal results, because the subchannel allocation algorithm is always designed to utilize the subchannels with large CNR as much as possible, and the power distribution is always optimal for any determined subscarrier allocation.

### 5.2 Comparison with the performances of other transmission methods

In this section, we compare our proposed scheme with other ones. Since in our method, both resource allocation and network coding are adopted, we note our method to be *RwNw* for short. Other three transmission methods, i.e., the traditional four time slots method no resource allocation and no network coding (*RoNo*), the method with network coding but without resource allocation (*RoNw*), and the method with resource allocation but without network coding (*RwNo*) are considered for the comparisons.

RoNo is regarded as a benchmark method, in which no resource allocation is involved and network coding is also not employed. In RoNo, A and B transmit their data to R over all the *N* subchannels in a time-division multiplexing access (TDMA) manner in the source phase, and R then also forwards the received data to A and B via all *N* subcarriers in TDMA manner in the relay phase. That is to say, in both source phase and relay phase of RoNo, two time slots are involved for the transmissions. The minimal transmission completion time of RoNo thus can be obtained by maximizing the transmission rate using water-filling algorithm in each slot. The operations in the source phase of RoNw are the same as that of RoNo, but in relay phase of RoNw, since network coding is employed, NC data and UC data are forwarded by R in a TDMA manner in the relay phase. That is to say, in RoNw, NC data and UC data are forwarded by R over all *N* subcarriers in two different slots in the relay phase. In RwNo, it has the same transmission behavior with RwNw in the source phase, but in the relay phase of RwNo, since network coding is not employed, R simultaneously transmits the received data from A and B over two disjoint sets of subcarriers to B and A, respectively.

*N*is set to 10. In Example 1,

**h**

_{A}=[ 6 6 5 5 5 4 3 2 2 1] and

**h**

_{B}=[6 6 6 5 4 4 3 2 1 1]. In Example 2,

**h**

_{B}=[6 6 6 5 4 4 3 2 1 1], but

**h**

_{A}=[1 2 2 3 4 5 5 5 6 6] by reversing the elements’ order of the

**h**

_{A}in Example 1. Figures 7, 8, 9, 10, 11, and 12 plot the minimal

*D*

_{I},

*D*

_{II}, and

*D*

_{Tot}of the four schemes in Examples 1 and 2, respectively. It is shown that RoNo has the worst performance among the four schemes, which explains a fact that both resource allocation and network coding can bring benefit to the delay performance of the system.

Moreover, it also shows that RwNw and RwNo achieve lower *D*_{I}, *D*_{II}, and *D*_{Tot} than RoNw and RoNo. However, different from the results in Example 1, the *D*_{II} and *D*_{Tot} achieved by RwNw are not always lower than those achieved by RwNo in Example 2. In Example 2, when *M*_{A}/*M*_{B} is closed to 0 dB, the *D*_{II} and *D*_{Tot} of RwNw increase, instead of continually decrease as expected, and as a reslut, RwNw achieves a relatively larger *D*_{II} and *D*_{Tot} than RwNo. It can be inferred that *M*_{A}/*M*_{B} close to 0 dB means that the UC traffic amount approaches 0 and almost all subchannels will be assigned to the NC traffic. In this case, all data that needs to be forwarded in the relay phase of RwNw is NC data and the total traffic amount to be forwarded in the relay phase becomes the minimum. However, since the broadcast rate of RwNw in the relay phase is upper bounded by \(\min \{h_{\textsf {\tiny A},i}^{\textmd {\tiny (II)}}, h_{\textsf {\tiny B},i}^{\textmd {\tiny (II)}}\}\) for all *i*, only the worse subchannels of the two channels are utilized, and some stronger subchannels may be not fully utilized. Such an inefficient utilization will become even worse, when the two sources have very balanced traffic and the channel coefficients of corresponding subchannels of the two links have relatively large differences. For example, when *M*_{A}=*M*_{B}, in Example 1, the channel coefficients of the subcarriers assigned to NC data in RwNw are [6 6 5 5 4 4 3 2 1 1], while in Example 2, the channel coefficients of the subcarriers assigned to NC data become [1 2 2 3 4 4 3 2 1 1], where more stronger subchannels are wasted. In contrast, a better subchannel utilization is achieved by RwNo in the same situation. In Example 1, the subscarrier sets assigned to the two flows of RwNo in the relay phase are [6 6 5 5 5] and [6 6 5 4 4], respectively, and in Example 2, the assigned subscarrier sets become [6 5 5 2 2] and [6 5 4 3 1], respectively. Compared with RwNw, in this case, the utilization of subchannel resources is more efficient in RwNo. So, RwNw does not always outperforms RwNo in terms of *D*_{II} and *D*_{Tot}, especially when *M*_{A} is similar to *M*_{B}.

The reason is that network coding brings benefits to the system just by compressing and reducing the traffic amount of the data to be forwarded in the relay phase. Less data needs to be forwarded, less transmission completion time will be costed. However, in the meantime, network coding limited its broadcasting rate with the weaker channels, resulting in inefficient utilization of chancel resources. Therefore, only when the benefit brought by the traffic amount reduction of network coding is larger than the performance loss caused by the inefficient use of channel resources, network coding is capable of bringing performance gains to the system.

*normalized transmission completion time gain*of RwNw, i.e.,

*D*

_{gain}is positive, RwNw outperforms all the other schemes. Otherwise, RwNw may not achieve the best performance among the four schemes. Figure 13 plots the 3D contour lines of

*D*

_{gain}for RwNw, and Fig. 14 displays the performance regions of the four schemes in terms of

*D*

_{gain}. In the simulations,

*N*is set to 64 and the results are averaged over 1000 random channel realizations. In Fig. 13, it shows that the maximal

*D*

_{gain}of RwNw is about 1.2 dB and the minimal one is just −0.4 dB, which means that much lower transmission completion time can be obtained by RwNw compared with the other schemes. In Fig. 14, one can also see that RwNw and RwNo always outperform the other two methods. Also, when

*M*

_{A}/

*M*

_{B}is close to 0 dB, RwNo outperforms RwNw, which conforms to the results of Fig. 13. However, it is observed that in more than 90% cases, RwNw outperforms RwNo and the other two schemes. Combining this result with Fig. 13, it can be stated that, in overwhelming majority cases, RwNw outperforms all the other schemes and the obtained transmission completion time gain by RwNw is much larger than that obtained by the other schemes. Besides, Fig. 14 also gives a reference mark for the application of DNC in two-way relay OFDM systems. For example, when 2 dB ≤

*E*(ch

_{A})/

*E*(ch

_{B})≤ 10 dB, if

*M*

_{A}/

*M*

_{B}≥ 1 dB or

*M*

_{A}/

*M*

_{B}≤−2 dB, RwNw should be selected for the minimal delay. Otherwise, network coding should not be used and RwNo is should be selected.

## 6 Conclusions

This paper investigated the two-way relay transmission using network coding over OFDM channels. A joint resource allocation and network coding transmission method was presented, and then, the optimization problem to minimize the total transmission completion time under individual power constraints was explored. In order to avoid the NP-hard problem on finding the solution numerically, we divided it into two sub-problems and developed some suboptimal algorithms with low complexities, which can easily separate subcarrier assignment and power allocation in finding the solution. Moreover, we proved that our developed resource allocation scheme can achieve maximal transmission rate with proportional fairness for two-way relay transmission system, and this conclusion also holds in both the source phase transmission and the relay phase transmission.

## Declarations

### Acknowledgements

We would like to thank the anonymous reviewers for their insightful comments on the paper, as these comments led us to an improvement of the work.

### Funding

This work was supported by the National Natural Science Foundation of China (NSFC) under Grant no. 61602034, by the NFSC Outstanding Youth under Grant no. 61725101, by the State’s Key Project of Research and Development Plan under Grant no. 2016YFB0901100 and also by the Science and Technology Project of State Grid Corporation of China under Grant no. XM2017020034670.

### Authors’ contributions

YZ and GX have equal contribution to the system modeling, algorithm design, performance analysis, and simulations. XZ helped revise the manuscript. All authors read and approved the final manuscript.

### Competing interests

The authors declare that they have no competing interests.

### Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Open Access** This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

## Authors’ Affiliations

## References

- MA Khan, RK Rao, XB Wang, Two-way decode-and-forward cooperative systems with signal space diversity. EURASIP J. Wirel. Commun. Netw. 2016(1), (2016).Google Scholar
- RH Jiang, K Xiong, Y Zhang, Outage analysis and optimization of SWIPT in network-coded two-way relay networks. Mob. Inf. Syst.
**2013**(2516035), 1–8 (2017).Google Scholar - K Xiong, Y Zhang, YY Chen, Power splitting based SWIPT in network-coded two-way networks with data rate fairness: an information-theoretic perspective. China Commun.
**13**(12), 107–119 (2016).View ArticleGoogle Scholar - T Li, K Xiong, YQ Dong, Opportunistic network coding scheme for two-way relay wireless networks: a sum-rate maximization approach. IEEE Trans. Veh. Technol.
**64**(6), 2732–2738 (2015).View ArticleGoogle Scholar - GY Du, K Xiong, Y Zhang, Outage analysis and optimization for time switching-based two-way relaying with energy harvesting relay node. KSII Trans. Int. Info. Syst.
**9**(2), 545–563 (2015).Google Scholar - GY Du, K Xiong, Y Zhang, Outage analysis and optimization for four-phase two-way transmission with energy harvesting relay. KSII Trans. Int. Info. Syst.
**8**(10), 3321–3341 (2014).Google Scholar - DD Li, K Xiong, GY Du, Secure beamforming with artificial noise for two-way relay networks. KSII Trans. Int. Info. Syst.
**7**(6), 1418–1432 (2013).Google Scholar - B Rankov, A Wittneben, in
*Proc. IEEE ISIT’06*. Achievable rate regions for the two-way relay channel (IEEESeattle, 2006), pp. 1668–1672.Google Scholar - DD Li, K Xiong, ZD Qiu, SER-based relay selection for two-way relaying with physical layer network coding. ETRI J.
**35**(2), 336–339 (2013).View ArticleGoogle Scholar - K Xiong, Y Zhang, DD Li, Multiantenna relay beamforming design for QoS discrimination in two-way relay networks. Sci. W. J.
**2017**(306423), 1–16 (2013).Google Scholar - R Ahlswede, et al., Network information flow. IEEE Trans. Inf. Theory.
**46**(4), 1204–1216 (2000).MathSciNetView ArticleMATHGoogle Scholar - ZG Ding, et al., On the design of network coding for multiple two-way relaying channels. IEEE Trans. Wirel. Commun.
**10**(6), 1820–1832 (2011).View ArticleGoogle Scholar - K Xiong, PY Fan, H-C Yang, KB Letaief, Space-time network coding with overhearing relays. IEEE Trans. Wirel. Commun.
**13**(7), 3567–3582 (2014).View ArticleGoogle Scholar - K Xiong, PY Fan, T Li, KB Letaief, Outage probability of spacetime network coding over Rayleigh fading channels. IEEE Trans. Veh. Technol.
**63**(4), 1965–1970 (2014).View ArticleGoogle Scholar - Y Zhang, K Xiong, PY Fan, X Di, X Zhou, Outage performance of space-time network coding with overhearing AF relays. IEEE Commun. Lett.
**19**(12), 2234–2237 (2015).View ArticleGoogle Scholar - N Ding, P Sadeghi, A Rodney, Structured optimal transmission control in network-coded two-way relay channels. Eurasip J. Wirel. Communi. Netw.
**2015**(1), 1–18 (2015).Google Scholar - G Li, H Liu, Resource allocation for OFDMA relay networks with fairness constraints. IEEE J. Sel. Areas Commun.
**24**(11), 2061–2069 (2006).View ArticleGoogle Scholar - ZK Shen, JG Andrews, BL Evans, Adaptive resource allocation in multiuser OFDM systems with proportional rate constraints. IEEE Trans. Wirel. Commun.
**4**(6), 2726–2736 (2005).View ArticleGoogle Scholar - K Xiong, PY Fan, Y Lu, Energy efficiency with proportional rate fairness in multirelay OFDM networks. IEEE J. Sel. Area. Commun.
**34**(5), 1431–1447 (2016).View ArticleGoogle Scholar - XF Di, K Xiong, Y Zhang, Simultaneous wireless information and power transfer in two-hop OFDM decode-and-forward relay networks. KSII Trans. Int. Info. Syst.
**10**(1), 152–167 (2016).Google Scholar - R AliHemmati, S ShahbazPanahi, M Dong, Joint spectrum sharing and power allocation for OFDM-based two-way relaying. IEEE Trans. Wirel. Communi.
**14**(6), 3294–3308 (2015).View ArticleGoogle Scholar - K Xiong, PY Fan, KB Letaief, S Yi, M Lei, in Proc. IEEE ICC’12. Resource allocation for minimal downlink delay in two-way OFDM relaying with network coding (Ottawa, 2012), pp. 5343–5347.Google Scholar
- K Goyal, A Trivedi, Cross-layer design using superposition coding scheme for multiuser OFDM systems. Wirel. Pers. Commun.
**71**(2), 1339–1352 (2013).View ArticleGoogle Scholar - N Du, F-S Liu, A novel resource optimization scheme for multi-cell OFDMA relay network. Front. Inf. Technol. Electron. Eng.
**17**(8), 825–33 (2016).View ArticleGoogle Scholar - Y Liu, JH Mo, MY Tao, QoS-aware transmission policies for OFDM bidirectional decode-and-forward relaying. IEEE Trans. Wirel. Commun.
**12**(5), 2206–2216 (2013).View ArticleGoogle Scholar - X Chen, F He, LM Xiao, SD Zhou, Joint subcarrier and power allocation for DF-based multiuser two-way relay networks. China Commun.
**14**(6), 179–188 (2017).View ArticleGoogle Scholar - TT Yu, YL Jin, WS Guo, CL Fang, W Deng, T Wang, Low-complexity energy-efficient resource allocation for delay-tolerant two-way orthogonal frequency-division multiplexing relays. IET Commun.
**10**(17), 2488–2495 (2016).View ArticleGoogle Scholar - SM Mirrezaei, K Faez, Performance analysis of network coding based two-way relay wireless networks deploying IEEE 802.11. Wirel. Pers. Commun.
**76**(1), 41–76 (2014).View ArticleGoogle Scholar - R Fourer, DM Gay, BW Kernighan,
*AMPL: a modeling language for mathematical programming*(Boyd & Fraser Publishing Company, MA, 1993). ISBN 0-89426-232-7.MATHGoogle Scholar - S Boyd, et al.,
*Convex optimization*(Cambridge University Press, Cambridge, 2004).View ArticleMATHGoogle Scholar - TM Cover, JA Thomas,
*Elements of information theory*(Wiley, New York, 1991).View ArticleMATHGoogle Scholar - M Abramowitz, IA Stegun,
*Handbook of mathematical functions with formulas, graphs, and mathematical tables, 9th Edition*(Dover Publications, Dover, 1972).MATHGoogle Scholar - R Baldick,
*Optimization of engineering systems course notes*. (Univ. Texas, Austin). Available: http://www.ece.utexas.edu/baldick/.