## 4 Methodology
### Cooperative Resource Allocation Method Based on Nash Bargaining Game and Lagrangian Optimization
#### 4.1.3 Dynamic Adjustment Mechanism Based on Game Model
```  
**Algorithm 1** Nash Bargaining Game for Resource Allocation (NBGRA)  
The algorithm input includes the number of satellite nodes \(N\), the number of ground station nodes \(M\), channel gains \(\gamma_{ij}\), power limits \(p_{n}^{\max}\), and bandwidth limits \(W_{n}^{\max}\), while the output consists of each satellite node's optimal resource allocation \((P_{n}^{*},W_{n}^{*})\). For each node \(n\), the utility function \(U_{n}(P_{n},W_{n})\) is calculated based on power, bandwidth, and interference \(I_{n}\) (Lines 1-2). Subsequently, for each time slot \(t\) and frequency \(f\), the utility value in the current state is computed according to the defined utility function (Lines 3-5). After traversing all time slots and frequencies, the optimal resource allocation scheme is calculated based on the Nash bargaining solution formula (Line 8). Finally, each node's optimal power and bandwidth allocation results \((P_{n}^{*},W_{n}^{*})\) are returned (Line 10). By updating the Lagrange multipliers using the subgradient method, we can iteratively approach the optimal resource allocation strategy. In the game process, we need to optimize the Lagrangian function. The Lagrangian function is as follows:  
\[L(\lambda,\alpha,\beta)=\arg\max_{P_{n},W_{n}}\prod_{n=1}^{K}(U_{n}-U_{n}^{ \min})+\lambda\left(\sum_{n=1}^{K}P_{n}-P_{\text{total}}\right)+\alpha\left( \sum_{n=1}^{K}W_{n}-W_{\text{total}}\right) \tag{26}\]  
where \(\lambda\) and \(\alpha\) are the Lagrange multipliers corresponding to the power and bandwidth constraints. To solve this problem, we use the subgradient method to update the Lagrange multipliers. Specifically, in each iteration, we update the Lagrange multipliers based on the partial derivatives of the utility function with respect to power and bandwidth:  
\[\lambda_{k+1}=\lambda_{k}+\eta_{k}\left(\sum_{n=1}^{K}P_{n}-P_{\text{total}}\right) \tag{27}\]  
\[\alpha_{k+1}=\alpha_{k}+\eta_{k}\left(\sum_{n=1}^{K}W_{n}-W_{\text{total}}\right) \tag{28}\]  
where \(\eta_{k}\) is the learning rate, which controls the step size of the update. After each update, we can gradually converge to the optimal solution using the subgradient method, thereby obtaining the optimal resource allocation strategy. To further optimize resource allocation and ensure optimal power and bandwidth configurations under multiple constraints, we introduce an iterative resource allocation algorithm utilizing the Lagrangian multiplier method. The detailed implementation of this optimization process is presented in Algorithm 2. ```
0: Initial power and bandwidth allocation \((P_{n}^{*},W_{n}^{*})\). 0: Output Optimal power allocation \(P_{n}^{*}\), bandwidth allocation \(W_{n}^{*}\). 1: Initialize Lagrange multipliers \(\lambda_{0},\mu_{0}\). 2:while convergence criterion met met met do
3: Update Lagrange multipliers using Equations (27) and (28);
4: Update power and bandwidth allocations using Equation (25);
5: Check for convergence of \(P_{n}^{*},W_{n}^{*}\). 6:endwhile
7:Return:\((P_{n}^{*},W_{n}^{*})\)
```  
**Algorithm 2** Iterative Resource Allocation Using Lagrange Multipliers (IRA-LM)  
The algorithm input includes the initial power and bandwidth allocation \((P_{n}^{*},W_{n}^{*})\), and the output consists of the optimal power allocation \(P_{n}^{*}\) and bandwidth allocation \(W_{n}^{*}\) for each node. Initialize the Lagrange multipliers \(\lambda_{0}\) and \(\mu_{0}\) (Line 1). Until the convergence condition is met, continuously perform the following steps (Line 2): Update the Lagrange multipliers based on predefined rules (line 3), then adjust the power and bandwidth allocations to optimize resource configuration (Line 4). Next, evaluate whether the current power and bandwidth allocations have reached the convergence criteria (Line 5). When the convergence condition is satisfied, terminate the iteration process and return the optimized power and bandwidth allocation results \((P_{n}^{*},W_{n}^{*})\) (Line 7).