Application of sequential quadratic programming based on active set method in cleaner production

On the platform of general chemical process simulation software (it was named Optimization Engineer, OPEN), a general optimization algorithm for chemical process simulation is developed using C +  + code. The algorithm is based on sequential quadratic programming (SQP). We adopt the activity set algorithm and the rotation axis algorithm to generate the activity set to solve the quadratic programming sub-problem. The active set method can simplify the number of constraints and speed up the calculation. At the same time, we used limited memory BFGS algorithm (L-BFGS) to simplify the solution of second derivative matrix. The special matrix storage mode of L-BFGS algorithm can save the storage space and speed up the computing efficiency. We use exact penalty function and traditional step-size rule in the algorithm. These two methods can ensure the convergence of the algorithm, a more correct search direction and suitable search step. The example shows that the advanced optimization function can meet the requirements of General Chemical Process Calculation. The number of iterations can reduce by about 6.0%. The computation time can reduce by about 6.5%. We combined this algorithm with chemical simulation technology to develop the optimization function of chemical engineering simulation. This optimization function can play an important role in the process optimization calculation aiming at energy saving and green production.


Introduction
As one of the pillar industries of economic development, the chemical industry also has the characteristics of high energy consumption and high pollution. With the continuous progress of society, certain western countries have passed legislation requiring enterprises to adopt green chemical technology, safer chemicals, and non-toxic materials for production. At the same time, the development of China's economic field is gradually getting rid of the "pollution first, treatment later" approach, and fully turning to the path of green and environmental development. Cleaner production and green chemical theory mainly include the following two aspects: green raw materials and green production processes. The greening of raw materials is mainly the research and development of new materials and the application of recyclable materials. The greening of the production process is mainly to save material and water, save energy, reduce emissions and recycle. These three methods are the key technologies of clean production and green chemical industry. Therefore, under the current clean production and green chemical concepts, the realization of sustainable development in the field of chemical design and chemical simulation is mainly carried out on the following aspects. First, use non-toxic, and renewable materials when designing processes or simulation processes. Through simulation optimization technology, in the process design process, the material utilization rate in the production process is improved, and the emission of pollutants is reduced. Second, recyclable catalysts and green additives were used in the design and simulation of the production process. When the process was used in the product, it can make the reaction cleaner and greener. The third is the greening of products. Chemical production is usually impossible to be completely pollution-free.
Chemical optimization can use simulation methods to calculate and change equipment parameters or production parameters. Through the above methods, enterprises can adjust process parameters to achieve the goal of cleaner production. Therefore, chemical optimization plays an indelible role in cleaner production. Through chemical optimization, the technical level and performance of enterprise chemical equipment are improved to achieve the purpose of energy saving, consumption reduction and cleaner production. Existing large-scale simulation software, such as Aspen Plus (AP), can provide the chemical process modeling functions. However, the main purpose for using of the simulation software is for the analysis and optimization of chemical process. Figure 1 shows the most optimized application in actual production.
In simulation software, optimization is mostly applied to determine equipment design, equipment operating conditions, evaluate plant data, and process modeling. AP's optimization calculation is relatively mature. The default algorithm for AP's optimization is sequential quadratic programming. SQP algorithm is a relatively fast and efficient method for solving nonlinear programming problems. Many scholars have done a lot of research on SQP algorithm and achieved a lot of results. In the modular environment, the SQP method is applied to process optimization, and the infeasible path methods (Biegler and Cuthrell 1985a), feasible path methods (Biegler and Hughes 1985b) and hybrid algorithms are widely used.
The solution of the QP sub-problem of the SQP method can be transformed into the solution of the system of linear equations. Paniter et al. (1988) first proposed a system of linear equations method for solving general constrained optimization problems. This method is based on the KKT condition of the SQP method and needs to be solved for each iteration of several linear equations. However, these traditional SQP methods still face the problem that every step of the quadratic programming sub-problem must have a solution in the iterative process. The constraint condition of the sub-problem is linear approximation to the constraint condition of the original problem. Therefore, the constraint region may be empty, which cannot guarantee the correctness of the calculation. The problem of chemical engineering optimization is getting more and more complex, and the scale of the problem is getting bigger  Fig. 1 The applications of the most optimizations in actual production and bigger. The scale of the traditional SQP method for Hessian matrices increases dramatically. The problem of storage and calculation of optimization software for chemical engineering simulation is becoming more and more serious. Based on the above, Alkaya et al. (2001) proposed an improved RSQP algorithm based on space reduction. The algorithm eliminates dependent variables and equality constraints by variable decomposition, reduces the size of Hessian array in QP, and solves the problem of computer storage and computation in chemical optimization. A sequential quadratic programming algorithm with the help of constraint set and special penalty function is proposed by Gao et al. (1996). This algorithm solves the quadratic programming problem by using the activity set method. Liu and Jian (2020) establish a module relaxed SQP feasible direction algorithm for solving inequality constrained problems. In this algorithm, the original nonlinear problem is transformed into a simple problem with inequality constraints by the method of module array relaxation. The ε positive constraint set generated by the rotation operation is used to establish a sub-problem of the simple problem on this constraint set. This method the problem of subincompatibility is reduced, and new higher-order correction directions are generated. Fletcher and Leyffer (2002) propose a filtering method for solving nonlinear optimization problems. The method eliminates the use of value functions and avoids the influence of penalty parameters. Fletcher (1987) Combining trust-region method, filter method and SQP algorithm, proposed a hybrid trust-region filter-SQP algorithm. Yue et al. (2009) introduced the concept of filters into the optimization of chemical processes in a modular environment. He proposed a step-by-step standardization strategy and developed an appropriate chemical optimization system. However, each iteration of the system requires updating the filter set, which requires a lot of work and storage.
The traditional SQP method has the compatibility problem of sub-problem and the problem of too much computation and storage space for the calculation of QP sub-problem. Inspired by the idea of pattern relaxation and the step-bystep normalization strategy proposed by the abovementioned scholars, we develop an optimization calculation function suitable for conventional chemical processes. This optimization calculation function is realized on the platform of general chemical process simulation optimization software optimization engineer. Optimization function combined with process design and simulation requirements, using C + + coding for programming. The algorithm adopts SQP method with active constraint set, traditional Armijo-type step-size rule, which is suitable for practical chemical computation and step-by-step normalization strategy of L-BFGS algorithm. Compared with the previous SQP method, the new algorithm is more suitable for chemical simulation. The new algorithm greatly shortens the computation time on the premise of guaranteeing the convergence precision.

