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.

### Resource allocation for source phase

#### Subcarrier assignment algorithm for source phase

To make the complex problem in (11) tractable, we relax the constraint on *θ*_{
k,i
} so that it takes a real value in [0, 1] [29]. Then, the relaxed problem of (11) can be described as

$$\begin{array}{*{20}l} \underset{\mathbf{P}_{\textsf{\tiny{A}}}, \mathbf{P}_{\textsf{\tiny{B}}}, \boldsymbol{\Theta}}{\min}\,\, \underset{k\in \{\textsf{\tiny{A}},\textsf{\tiny{B}}\}}{\max}\,\, & \frac{M_{k}}{R_{k}^{\textmd{\tiny{(I)}}}}\\ \mathrm{s.t.} & \sum\limits_{i= 1}^{N} {p_{k,i}^{\textmd{\tiny{(I)}}}} \le {\overline{P}_{k}},\,\forall k; \,p_{k,i}^{\textmd{\tiny{(I)}}} \geq 0,\,\forall k, i \\ &\sum\limits_{k\in \{\textsf{\tiny{A}},\textsf{\tiny{B}}\}}{\theta_{k,i}}\le 1,\,\forall i;\,\theta_{k,i}\in \left[0, 1\right],\,\forall k, i \end{array} $$

(13)

Since

$$\underset{\mathbf{P}_{\textsf{\tiny{A}}}, \mathbf{P}_{\textsf{\tiny{B}}}, \boldsymbol{\Theta}}{\min}\, \underset{k\in \{\textsf{\tiny{A}},\textsf{\tiny{B}}\}}{\max} \left\{M_{k}/R_{k}^{\textmd{\tiny{(I)}}}\right\} \equiv \underset{\mathbf{P}_{\textsf{\tiny{A}}}, \mathbf{P}_{\textsf{\tiny{B}}}, \boldsymbol{\Theta}}{\max}\,{\underset{k\in \left\{\textsf{\tiny{A}},\textsf{\tiny{B}}\right\}}{\min} \left\{R_{k}^{\textmd{\tiny{(I)}}}/M_{k}\right\}}, $$

by introducing a new variable *s*, the problem of (13) above can be formulated into

$$\begin{array}{*{20}l} \underset{\mathbf{P}_{\textsf{\tiny{A}}}, \mathbf{P}_{\textsf{\tiny{B}}}, \boldsymbol{\Theta}, s}{\max}\,\, & {s} \end{array} $$

(14)

$$\begin{array}{*{20}l} \mathrm{s.t.} & M_{k} s -\sum\limits_{i = 1}^{N} {\theta_{k,i} r_{k,i}^{\textmd{\tiny{(I)}}}} \leq 0,\,s\geq 0,\,\forall k \end{array} $$

(15)

$$\begin{array}{*{20}l} & \sum\limits_{i= 1}^{N} {p_{k,i}^{\textmd{\tiny{(I)}}} \le {\overline {P}_{k}}}, \,\forall k;\,\sum\limits_{k\in \{\textsf{\tiny{A}},\textsf{\tiny{B}}\}}{\theta_{k,i}}\le 1,\,\forall i \end{array} $$

(16)

$$\begin{array}{*{20}l} & p_{k,i}^{\textmd{\tiny{(I)}}} \geq 0,\,\theta_{k,i}\geq 0,\,\forall i,k, \end{array} $$

(17)

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.

Let *α*=[*α*_{1},*α*_{2}], *β*=[*β*_{1},*β*_{2}], and *ν*=[*ν*_{1},...,*ν*_{
N
}] be Lagrangian multipliers. Then, the Lagrangian for the optimization problem in (14) is given by

$${} \begin{aligned} L\left(\boldsymbol{\Theta}, s,\boldsymbol{\alpha},\boldsymbol{\beta}, \boldsymbol{\nu}\right) &= s + \sum\limits_{k\in \{\textsf{\tiny{A}},\textsf{\tiny{B}}\}}{{\alpha_{k}}\left({M_{k}}s-\sum\limits_{i = 1}^{N} {\theta_{k,i}r_{k,i}^{\textmd{\tiny{(I)}}}}\right) }\\ & \quad + \sum\limits_{k\in \{\textsf{\tiny{A}},\textsf{\tiny{B}}\}}{\beta_{k}}\left({\overline{P_{k}}-\sum\limits_{i = 1}^{N} {p_{k,i}^{\textmd{\tiny{(I)}}}}}\right)\\ &\quad + \sum\limits_{i = 1}^{N} {{\nu_{i}}} \left(1-\sum\limits_{k\in \{\textsf{\tiny{A}},\textsf{\tiny{B}}\}}{\theta_{k,i}} \right). \end{aligned} $$

