# Energy Trading Strategy for Heat and Electricity-Coupled Microgrid Based on Cooperative Game
## 6 Distribution Solution
### Problem Decomposition  
As mentioned above, the bargaining problem (26) involves variables of different participants. However, the variables \(el_{i}^{h}\), \(tl_{i}^{h}\), \(p_{i}^{h}\), and \(\lambda_{i}^{h}\) couple the MGO and users together. It is not suitable for solving distributed optimization and needs to be decoupled. To achieve the NBS of the cooperative bargaining game, the MGO and users should reach a consensus on the volumes and prices of electrical and thermal energy. Therefore, the following auxiliary variables and constraints are introduced. \[p_{iM}^{h} =p_{Mi}^{h} \tag{28}\] \[\lambda_{iM}^{h} =\lambda_{Mi}^{h}\] (29) \[el_{iM}^{h} =el_{Mi}^{h}\] (30) \[tl_{iM}^{h} =tl_{Mi}^{h} \tag{31}\]  
where \(p_{iM}^{h}\) and \(el_{iM}^{h}\) are the electrical bargaining price and electrical energy consumption of user \(i\) to MGO, respectively. \(\lambda_{iM}^{h}\) and \(tl_{iM}^{h}\) are the thermal bargaining price and thermal energy consumption of user \(i\) to MGO, respectively. \(p_{Mi}^{h}\) and \(el_{Mi}^{h}\) are the electrical bargaining price and electrical energy sales of MGO to user \(i\), respectively. \(\lambda_{Mi}^{h}\) and \(tl_{Mi}^{h}\) are the thermal bargaining price and thermal energy sales of MGO to user \(i\), respectively. In addition, the auxiliary variables \(\left(p_{iM}^{h},p_{Mi}^{h}\right)\), \(\left(\lambda_{iM}^{h},\lambda_{Mi}^{h}\right)\), \(\left(el_{iM}^{h},el_{Mi}^{h}\right)\) and \(\left(tl_{iM}^{h},tl_{Mi}^{h}\right)\) should satisfy the constraints of original variables \(p_{i}^{h}\), \(\lambda_{i}^{h}\), \(el_{i}^{h}\) and \(tl_{i}^{h}\). Thus the problem (26) can be rewritten as:  
\[ \begin{split}&\max\ \ln\left[l_{MGO}^{h}\left(p_{iM}^{h},el_{iM}^{h}, \lambda_{iM}^{h},tl_{iM}^{h},\ldots\right)-B_{MGO}^{h}\right]+\sum\limits_{m \in M}\ln\left[l_{i}^{h}(p_{iM}^{h},el_{iM}^{h},\lambda_{iM}^{h},tl_{iM}^{h}, \ldots)-B_{i}^{h}\right]\\ &\text{s.t. }l_{MGO}^{h}>B_{MGO}^{h},U_{i}^{h}>B_{i}^{h}\\ &\quad(1)-(5),(7)-(12),(18)-(22),(26)-(29)\end{split}  \tag{32}\]The augmented Lagrangian functions for the distributed optimization objectives of MGO and users can be formulated as follows:  
\[ \begin{array}{l}\text{min}L_{i}=-U_{i}\\ \quad+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\alpha_{IM}^{h}(p_{iM}^{h}-p_{Mi }^{h})+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\frac{\rho_{1}}{2}\|p_{iM}^{h }-p_{Mi}^{h}\|^{2}\\ \quad+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\beta_{IM}^{h}(e_{iM}^{lh}-e_{ Mi}^{lh})+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\frac{\rho_{2}}{2}\|e_{iM}^{lh}-e_{ Mi}^{lh}\|^{2}\\ \quad+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\tilde{\xi}_{iM}^{h}(\lambda_{ iM}^{h}-\lambda_{Mi}^{h})+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\frac{\rho_{2}}{2}\| \lambda_{iM}^{h}-\lambda_{Mi}^{h}\|^{2}\\ \quad+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\tilde{\xi}_{iM}^{h}(t_{iM}^{ h}-t_{Mi}^{lh})+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\frac{\rho_{4}}{2}\|t_{ iM}^{h}-t_{Mi}^{lh}\|^{2}\\ \end{array}  \tag{33}\]  
\[ \begin{array}{l}\text{min}L_{\text{MGO}}=-U_{\text{MGO}}\\ \quad+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\alpha_{Mi}^{h}(p_{Mi}^{h}-p_{ iM}^{h})+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\frac{\rho_{1}}{2}\|p_{Mi}^{h}-p_{ iM}^{h}\|^{2}\\ \quad+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\beta_{Mi}^{h}(e_{Mi}^{lh}-e_ {iM}^{lh})+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\frac{\rho_{2}}{2}\|e_{ Mi}^{lh}-e_{iM}^{lh}\|^{2}\\ \quad+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\sum\limits_{h=1}^{H}\tilde{ \xi}_{Mi}^{h}(\lambda_{Mi}^{h}-\lambda_{iM}^{h})+\sum\limits_{i=1}^{N}\sum \limits_{h=1}^{H}\frac{\rho_{2}}{2}\|\lambda_{Mi}^{h}-\lambda_{iM}^{h}\|^{2}\\ \quad+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\tilde{\xi}_{Mi}^{h}(t_{Mi}^{ h}-t_{iM}^{lh})+\sum\limits_{i=1}^{N}\sum\limits_{h=1}^{H}\frac{\rho_{4}}{2}\|t_{ Mi}^{h}-t_{iM}^{lh}\|^{2}\\ \end{array}