## 3 Mechanism and Algorithm
### The Stable Trading Matching Mechanism  
Coal mining and power generation companies negotiate for medium- and long-term contracts for the coal supply and demand that are required in power generation. The stable matching mechanism refers to the process and rules through which these coal mining and power generation companies reach stable trading relations. First, the participants on both sides of the market disclose their trading information, providing a list of their preferences for the participants on the other side of the market based on their own satisfaction with such matches. Second, both the coal mining and power generation companies release their expected orders with regard to the coal supply and demand, respectively; the participants then review and shortlist their trading partners based on the released orders and their preferences for matching. Last, when the demand for coal by the power generation companies is met, or the maximum coal quantity that the coal mining companies can supply has been reached, the trading matching is complete. Based on the above outline, this research designs the following process and mechanism to achieve stable matching between coal mining and power generation companies (as shown in Figure 1).  
Process 1: Based on the matching information that is provided by the participants on both sides of the trading relationship, the coal mining and power generation companies provide a list of preferences for the matches based on their own circumstances.  
Process 2: The power generation companies release their anticipated orders to meet their demand, including information about the amount of coal that they want, the expected contracts, and the volume of coal trading that the power generation company wants to reach.  
Process 3: The coal mining companies review and sort the orders that were provided by the power generation companies. Based on the degree of matching preferences, the coal mining companies rank the power generation companies that they are interested in. Furthermore, they respond to all of the power generation companies that they are interested in with an offer to supply coal. The total quantity of coal in all of the offers that are provided by one coal mining company cannot exceed the company's upper limit of coal supply.  
Process 4: The power generation companies review and sort the offers of coal supply, rank their preferences for the coal mining companies that have offered to supply coal, and delete the companies that they are not willing to trade with or the offers that they believe are impossible to materialize from their list of preferences.  
Process 5: The power generation companies send requests to their preferred participants for their coal supply. This is done one by one in the order of their preference for the coal mining companies until the total quantity of coal that was demanded by the power generation company has been met.  
Process 6: The coal mining companies accept or reject the requests to supply coal that have come from the power generation companies. This is done by accepting the requests one by one in the order of preference for the power generation companies until the company's upper limit of coal supply has been reached. The rest of the requests are then rejected.  
Process 7: The power generation companies that have been rejected continue to send requests for coal supply to their less preferred coal mining companies. This is done by sending requests one by one in the order of their preference for the coal mining companies until the remaining coal demand is met.  
Process 8: The previous two steps are repeated until no power generation companies still need to send requests for coal supply or all of the coal mining companies have reached the upper limit of their coal supply.