**4. Solution Method**

#### *4.1. Linearization of the Cost Function*

In GAMS, nonlinear functions can be linearized by defining the SOS2 variables. The SOS2 variables consist of <sup>λ</sup>*i*(*<sup>i</sup>* = 1, 2, ···, *n* + 1) elements, with up to two non-zero elements in λ*i*, and satisfies λ1 + λ2 + ··· + λ*n*+<sup>1</sup> = 1. Suppose the fractional linear function *f*(*x*) can be equally divided into linearized *n* segments on [*<sup>a</sup>*,*b*], and *a* = *x*1 < *x*2 < ··· < *xn*+1 = *b* are *n* + 1 segmentation points [30,31]. The starting point of the paragraph *i* can be expressed as:

$$x\_i = a + \frac{b-a}{n}(i-1) \tag{23}$$

Assuming (*x*, *y*) is a point in the segmen<sup>t</sup> *i*, and *x* = λ*ixi* + λ*i*+1*xi*+1, λ*i*, λ*i*+<sup>1</sup> satisfies λ*i* + λ*i*+<sup>1</sup> = 1, then the linear approximation of *y* can be written as:

$$\overline{y} = \lambda\_1 f(\mathbf{x}\_1) + \lambda\_2 f(\mathbf{x}\_2) + \dots + \lambda\_{n+1} f(\mathbf{x}\_{n+1}) \tag{24}$$

Using the above method, the quadratic cost function in the objective function is linearized.

#### *4.2. Market Clearing and Safety Checking Process*

The method proposed in this paper can be divided into two stages. The first stage is the market clearing, which considers the convertible load during the market clearing; when the line transmission power is overrun in the clearing result, the second stage of the process is performed. By adjusting the output of the unit and reducing the flexible load at the same time, the purpose of eliminating the out-of-limit line flow is achieved. The safety checking can further ensure the safety of the market clearance. The specific process is shown in Figure 6.

The solution steps are as follows:

Step 1: Input unit data, line parameters, and other data. The generator and the demand side submit the quotation curve, and dispatch department execute the market clearing process. Then, initial power generation plan is formulated.

Step 2: Start the power flow calculation program to determine whether the power flow exceeds the limit. If it does not exceed the limit, end the calculation and output the power generator output; otherwise, proceed to the next step.

Step 3: Output the over-limit line number and over-limit power.

Step 4: Start the safety checking module, execute the safety checking procedure, calculate the generator adjustment of the generator, and reduce the load to reduce the power.

Step 5: Output the power of the generator and reduce the power by reducing the load.

The market clearing model discussed in this paper is a nonlinear programming model. After linearizing it, it is solved by calling the CPLEX solver in GAMS.

**Figure 6.** Market clearing and safety checking process that considers the flexible load.
