## 5 Unsupervised Learning for Power Allocation
### Attention-Based ULNN for Power Allocation
(2) Decoder: The input of the decoder consists of two parts; one is the channel gain \(H^{t}\) under the current environment, with the size of \(M\times N\times K\), and the other is the output of the encoder, denoted as \(Z_{op}\). First, the channel gain \(H^{t}\) is normalized according to (8) and the result \(h^{t}\) and the flattened \(Z_{op}\) are each put into two separate channels, each consisting of one fully connected layer, one batch normalization layer, and one RELU activation layer. The outputs are written as follows:\[ \begin{split}\text{X}_{h}&=\text{RELU}(\text{BN}(W_{h}h^{t} +b_{h}))\\ \text{X}_{z}&=\text{RELU}(\text{BN}(W_{z}Z_{op}+b_{z} ))\end{split}  \tag{19}\]  
where \(W_{h}\in R^{d_{MNK}\times d_{NK}}\), \(W_{z}\in R^{d_{MNK}\times d_{NK}}\), and \(b_{h}\), \(b_{z}\in R^{d_{MNK}}\), \(d_{MNK}=M\times N\times K\), \(d_{MNe}=M\times N\times d_{e}\), and \(d_{NK}=N\times K\). Therefore, both \(X_{h}\) and \(X_{z}\) are vectors of dimension \(N\times K\). These vectors are combined and passed through two fully connected hidden layers again; the output of the first fully connected hidden layer is  
\[\hat{P}_{M}=\text{sigmoid}(\text{BN}(W_{\hat{P}_{M}}{}^{\prime}\text{RELU}( \text{BN}(W_{\hat{P}_{M}}(X_{h}+X_{z})+b_{\hat{P}_{M}}))+b_{\hat{P}_{M}}{}^{ \prime})) \tag{20}\]  
where \(W_{\hat{P}_{M}}\in R^{d_{NK}\times d_{MN}}\), \(W_{\hat{P}_{M}}{}^{\prime}\in R^{d_{MN}\times M}\), \(b_{\hat{P}_{M}}\in R^{d_{MN}}\), and \(b_{\hat{P}_{M}}{}^{\prime}\in R^{M}\) and \(d_{MN}=M\times N\). Therefore, there are \(M\) outputs of this fully connected hidden layer, as the power constraint variables of base stations, denoted as follows:  
\[\hat{P}_{M}=[\hat{p}_{1}\cdots\hat{p}_{m}\cdots\hat{p}_{M}] \tag{21}\]  
Next, based on the constrained optimization problem P3, \(\hat{P}_{m}\) is performed as follows:  
\[\overline{p}_{m}=\hat{p}_{m}\times p_{m}^{\text{max}} \tag{22}\]  
where \(p_{tot,m}=\overline{p}_{m}\) denotes the total transmission power of the base station \(m\) and satisfies the \(C_{1}\) constraints of P3. Then, the output of the second fully connected layer is the power constraint variables of subchannels, denoted as follows:  
\[\hat{P}_{MN}=\text{sigmoid}(\text{BN}(W_{\hat{P}_{MN}}{}^{\prime}\text{RELU}( \text{BN}(W_{\hat{P}_{MN}}(X_{h}+X_{z})+b_{\hat{P}_{MN}}))+b_{\hat{P}_{MN}}{}^{ \prime})) \tag{23}\]  
where \(W_{\hat{P}_{MN}}\in R^{d_{NK}\times d_{MN}}\), \(W_{\hat{P}_{MN}}{}^{\prime}\in R^{d_{MN}\times d_{MN}}\), \(b_{\hat{P}_{MN}}=d_{MN}\) and \(b_{\hat{P}_{MN}}{}^{\prime}=d_{MN}\). Thus, \(\hat{P}_{MN}\) is an \(M\times N\) dimensional vector, and can be denoted as  
\[\hat{P}_{MN}=[\hat{p}_{1}^{1},\cdots,\hat{p}_{1}^{N},\cdots,\hat{p}_{m}^{n}, \cdots,\hat{p}_{M}^{1},\cdots,\hat{p}_{M}^{N}] \tag{24}\]  
In order to satisfy the \(C_{2}\) constraint in P3, \(\hat{p}_{m}^{n}\) is adjusted as follows:  
\[p_{m}^{n}=\frac{\hat{p}_{m}^{n}}{\sum\limits_{n=1}^{N}\hat{p}_{m}^{n}}p_{tot,m} \tag{25}\]  
where \(p_{m}^{n}\) denotes the transmission power of base station \(m\) on subchannel \(n\). Therefore, the constraint \(C_{2}\) of problem P3 is satisfied. To enforce the NOMA protocol [38] in NOMA systems (i.e., users with higher CNR receive lower power allocations to suppress inter-cluster interference), we formulate the user-level power allocation as an optimization problem under the constraints of P3. Specifically, assuming that two users (\(u_{0}\),\(u_{1}\)) are multiplexed on subchannel \(n\) in cell \(m\) with CNR relationships \(\left|\psi_{m,u_{0}}^{n}\right|\geq\left|\psi_{m,u_{1}}^{n}\right|\). In [8], the power allocation ratios (\(a_{0}^{2}\),\(a_{1}^{2}\)) are established and satisfy \(a_{0}^{2}+a_{1}^{2}=1\). By derivation, the following relationship is obtained:  
\[\frac{a_{0}^{2}}{a_{1}^{2}}\propto\frac{\left|H_{m,u_{1}}^{n}\right|^{2}}{ \left|H_{m,u_{0}}^{n}\right|^{2}} \tag{26}\]  
In [39], the power of each user is affected by the channel gain of that user as well as all users in that subchannel.