Problem simplification
The chemical process optimization problems in user-oriented open modeling in chemical simulation software usually take the following form: x ∈ R n , f, g i are all quadratic continuous differentiable. The Lagrange function can be obtained: Among them, u = (u 1 ,…u m ) ∈ R m is the Lagrange multiplier vector of the general constraint in Eq.
(2). The basic principle of the sequential quadratic programming method is to transform the nonlinear programming problem into a series of quadratic programming sub-problems and then solve the quadratic programming sub-problems. For the above problems, the quadratic programming sub-problems are as follows:

Active set method
By solving the above sub-problems, the step size d k can be obtained. There are mainly dual method, interior point method and active set method to solve the quadratic programming sub-problem. The dual method transforms the general constrained quadratic programming problem into a boundary constrained quadratic programming problem. The dual problem of the above sub-problems is as follows: At present, there are many methods to solve the boundary constraint problem. Yuan (1991) proposed a dual method for solving quadratic programming. Ni and Yuan (1997) proposed a quasi-subspace finite storage method to solve the large-scale nonlinear programming problem. Ni (2001) gives a hybrid solution of negative gradient and truncated Newton method. But for chemical simulation optimization, the boundary value can be simulated to get more accurate simulation value. Compared with the dual method, the simulation results are more concise and accurate. Karmarkar (2001) came up with the famous Karmarkar algorithm, the interior point method. However, the interior point algorithm has polynomial complexity and requires the initial point of the algorithm to be strict and feasible, but it is more difficult to calculate in practice. Mizuno (1992) proposed an infeasible interior point method to solve the above problems. Kojima et al. (1993) proposed an infeasible interior point method to solve the global convergence problem of linear programming.
Assuming that x k is the current iteration point, we define the positive constraint set for x k corresponding to the multiplier: The active set approach holds that inactive inequality constraints have no effect near the solution, while positive inequality constraints can be replaced by equality constraints because they are zero in the solution. Constructing a quadratic programming sub-problem QP (x, u, H) on Eq. (5): The principle of the positive set method is as follows: if x k is the local minimum of Eq. (3), then x k is also the local minimum of Eq. (6). Conversely, if x k is the KT point of Eq. (6) and its corresponding Lagrange multiplier u i ≥ 0, x k is also the KT point of the original problem [Eq. (1)]. So active set method is a feasible point method, each iteration only need to solve equality constraints, so in this software using active set method to solve quadratic programming. Let (Jian et.al. 2005): In the formula, e k is the identity matrix,