(18)

After differentiating *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:

$$\begin{array}{*{20}l} &\frac{\partial L}{\partial \theta_{k,i}} = {\alpha_{k}}r_{k,i}^{\textmd{\tiny{(I)}}}-{\nu_{i}} = 0, \forall k, i, \end{array} $$

(19)

$$\begin{array}{*{20}l} &\frac{\partial L}{\partial s}= 1 - \sum\limits_{k\in \{\textsf{\tiny{A}},\textsf{\tiny{B}}\}} {{\alpha_{k}}{M_{k}}} = 0, \end{array} $$

(20)

$$\begin{array}{*{20}l} &{\alpha_{k}}\left({M_{k}}s -\sum\limits_{i = 1}^{N} {\theta_{k,i} r_{k,i}^{\textmd{\tiny{(I)}}}}\right)=0, \forall k, \end{array} $$

(21)

$$\begin{array}{*{20}l} &{\beta_{k}}\left(\overline{{P_{k}}}-\sum\limits_{i = 1}^{N} {p_{k,i}^{\textmd{\tiny{(I)}}}}\right)=0, \forall k, \end{array} $$

(22)

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.

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

By using Algorithm 1, subscarriers can be assigned to the two flows in the source phase. To a certain determined subcarrier set for flow *k*, the optimization power allocation problem can be formulated to be

$$\begin{array}{*{20}l} \underset{\mathbf{P}_{\textsf{\tiny{A}}}, \mathbf{P}_{\textsf{\tiny{B}}}}{\max} & \sum\limits_{i \in \Pi_{k}} {W\log_{2} \left(1 + H_{k,i}^{\textmd{\tiny{(I)}}}p_{k,i}^{\textmd{\tiny{(I)}}}\right)}\\ \mathrm{s.t.} & \sum\limits_{i \in \Pi_{k}} {p_{k,i}^{\textmd{\tiny{(I)}}}} \le {\overline{P}_{k}},\, \forall k \\ &p_{k,i}^{\textmd{\tiny(I)}}\geq 0,\,\forall i \in \Pi_{k}, \forall k. \end{array} $$

(23)

The optimization problem in (23) is equivalent to finding the maximum of the following cost function

$$ \begin{aligned} L(\lambda, \vartheta) &= \sum\limits_{i \in \Pi_{k}} {W\log_{2} \left(1 + H_{k,i}^{\textmd{\tiny{(I)}}}p_{k,i}^{\textmd{\tiny{(I)}}}\right)}\\ &\quad +\lambda \left(\overline{P}_{k} - \sum\limits_{i \in \Pi_{k}} {p_{k,i}^{\textmd{\tiny{(I)}}}}\right)+\vartheta p_{k,i}^{\textmd{\tiny{(I)}}}, \end{aligned} $$

(24)

where *λ* and *𝜗* are Lagrangian multipliers. After differentiating *L* w.r.t. \(p_{k,i}^{\textmd {\tiny {(I)}}}\), we have that

$$\begin{array}{@{}rcl@{}} \frac{{\partial L}}{{\partial p_{k,i}^{\textmd{\tiny{(I)}}}}} =\frac{WH_{k,i}^{\textmd{\tiny{(I)}}}}{\ln 2 \left(1 + H_{k,i}^{\textmd{\tiny{(I)}}}p_{k,i}^{\textmd{\tiny{(I)}}}\right)}-(\lambda -\vartheta) =0,\, \forall k, i. \end{array} $$

(25)

From Eq. (25), it can be inferred that

$$\begin{array}{@{}rcl@{}} \frac{H_{k,i}^{\textmd{\tiny{(I)}}}}{\left(1 + H_{k,i}^{\textmd{\tiny{(I)}}}p_{k,i}^{\textmd{\tiny{(I)}}}\right)} = \frac{H_{k,j}^{\textmd{\tiny{(I)}}}}{\left(1 + H_{k,j}^{\textmd{\tiny{(I)}}}p_{k,j}^{\textmd{\tiny{(I)}}}\right)}, \forall i,j \in \Pi_{k}. \end{array} $$

