## 2 Market Transaction Rules and the Carbon Responsibility Approtioning Method
### Bi-Level Model Interaction Framework  
In this paper, the bilateral market is introduced to establish a hybrid electricity market emission reduction model considering carbon emission flow and source-load coordination. The framework is shown in Figure 2 and is described as follows:  
The upper layer is the clearing layer of the hybrid electricity market. In the pool market, the mode of centralized bidding and unified liquidation is adopted, and all the power generators quote to ISO, where the wind power and photovoltaic power generators consider uncertainty factors in the quotation and ISO determines the market clearing price and the bid-winning power of each generator with the minimum procurement cost as the goal. Meanwhile, the bilateral market refers to the bilateral negotiation mode under the background of the direct purchase of electricity by large users. Generators determine the quotation of both parties according to the declared power of the user. The pool market and bilateral market were cleared at the same time; according to the cleaning result, the carbon intensity of each user node is calculated using the carbon emission flow theory and the electricity price is sent to the user. The lower layer is the decision-making level of the users' electricity consumption. According to the electricity price and carbon responsibility allocation results, users decide the power purchasing strategy for each period with the goal of minimizing the cost of electricity. After constructing the double-layer model, the paper uses the idea of double-layer iterative optimization to solve it so as to obtain the optimal power purchase strategy scheduling of users every day (24 h). The model is divided into two optimization levels: upper optimization and lower optimization. Among them, the optimization of the upper layer is solved by an improved genetic algorithm, the optimization of the lower layer is solved by Yalmip/Gurobi solver and the upper and lower layers are iteratively optimized through interactive decision variables. It is important to note that the parameter setting of the genetic algorithm has a great influence on the performance and effect of the algorithm. The increase in the population will lead to the expansion of the search space but the calculation time will also increase. Therefore, the general setting range is 50-200. Furthermore, the crossover rate determines the number of individuals required for each generation. A high crossover rate may lead to early convergence so the experience value is 0.6-0.9. In addition, the number of iterations should be optimized according to the space size of feasible solutions. The main steps are as follows:  
1. Input data such as the output parameters of wind, light, and fire generators; user load; scalar constraint; and market clearing price constraint in generators. 2. Initialize the generator parameters and select the most suitable parameters for the genetic algorithm after several simulation tests according to the above rules. Set the population number m to 55, the number of iterations to 80, the scaling factor to 0.5, the crossover probability to 90%, and the convergence error. The improved adaptive genetic algorithm is used to generate the initial quotation quantity strategy group of power generators. ISO determines the market clearing price and the bid quantity according to the strategies of power generators and feed them back to each power generator. The selection and variation of the improved adaptive genetic algorithm are used to generate a new optimal quotation strategy for power generators. 3. Determine whether the number of upper iterations meets the convergence condition. If yes, output; if no, return to Step 2. 4. Use the carbon emission flow theory to calculate the users' carbon responsibility. 5. The clearing price and node carbon intensity are substituted into the lower-level user model and solved using Yalmip/Gurobi on the MATLAB platform. Figure 2: The framework of the bi-level model.