Using L-BFGS to replace Hessian matrix
For the second derivative matrix used in the solution, the finite difference method is usually used in programming to approximate the value of the corresponding function after the variable is discrete. The principle is the Newton method to find the stationary point, and the essence is to use the second-order Taylor expansion to find the second derivative: Using Eq. (10) to solve the Hessian matrix requires a lot of iterative solutions. Iterative computation is not only complicated, but also brings some mistakes, and it takes up a large amount of computer memory, so it is not suitable for computer programming. Fletcher (1987) and other mathematicians proposed BFGS algorithm. This algorithm approximates the Hessian matrix of L (x, u) to the Matrix B k . The first iteration of the algorithm treats B k as a unit matrix and corrects it during computation: Let , the BFGS correction formula requires s k and y k to meet the curvature condition, so Powell proposed a correction formula for the vector y k to meet the above conditions, let z k = k y k + (1 − k )B k s k , where Therefore, the constraint BFGS correction formula of matrix B k is as follows: The BFGS algorithm approximates the Hessian matrix iteratively using the identity matrix. However, a large number of B K matrices (calculated in 10,000 dimensions) need to be stored in the computation process. The computer memory required to store the B K matrix is about 7 GB, plus the storage required by the overall optimization algorithm. Space must take up a lot of computer memory and increase computing time. L-BFGS algorithm is used to solve the need for large memory, computing time problems. Eq. (12) can be converted to (Shen et al. 2020): (14) is transformed into: Instead of storing the B k matrix separately, the method stores all s k and y k . The algorithm uses all s k and y k to compute the target matrix Bk. When the target storage capacity is reached, the front-end s k and y k can be discarded to save computer memory and computing time precision. This algorithm uses {s i , y i } k i=0 to compute H k + 1 . The L-BFGS algorithm stores m data continuously from s 0 , y 0 , so it can only store s m-1 , y m-1 . The algorithm can only compute H 1 , H 2 , …, H m , the following calculation needs to discard the first generated vector, that is, when calculating H k + 1 , save {s i , y i } k i=0 discard {s 0 , y 0 } (Nocedal and Wright 1999).

Linear search
To ensure convergence, the search steps are usually determined by the value functions in the algorithm, such as the ℓ 1 value function and the Fletcher value function. Both methods have simple forms and ideal numerical results and are suitable for chemical simulation and optimization. Wang et al. (2019) proposed an arc search step strategy without penalty function and filter. This strategy is suitable for a special problem, especially for equations and inequalities with mixed constraints. It is not suitable for conventional chemical process optimization. The strategy is simple in form, and the numerical result is an ideal ℓ 1 value function for determining the direction of descent: Among them, the penalty parameter > 0 . And combined with Armijo criterion to speed up the line search speed and accuracy: Given ∈ (0, 1), ∈ (0, 0.5) , let the step factor k = m k , where is the smallest non-negative integer that realizes the following inequality: Combine the two to obtain d k , which is the following formula: Among them, m k ∶= m,x k+1 ∶= x k + m k d k . Figure 2 shows the algorithm that combined with the optimization of chemical engineering simulation. The calculation steps of the algorithm are as follows:

