## 4 MEMAC Algorithm Design  
### UWSN Game Clustering  
This model is mainly used to realize the process of selecting CH nodes through game clustering. First, the user node is defined as the set of competitors in the game as \(\text{N}=\{N_{1},N_{2},......,N_{n}\}\). \(\text{S}=\{S_{1},S_{2},......S_{n}\}\) is the strategy set of node competition. \(\text{U}=\{U_{1},U_{2},......,U_{n}\}\) is the set of revenue functions of user nodes under different policies.  
When the available policy space of each node is \(\text{S}=\{PCH,NCH\}\), PCH indicates the node that claims to be the pre-cluster head, and NCH indicates the node that selects the non-cluster head policy.  
Assuming that node j is other nodes except i, when both nodes i and j choose strategy NCH, clustering fails, and the total revenue in the network is 0. To wit,  
\[U_{i}\big{(}S_{i},S_{j}\big{)}=0 \tag{15}\]  
When node i selects strategy PCH, its income function is as follows:  
\[U_{i}\big{(}S_{i},S_{j}\big{)}=R_{ii}e^{-\varphi}\Big{(}E_{i}^{\text{res}}-C_{ i}^{PCH}+\beta W\Big{)} \tag{16}\]  
where \(C_{i}\) represents the cost when the node selects the PCH strategy, \(R_{ii}\) is the multipath information of node i, and \(E_{i}^{res}\) is the remaining energy of node i, \(\beta\) is the adjustment coefficient of the traffic weight W, and \(\beta\)W represents the income reward for nodes with a significant traffic weight. The purpose is to encourage nodes with a greater traffic weight to be elected as cluster heads with a greater probability. \(R_{ii}e^{-\varphi}\) represents the parameter that regulates user revenues under multipath conditions.  
When node i selects the PCH policy, the cost \(C_{i}^{PCH}\) can be further expressed as follows:  
\[C_{i}^{PCH}=E_{\text{rec}}\ +E_{\text{integ}}\ +E_{\text{sent}} \tag{17}\]  
When node i chooses NCH, and node j chooses the PCH strategy, the payoff can be expressed as follows:  
\[U_{i}(S_{i},S_{j})=(2-R_{ii}e^{-\varphi})(E_{i}^{\text{res}}-C_{i}^{ON}+\gamma _{i}) \tag{18}\]  
When node i selects the NCH strategy, the cost, \(C_{i}^{ON}\), only includes the energy consumption of data transmission, which is far lower than the cost of clustering. Therefore,the penalty factor \(\gamma_{i}\) is added here to make user nodes compete for cluster heads with a fairer probability. The specific calculation method is as follows:  
\[r_{i}=bC_{i}^{PCH}\frac{E_{i}^{\text{res}}}{E_{j}^{\text{max}}} \tag{19}\]  
where b is the adjustment factor, and the specific value of the cost, \(C_{i}^{ON}\), is as follows:  
\[C_{i}^{ON}=E_{\text{sent}} \tag{20}\]  
In a round of the game, if only the node with the maximum remaining energy is considered the cluster head without considering the traffic between nodes, nodes with less traffic can be elected as the CH. For example, when the node with the maximum remaining energy but less traffic, node i, chooses the PCH strategy, there exists a node, j, with the maximum traffic, whose remaining energy is slightly less than that of node i, but its traffic is much greater than that of node i. In this case, if node j chooses the NCH strategy, the node i with less traffic, but which acts as the CH, will require a greater scheduling cost to complete data transmission, resulting in a decrease in overall network performance. Therefore, this paper incorporates the traffic weight of nodes as part of the reward value in the payoff function, allowing nodes with slightly less energy than node i but the greatest traffic weight, such as node j, to be elected as cluster heads with a higher probability and thereby enhancing the performance of the network.  
Furthermore, in the formula for the penalty factor, \(r_{i}\), as \(E_{i}^{res}\) approaches \(E_{j}^{max}\), the penalty increases, making it more likely for node i to select the PCH strategy due to the penalty and thereby balancing the energy consumption of the nodes. The algorithm involves node i continuously engaging in a game between the PCH and NCH strategies until convergence is achieved.