The invention relates to a far-near combination type mid-and-long-term relaxation network security constraint modeling method. According to the method, firstly, the network security constraint is relaxed, so that the problem of no optimum solution is avoided. Meanwhile, according to practical production requirements, network security profiles are classified according to the importance level, and a security profile of a higher importance level is optimized during the entire optimization period. At the same time, general security profiles are optimized only during the recent optimization process. In this way, the dimensionality of the optimization calculation is greatly reduced, and the optimization time is shortened. At the same time, in combination with the actual production requirements, network security profiles are classified according to the judgment on whether or not to allow the breakthrough. That means, the network security profiles are classified into two types, wherein the breakthrough is allowed for one type of network security profiles and is not allowed for the other type of network security profiles. Different weight coefficients are arranged for the two types of network security profiles respectively. Therefore, the far-near combination type relaxation network security constraint containing weight coefficients is adopted for optimization calculation. As a result, a unit combination optimization scheme that meets the actual production requirements can be quickly obtained. The conditions of long optimization time and no optimum solution can be avoided.