Chemical simulation optimization combined with the algorithm
(1) Obtain the objective function and constraint function input by the user; (2) Use general chemical process simulation and optimization software process simulation function to calculate the objective function and constraint function value; (3) Find the gradient, given the initial identity matrix B k ; (4) Solve the sub-problem (3) with the active set method, and get d k ; (5) Calculate the convergence and output the result; otherwise, proceed to the next step; (6) Use ℓ 1 value function and Armijo criterion; (7) Let k: = k + 1, continue to step 3.

Case study
In Fig. 3, take the atmospheric and vacuum distillation process as an example. The process can be divided into three parts: desalting and dehydration, atmospheric distillation and vacuum distillation. Crude oil is divided into fractions with a certain boiling point by heating, vaporization, fractionation and condensation in a crude oil distillation unit. The separated fractions were heated to 205 °C ~ 230 °C and entered the primary distillation column. Reforming feedstock or light gasoline is distilled from the top of the primary distillation column and is mainly used as reforming feedstock. Further heat transfer of bottom oil of primary distillation column. The bottom oil is further heated in an atmospheric furnace to about 360 °C and enters the atmospheric tower.
Atmospheric towers are generally divided into three parts: the top, the middle, and the bottom of the tower, generally more than 40 trays. Lighter components (such as gasoline, kerosene, diesel and heavy diesel) vaporize in the vaporization section to form a mixture of oil and gas. The wax oil and heavy oil remain liquid, and the mixed oil and gas rise to the distillation section of the column and come into contact with the reflux liquid. In the mixed oil and gas, the components with higher boiling points are condensed, while those with lower boiling points in the reflux liquid are vaporized. The gas phase continues to rise and gradually condense. Diesel, kerosene and gasoline with higher boiling points condense into liquids in turn. Kerosene, light diesel oil and heavy diesel oil are drawn from the sideline at the boiling point temperature corresponding to the steam pressure at the bubbling point temperature. Gasoline and non-condensable gas are extracted from the return tank, respectively. The function of the atmospheric column is to separate a portion of the crude oil under conditions close to atmospheric pressure. The product of atmospheric tower is part gasoline and kerosene. The side of the atmospheric tower is also provided with a stripping tower. The purpose of setting stripping tower is to make the first distillation point and flash point of sideline products of atmospheric tower qualified. The stripper uses a steam distillation process to separate the components of the atmospheric sideline product. The stripping tower should be set up on the normal line and the normal junction line. The atmospheric stripping tower is a combined tower which is connected with the stripping towers on each sideline. The bottom oil of the atmospheric tower goes into the vacuum heating furnace.
Vacuum heating furnace generally heated to about 400 °C after sent to the decompression tower. The function of the vacuum tower is to continue the fractionation of the atmospheric bottom oil after the normal pressure tower fractionation to obtain the heavy diesel wax oil base oil and other products. Vacuum distillation is the process of vaporization and fractionation of hydrocarbons with a Fig. 2 Calculation steps of the improved optimization algorithm higher boiling point under a certain degree of vacuum. The bottom oil of the atmospheric column is distilled under reduced pressure. The obtained fraction can be used as feedstock for cracking (thermal cracking, catalytic cracking, hydrocracking, etc.) or lubricating oil. The feedstock can be used as ethylene cracking feedstock. Vacuum tower bottom oil can be used as fuel oil, pitch coking or other residue processing (solvent deasphalting, residue catalytic cracking, residue hydrocracking) of the raw materials.
In this process, the feed temperature is T 1 = 30 °C, the pressure P 1 = 1Mpa, the feed mass flow F 1 = 270166 kg/h, the temperature of the heating furnace F101 is T 2 = 355 °C, and the temperature of the heating furnace F102 is T 3 = 363 °C.
We list the parameters of each module in the process in Tables 1, 2 and 3: The process is optimized according to the requirements of clean production, energy saving and consumption reduction. The aim of optimization is to reduce the energy consumption of the process and the emissions of sulfides, CO 2 and CO from the top of the vacuum tower. The process is optimized