(26)

Denote the number of subcarriers in *Π*_{
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

$$ p_{k,i}^{\textmd{\tiny{(I)}}} = p_{k,1}^{\textmd{\tiny{(I)}}} + \frac{H_{k,i}^{\textmd{\tiny{(I)}}}-H_{k,1}^{\textmd{\tiny{(I)}}}}{H_{k,i}^{\textmd{\tiny{(I)}}}H_{k,1}^{\textmd{\tiny{(I)}}}}, \forall i \in \Pi_{k}. $$

(27)

Actually, Eq. (27) indicates the power allocation method for each signal flow *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

$$ \overline{P}_{k}=\sum\limits_{i= 1}^{N} {p_{k,i}^{\textmd{\tiny{(I)}}}}=\hat{N}_{k} p_{k,1}^{\textmd{\tiny{(I)}}}+{\sum\limits_{i= 2}^{\hat{N}_{k}} {\frac{H_{k,i}-H_{k,1}}{H_{k,i}H_{k,1}}}},\, \forall k, $$

(28)

the suboptimal resource allocation scheme for the transmission of source phase is illustrated in Fig. 2.

### Resource allocation for relay phase

#### Subcarrier assignment algorithm for relay phase

Similar to source phase, to make the problem in (12) tractable, we relax the constraint on *ϕ*_{
g,i
} so that it takes a real value in [0, 1]. Then, the relaxed problem of (12) can be described as

$$\begin{array}{*{20}l} \underset{\mathbf{P}_{\textsf{\tiny{R}}}, \boldsymbol{\Phi}}{\min}\, \underset{g \in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}}{\max}\, & \frac{M_{g}}{R_{g}^{\textmd{\tiny{(II)}}}}\\ \mathrm{s.t.} & \sum\limits_{g\in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}} \sum\limits_{i= 1}^{N} {p_{g,i}^{\textmd{\tiny{(II)}}} \le {\overline{P}_{\textsf{\tiny{R}}}}};\,p_{g,i}^{\textmd{\tiny{(II)}}} \geq 0,\, \forall i, g\\ &\sum\limits_{g\in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}}{\phi_{g,i}}\le 1,\, \forall i;\, \,{\phi_{g,i}} \in [0,1],\, \forall i, g. \end{array} $$

(29)

Because

$$\underset{\mathbf{P}_{\textsf{\tiny{R}}}, {\Phi}}{\min}\, \underset{g \in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}}{\max} \left\{M_{g}/R_{g}^{\textmd{\tiny{(II)}}}\right\} \equiv \underset{\mathbf{P}_{\textsf{\tiny{R}}}, {\Phi}}{\max}\, \underset{g\in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}}{\min}\left\{R_{g}^{\textmd{\tiny{(II)}}}/M_{g}\right\}, $$

by introducing a new variable *z*, the problem of (29) turns into a standard convex problem:

$$\begin{array}{*{20}l} \underset{\mathbf{P}_{\textsf{\tiny R}}, \boldsymbol{\Phi}, z}{\max} & z \\ \mathrm{s.t.} & M_{g} z- {\sum\limits_{i = 1}^{N} {\phi_{g,i}r_{g,i}^{\textmd{\tiny{(II)}}}}} \leq 0,\, z\geqslant 0,\, \forall g\\ &\sum\limits_{g\in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}} \sum\limits_{i= 1}^{N} {p_{g,i}^{\textmd{\tiny{(II)}}} \le {\overline{P}_{\textsf{\tiny{R}}}}};\,p_{g,i}^{\textmd{\tiny{(II)}}} \geq 0,\, \forall i, g\\ &\sum\limits_{g\in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}}{\phi_{g,i}}\le 1,\, \forall i;\, \,{\phi_{g,i}} \in \left[0,1\right],\, \forall i, g. \end{array} $$

(30)

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.

#### 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.

For a certain determined subcarrier assignment in the relay phase, the optimization power distribution problem is formulated as

