## 3 System Model  
In CR communication, transceivers can dynamically modify their transmission parameters to operate in a different frequency band [18]. Thus, CR can improve the utilization of useless bands and facilitate the coexistence and cooperation among heterogeneous networks.  
In a home area network, CR spectrum allocation will be activated when HAN authorization frequency bands are saturated. Thus, the gateway must detect the ambient environment to find other free bands to employ [18]. Commonly, the free bands that are found are unauthorized channels for CR users. In this paper, the process that the secondary users of HAN employ in these free bands via competition can be abstracted into a mathematical model using game theory, in which participants are the CR users (such as meter, sensor) in HAN, the strategy is to compete for the free channel, and utility refers to maximizing the communication quality and reducing the interference. As such, the CR spectrum allocation problem can be expressed as follows:  
\[\prod=\left\{N,\left\{S_{i}\right\}i\in N,\left\{U_{i}\right\}i\in N\right\} \tag{1}\]  
Where \(N\) is the set of participants, which in this model pertains to CR users; \(S_{i}\) is the set of strategies of user \(i\), and \(U_{i}\) is the set of utility functions.  
In game theory, optimal solutions are commonly obtained by computing for the NASH equilibrium [19], which can be expressed as:  
When a participant's strategic set \(S=\left\{S_{i},S_{2}...S_{N}\right\}\), satisfies the boundary condition  
\[U_{i}\left(S\right)\geq U_{i}\left(S_{i}^{{}^{\prime}},S_{{}^{\prime}}\right),\forall i\in N,S_{i}^{{}^{\prime}}\in\mathrm{S} \tag{2}\]  
Where \(S_{i}^{\prime}\) is the strategy of the \(i\)th participant, \(S_{{}^{-i}}\) is the strategy of other participants. Then, \(S\) can be defined as a NASH equilibrium solution.  
Assuming \(N\) CR users in a HAN, which has \(K\) available free unlicensed channels, where \(K<N\). Then the \(i\)th user's utility function can be expressed as:  
\[U_{i}\left(S_{i},S_{{}^{-i}}\right)=-\sum_{j=1,j=i}^{N}P_{j}G_{ij}I\left(S_{i },S_{i}\right)-\sum_{j=1,j=i}^{N}P_{i}G_{ij}I\left(S_{i},S_{j}\right) \tag{3}\]  
Where \(P_{i}\) is the \(i\)th user's transmission power, \(G_{ij}\) is the transmission loss between user \(i\) and \(j\), and \(I(S_{i},S_{j})\) is the interference function between user \(i\) and \(j\), which is defined as follows:  
\[I\left(S_{i},S_{j}\right)=\begin{cases}1&S_{i}=S_{j}\\ 0&S_{i}\
eq S_{j}\end{cases} \tag{4}\]  
Equation (3) consists of two parts: the former part, expressed by \(U_{1}\), indicates the \(i\)th user's interference caused by other users in the corresponding channel; the latter part, expressed by \(U_{2}\), indicates the \[U_{1}=-\sum_{j=1,j=i}^{N}P_{j}G_{j}I\left(S_{j},S_{j}\right) \tag{6}\]  
and  
\[U_{2}=-\sum_{j=1,j=i}^{N}P_{i}G_{j}I\left(S_{i},S_{j}\right) \tag{7}\]  
As the cognitive users select the spectrum strategies only to maximize their own utility, there is probability that multi-Nash equilibrium [20] exists, and the spectrum allocation algorithm cannot achieve the stable convergence. Considering the actual situation of HAN, in order to deal with the multi-Nash equilibrium problem of non-cooperative game based spectrum allocation in CR networks, the variation of utility of cognitive users is used to judge the stability after several iterations, and design an improved non-cooperative spectrum allocation algorithm. When the system achieves stable convergence, the gradient of the utility function should level off to 0. Thus, the modified utility function can be expressed as:  
\[U_{i}^{\prime}\left(S_{i}^{{}^{\prime}},S_{{}^{\prime}-i}^{{}^{\prime}}\right)= -\sum_{j=1,j=i}^{N}P_{j}G_{j}I\left(S_  
The training process of the proposed algorithm is shown in Figure 3.  
To minimize the system interference, signal to interference ratio is likewise necessary to measure the interference, which is expressed as:  
\[\mathit{SIR}_{ij}=\frac{P_{i}G_{g}}{\sum\limits_{k=1,k\
eq i}^{N}P_{k}G_{g}I \left(S_{k},S_{j}\right)} \tag{13}\]