Discussion of results
In the general chemical process simulation optimization software, the traditional SQP method, the trust zone SQP method and the improved active constraint set SQP method are used to optimize the above process. The results are shown in Table 4. The results show that the optimization results obtained by the three methods all meet the requirements of the optimization objective, and the results are more accurate. The energy consumption of the three optimization results all meet the requirements of H 2 < 23500kw and H 3 < 1100kw.The results show that the optimized H 2 S, CO 2 and CO emissions are reduced by about 92 kg/h, which is about 40% of the preoptimized emissions. Compared with the traditional SQP method, the filter-SQP method reduces the iteration times by about 3.12%. Compared with the filter-SQP method, the improved active set SQP method reduces the iteration times by 6.45%. Compared with the traditional SQP method, the improved filter-SQP method reduces the iteration times by 9.38% and the computation time by 1.49%. Compared with H3 < 11000 the filter-SQP method and the traditional SQP method, the improved active set SQP method saves about 4.81% and 6.23% of the computation time, respectively. In the same operation condition, the improved active set SQP method has lower memory utilization than the former two methods. The main reasons are as follows: first, the improved positive set SQP method uses L-BFGS algorithm in machine learning. The L-BFGS algorithm is similar to the BFGS algorithm, but the L-BFGS algorithm needs less memory to store matrix. Secondly, the activity set method is a feasible point method, which can avoid unnecessary computation and iterative search.

Conclusion
On the optimization engineer platform of general chemical process simulation software, an improved SQP optimization algorithm was developed. The algorithm uses the active set method, which generates the active set through the rotation axis operation of the iterative point. The active set method obtains the feasible points of the QP sub-problem, which makes the optimization problem easier to converge, and the calculation speed is faster. The developed algorithm also combines the L-BFGS algorithm. The L-BFGS algorithm is similar to the BFGS algorithm, which solves the problem of difficulty in establishing the second derivative matrix in chemical engineering simulation. Compared with the BFGS algorithm, the L-BFGS algorithm requires less storage space, thereby reducing the computer's memory consumption and speeding up the calculation time. At the same time, the traditional Armijo step rules are used to ensure the convergence and speed of the algorithm. Through actual verification, the following conclusions are drawn: 1. The traditional SQP method is the basis of all improved SQP methods, and the SQP method based on the trust-region method has a wide range of applications and a faster calculation speed. Therefore, these two methods are selected to compare the results with the SQP method based on the positive constraint set and focused on the calculation speed and the number of iterations. The example shows that compared with the traditional SQP method, the algorithm reduces the iteration time by 5-10% and the calculation time by 5-8%. Compared with traditional optimization algorithms, the improved algorithm has faster calculation speed and is more suitable for more complex optimization problems.
2. The algorithm is combined with chemical simulation to realize the simulation and optimization of the chemical process. The algorithm is combined with chemical simulation to realize the simulation and optimization of chemical process. The factory can use this optimization function in the simulation software to simulate the production process on the computer and optimize the process. The above examples can also prove that chemical simulation optimization software can play a more important role in the simulation and optimization of complex working conditions. Chemical simulation software can not only achieve the optimization goal of increasing production, but also can better simulate and calculate the production optimization problems of energy saving, emission reduction, cleaner production and other production goals.
3. With the help of simulation optimization software to simulate and optimize the production process, it can greatly simplify the complexity of the future factory production process design, transformation and other processes, and improve the safety of the design, construction and transformation process. Moreover, the optimization calculation complexity of the future production process will become higher and higher, and more efficient and practical optimization algorithms are particularly important for the optimization calculation of the production process.
At present, the footwork of the algorithm is relatively simple, and it is necessary to further study the footwork in order to develop a more effective optimization algorithm.