$$\begin{array}{*{20}l} \underset{\mathbf{P}_{\textsf{\tiny{R}}}}{\max} & \underset{g \in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}}{\min} \left\{\frac{1}{M_{g}}\sum\limits_{i \in \Lambda_{g}} {W\log_{2} \left(1 + H_{g,i}^{\textmd{\tiny(II)}} p_{g,i}^{\textmd{\tiny(II)}}\right)}\right\}\\ \mathrm{s.t.} & \sum\limits_{g\in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}}\sum\limits_{i= 1}^{N} {p_{g,i}^{\textmd{\tiny(II)}}} \le {\overline{P}_{\textsf{\tiny{R}}}}\\ &p_{g,i}^{\textmd{\tiny(II)}} \geq 0, \forall i, g \\ &\Lambda_{\textsf{\tiny{NC}}}\cap\Lambda_{\textsf{\tiny{UC}}}=\emptyset; \, \Lambda_{\textsf{\tiny{NC}}}\cup\Lambda_{\textsf{\tiny{UC}}}=\Omega. \end{array} $$

(31)

By introducing a new variable *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:

$$ \begin{aligned} L(d,\boldsymbol{\lambda},\mu)&=d+\mu \left({\overline{P}_{\textsf{\tiny{R}}}}-\sum\limits_{g\in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}}\sum\limits_{i= 1}^{N} {p_{g,i}^{\textmd{\tiny{(II)}}}}\right)\\ & \quad +\sum\limits_{g\in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}} \lambda_{g}\left(\sum\limits_{i \in \Lambda_{g}}{W\log_{2} \left(1 + H_{g,i}^{\textmd{\tiny{(II)}}}p_{g,i}^{\textmd{\tiny{(II)}}}\right)}-M_{g}d\right). \end{aligned} $$

(32)

By calculating the partial derivative of (32) w.r.t. \(p_{g,i}^{\textmd {\tiny {(II)}}}\), we have that

$$ \frac{{\partial L}}{\partial p_{g,i}^{\textmd{\tiny{(II)}}}}=\frac{W\lambda_{g} H_{g,i}^{\textmd{\tiny{(II)}}}} {\ln2\left(1+H_{g,i}^{\textmd{\tiny{(II)}}}p_{g,i}^{\textmd{\tiny{(II)}}}\right)}-\mu=0,\,\forall g, i $$

(33)

Moreover, by applying the KKT optimality conditions, we can derive that

$$\begin{array}{*{20}l} \lambda_{g}\left(\sum\limits_{i \in \Lambda_{g}}W\log_{2} \left(1 + H_{g,i}^{\textmd{\tiny{(II)}}} p_{g,i}^{\textmd{\tiny{(II)}}}\right)-M_{g}d\right)&=0,\,\forall g. \end{array} $$

(34)

$$\begin{array}{*{20}l} \mu \left({\overline{P}_{\textsf{\tiny{R}}}}-\sum\limits_{g\in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}}\sum\limits_{i= 1}^{N} {p_{g,i}^{\textmd{\tiny{(II)}}}}\right)&=0. \end{array} $$

(35)

From Eq. (33), it can be inferred that for the flow *g*,

$$ \frac{H_{g,m}^{\textmd{\tiny{(II)}}}}{\left(1 + H_{g,m}^{\textmd{\tiny{(II)}}}p_{g,m}^{\textmd{\tiny{(II)}}}\right)} = \frac{H_{g,n}^{\textmd{\tiny{(II)}}}}{\left(1 + H_{g,n}^{\textmd{\tiny{(II)}}}p_{g,n}^{\textmd{\tiny{(II)}}}\right)},\, \forall n,m \in \Lambda_{g}. $$

(36)

