1. A method for optimizing flexible constraints of an electric power system, comprising: S 1 , expressing a total power generation cost f′ of the electric power system by a sum of quadratic functions of active power outputs of all generator sets in the system in a flexible formula as follows: f ′ = ∑ i = 1 N g ( a i P Gi 2 + b i P Gi + c i ) = f 0 + δ f Δ f , ( 1 ) wherein N g represents a total number of generators of the system, i=1, 2,. .. , N g , and a i , b i and c i are power generation coefficients of a generator set i; P Gi is an active power of the generator i; f 0 represents a minimum expected value of the total power generation cost of the system, Δf represents an acceptable maximum increment of the total power generation cost of the system; δ f is a flexible index of a power generation cost of the system, and a numerical area of the flexible index is as follows: δ f ε[0,1]; S 2 , selecting a multi-dimensional flexible optimization model or a flexible power generation cost optimization model according to a practical situation of the electric power system and a practical purpose of optimization; S 3 , determining an operating conditions, including a power grid structure, and voltages and powers of the generators, of the electric power system; S 4 , carrying out load flow calculation based on the operating conditions of the electric power system; and S 5 , carrying out corresponding optimization calculation according to the flexible multi-dimensional or flexible power generation cost model selected in the step S 2 to obtain a comprehensive flexible optimization result or an optimal power generation cost, if the load flow calculation is successful, and if the load flow calculation fails, carrying out corresponding optimization calculation according to an optimal load curtailment model to obtain an optimal load curtailment.