Denote the number of subcarriers in *Λ*_{
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

$$ p_{g,i}^{\textmd{\tiny(II)}}=p_{g,1}^{\textmd{\tiny(II)}}+\frac{H_{g,i}^{\textmd{\tiny(II)}}-H_{g,1}^{\textmd{\tiny(II)}}}{H_{g,i}^{\textmd{\tiny(II)}}H_{g,1}^{\textmd{\tiny(II)}}},\,\forall i \in \Lambda_{g}. $$

(37)

Equation (37) in fact indicates the power allocation method for each signal flow *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

$$\begin{array}{*{20}l} P_{g}^{\textmd{\tiny(II)}}&=\sum\limits_{i= 1}^{N} {p_{g,i}^{\textmd{\tiny(II)}}}={\hat{N}_{g}}p_{g,1}^{\textmd{\tiny(II)}}+{\sum\limits_{i= 2}^{\hat{N}_{g}} {\frac{H_{g,i}^{\textmd{\tiny(II)}}-H_{g,1}^{\textmd{\tiny(II)}}}{H_{g,i}^{\textmd{\tiny(II)}} H_{g,1}^{\textmd{\tiny(II)}}}}}, \end{array} $$

(38)

$$\begin{array}{*{20}l} \overline{P}_{\textsf{\tiny{R}}}&=\sum\limits_{g\in \{\textsf{\tiny{NC}},\textsf{\tiny{UC}}\}}P_{g}^{\textmd{\tiny(II)}}. \end{array} $$

(39)

Once \(P_{g}^{\textmd {\tiny (II)}}\) is known, the power allocation in the relay phase can be determined by Eqs. (38) and (37) for each *g*. Moreover, from Eq. (34), it can be concluded that

$$ \sum\limits_{i \in \Lambda_{g}}W\log_{2} \left(1 + H_{g,i}^{\textmd{\tiny(II)}}p_{g,i}^{\textmd{\tiny(II)}}\right)-M_{g}d=0,\,\forall g, $$

(40)

when the maximal *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

$$ R_{\textsf{\tiny{NC}}}^{\textmd{\tiny(II)}}/R_{\textsf{\tiny{UC}}}^{\textmd{\tiny(II)}} = M_{\textsf{\tiny{NC}}}/M_{\textsf{\tiny{UC}}}. $$

(41)

This conclusion just conforms to Theorem 2. What is more, from Eq. (36), it can be derived that

$$\begin{array}{*{20}l} 1+H_{g,n}^{\textmd{\tiny(II)}}p_{g,n}^{\textmd{\tiny(II)}}=\frac{H_{g,n}^{\textmd{\tiny(II)}}}{H_{g,1}^{\textmd{\tiny(II)}}}\left(1+H_{g,1}^{\textmd{\tiny(II)}}p_{g,n}^{\textmd{\tiny(II)}}\right) \end{array} $$

(42)

Calculating the logarithm w.r.t both sides of Eq. (42), then, we have that

$$ \begin{aligned} \log_{2}\left(1+H_{g,n}^{\textmd{\tiny(II)}}p_{g,n}^{\textmd{\tiny(II)}}\right)&=\log_{2}\left(\frac{H_{g,n}^{\textmd{\tiny(II)}}}{H_{g,1}^{\textmd{\tiny(II)}}}\right) +\log_{2}\left(1+H_{g,1}^{\textmd{\tiny(II)}}p_{g,1}^{\textmd{\tiny(II)}}\right). \end{aligned} $$

(43)

With Eqs. (43) and (40), it can be concluded that

$$ \begin{aligned} R_{g}^{\textmd{\tiny(II)}}&=\hat{N}_{g} W\log_{2}\left(1 + H_{g,1}^{\textmd{\tiny(II)}}\frac{P_{g}^{\textmd{\tiny(II)}} - Q_{g}}{\hat{N}_{g}}\right)\\ &\quad +W\log_{2} X_{g}, \end{aligned} $$

(44)

where

$$ Q_{g}=\sum\limits_{i= 2}^{\hat{N}_{g}} {\frac{H_{g,i}^{\textmd{\tiny(II)}}-H_{g,1}^{\textmd{\tiny(II)}}}{H_{g,i}^{\textmd{\tiny(II)}}H_{g,1}^{\textmd{\tiny(II)}}}} $$

(45)

and

$$ X_{g}=\prod\limits_{i = 2}^{{\hat{N}_{g}}}{\frac{H_{g,i}^{\textmd{\tiny(II)}}}{H_{g,1}^{\textmd{\tiny(II)}}}}. $$

(46)

Substituting Eq. (44) into Eq. (41), with arrangement, then, we obtain that

$$\begin{array}{*{20}l} &X_{\textsf{\tiny{UC}}}^{M_{\textsf{\tiny{NC}}}}\left(1 + H_{{\textsf{\tiny{UC}}},1}\frac{P_{\textsf{\tiny{UC}}}^{\textmd{\tiny(II)}} - Q_{\textsf{\tiny{UC}}}}{\hat{N}_{\textsf{\tiny{UC}}}}\right)^{M_{\textsf{\tiny{NC}}}\hat{N}_{\textsf{\tiny{UC}}}}\\ &=X_{\textsf{\tiny{NC}}}^{M_{\textsf{\tiny{UC}}}}\left(1 + H_{{\textsf{\tiny{NC}}},1}\frac{P_{\textsf{\tiny{NC}}}^{\textmd{\tiny(II)}} - Q_{\textsf{\tiny{NC}}}}{\hat{N}_{\textsf{\tiny{NC}}}}\right)^{M_{\textsf{\tiny{UC}}}\hat{N}_{\textsf{\tiny{NC}}}} \end{array} $$

(47)

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

$$\begin{array}{*{20}l} &X_{\textsf{\tiny{NC}}}^{\frac{1}{\hat{N}_{\textsf{\tiny{NC}}}}}\left(1 + H_{{\textsf{\tiny{NC}}},1}\frac{P_{\textsf{\tiny{NC}}}^{\textmd{\tiny(II)}} - Q_{\textsf{\tiny{NC}}}}{\hat{N}_{\textsf{\tiny{NC}}}}\right) =\\ &X_{\textsf{\tiny{UC}}}^{\frac{1}{\hat{N}_{\textsf{\tiny{UC}}}}}\left(1 + H_{{\textsf{\tiny{UC}}},1}\frac{P_{\textsf{\tiny{UC}}}^{\textmd{\tiny(II)}}- Q_{\textsf{\tiny{UC}}}}{\hat{N}_{\textsf{\tiny{UC}}}}\right) \end{array} $$

(48)

Then, it can be obtained that

$$ \begin{aligned} P_{\textsf{\tiny{NC}}}^{\textmd{\tiny(II)}}=\left(\frac{X_{\textsf{\tiny{UC}}}^{\frac{1}{M_{\textsf{\tiny{UC}}}}}} {X_{\textsf{\tiny{NC}}}^{\frac{1}{M_{\textsf{\tiny{NC}}}}}}\left(1 + H_{{\textsf{\tiny{UC}}},1}\frac{P_{\textsf{\tiny{UC}}}^{\textmd{\tiny(II)}} - Q_{\textsf{\tiny{UC}}}}{M_{\textsf{\tiny{UC}}}}\right)-1\right) \frac{M_{\textsf{\tiny{NC}}}}{H_{{\textsf{\tiny{NC}}},1}}+Q_{\textsf{\tiny{NC}}}. \end{aligned} $$

(49)

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

$$ P_{g}^{\textmd{\tiny(II)}}= \left\{ \begin{array}{ll} \left(P_{R}-Q_{\textsf{\tiny{UC}}}-\frac{X_{\textsf{\tiny{NC}}}^{\frac{1}{\hat{N}_{\textsf{\tiny{NC}}}}}} {X_{\textsf{\tiny{UC}}}^{\frac{1}{\hat{N}_{\textsf{\tiny{UC}}}}}}\frac{\hat{N}_{\textsf{\tiny{NC}}}} {H_{{\textsf{\tiny{UC}}},1}}\left(1-\frac{H_{{\textsf{\tiny{NC}}},1}}{\hat{N}_{\textsf{\tiny{NC}}}}Q_{\textsf{\tiny{NC}}}\right) +\frac{\hat{N}_{\textsf{\tiny{UC}}}}{H_{{\textsf{\tiny{UC}}},1}}\right)\Bigg/\left(\frac{X_{\textsf{\tiny{NC}}}^{\frac{1} {\hat{N}_{\textsf{\tiny{NC}}}}}}{X_{\textsf{\tiny{UC}}}^{\frac{1}{\hat{N}_{\textsf{\tiny{UC}}}}}}\frac{\hat{N}_{\textsf{\tiny{UC}}}} {H_{{\textsf{\tiny{UC}}},1}}\frac{H_{{\textsf{\tiny{NC}}},1}}{\hat{N}_{\textsf{\tiny{NC}}}}+1\right), & \textrm{if } g={\textsf{NC}},\\ \left(P_{R}-Q_{\textsf{\tiny{NC}}}-\frac{X_{\textsf{\tiny{UC}}}^{\frac{1}{\hat{N}_{\textsf{\tiny{UC}}}}}}{X_{\textsf{\tiny{NC}}}^{\frac{1} {\hat{N}_{\textsf{\tiny{NC}}}}}}\frac{\hat{N}_{\textsf{\tiny{NC}}}}{H_{{\textsf{\tiny{NC}}},1}}\left(1-\frac{H_{{\textsf{\tiny{UC}}},1}} {\hat{N}_{\textsf{\tiny{UC}}}}Q_{\textsf{\tiny{UC}}}\right)+\frac{\hat{N}_{\textsf{\tiny{NC}}}} {H_{{\textsf{\tiny{NC}}},1}}\right)\Bigg/\left(\frac{X_{\textsf{\tiny{UC}}}^{\frac{1}{\hat{N}_{\textsf{\tiny{UC}}}}}} {X_{\textsf{\tiny{NC}}}^{\frac{1}{\hat{N}_{\textsf{\tiny{NC}}}}}}\frac{\hat{N}_{\textsf{\tiny{NC}}}} {H_{{\textsf{\tiny{NC}}},1}}\frac{H_{{\textsf{\tiny{UC}}},1}}{\hat{N}_{\textsf{\tiny{UC}}}}+1\right), & \textrm{if }g={\textsf{UC}}. \end{array} \right. $$

(50)

**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

$$\begin{array}{@{}rcl@{}} R_{g}^{\textmd{\tiny(II)}} = W\log_{2} X_{g}\left(\frac{{H_{g,1}^{\textmd{\tiny(II)}}}P_{g}^{\textmd{\tiny(II)}}} {\hat{N}_{g}}\right)^{\hat{N}_{g}} \end{array} $$

(51)

Substituting Eq. (51) into Eq. (47), then we have

$$\begin{array}{*{20}l} &X_{\textsf{\tiny{UC}}}^{M_{\textsf{\tiny{NC}}}}\left(\frac{H_{{\textsf{\tiny{UC}}},1}}{\hat{N}_{\textsf{\tiny{UC}}}}\right)^{M_{\textsf{\tiny{NC}}} \hat{N}_{\textsf{\tiny{UC}}}}\left(P_{\textsf{\tiny{UC}}}^{\textmd{\tiny(II)}}\right)^{M_{\textsf{\tiny{NC}}}\hat{N}_{\textsf{\tiny{UC}}}}\\ &=X_{\textsf{\tiny{NC}}}^{M_{\textsf{\tiny{UC}}}}\left(\frac{H_{{\textsf{\tiny{NC}}},1}}{\hat{N}_{\textsf{\tiny{NC}}}}\right)^{M_{\textsf{\tiny{UC}}} \hat{N}_{\textsf{\tiny{NC}}}}\left(P_{\textsf{\tiny{NC}}}^{\textmd{\tiny(II)}}\right)^{M_{\textsf{\tiny{UC}}}\hat{N}_{\textsf{\tiny{NC}}}}. \end{array} $$

(52)

Substituting Eq. (52) into Eq. (38), it can be obtained that

$$\begin{array}{*{20}l} &\frac{X_{\textsf{\tiny{NC}}}^{\frac{M_{\textsf{\tiny{UC}}}}{M_{\textsf{\tiny{NC}}}\hat{N}_{\textsf{\tiny{UC}}}}}\left(\frac{H_{{\textsf{\tiny{NC}}},1}}{\hat{N}_{\textsf{\tiny{NC}}}}\right)^{\frac{M_{\textsf{\tiny{UC}}}\hat{N}_{\textsf{\tiny{NC}}}}{M_{1} \hat{N}_{\textsf{\tiny{UC}}}}}}{X_{\textsf{\tiny{UC}}}^{\frac{1}{\hat{N}_{\textsf{\tiny{UC}}}}}\left(\frac{H_{{\textsf{\tiny{UC}}},1}} {\hat{N}_{\textsf{\tiny{UC}}}}\right)}\left(P_{\textsf{\tiny{NC}}}^{\textmd{\tiny(II)}}\right)^{\frac{M_{\textsf{\tiny{UC}}} \hat{N}_{\textsf{\tiny{NC}}}}{M_{\textsf{\tiny{NC}}}\hat{N}_{\textsf{\tiny{UC}}}}}\\ &+P_{\textsf{\tiny NC}}^{\textmd{\tiny(II)}}-\overline {P}_{\textsf{\tiny R}}=0. \end{array} $$

(53)

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*.

After \(P_{\textsf {\tiny NC}}^{\textmd {\tiny (II)}}\) is found, \(P_{\textsf {\tiny UC}}^{\textmd {\tiny (II)}}\) can be calculated using Eq. (39). Then, the overall power allocation scheme can be determined by Eqs. (37) and (38). The suboptimal resource allocation scheme for the relay phase transmission is illustrated in Fig. 3.

### Complexity analysis and equivalent problem extension

#### 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.

#### 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.