Next Article in Journal
Squeeze-and-Excitation Networks and the Improved Informer Model for Bearing Fault Diagnosis
Previous Article in Journal
Research on Energy Storage Configuration Optimization Method for Wind Farm Substations Based on Wind Power Fluctuation Prediction Integrating Chaotic Features and Bidirectional Gated Recurrent Units
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Design and Implementation of a Reduced-Space SQP Solver with Column Reordering for Large-Scale Process Optimization

School of Automation, Hangzhou Dianzi University, Hangzhou 310018, China
*
Authors to whom correspondence should be addressed.
Algorithms 2025, 18(11), 699; https://doi.org/10.3390/a18110699
Submission received: 8 September 2025 / Revised: 9 October 2025 / Accepted: 20 October 2025 / Published: 3 November 2025

Abstract

Process industries increasingly face large-scale nonlinear programs with high dimensionality and tight constraints. This study reports on the design and implementation of a reduced-space sequential quadratic programming (RSQP) solver for such settings. The solver couples a column-reordering space-decomposition strategy with sparse-matrix storage/kernels, and is implemented in a modular C++ framework that supports range/null-space splitting, line search, and convergence checks. We evaluate six small-scale benchmarks with non-convex/exponential characteristics, a set of variable-dimension tests up to 128 k variables, and an industrial reverse-osmosis (RO) optimization. On small problems, RSQP attains an accuracy comparable to a full-space sequential quadratic programming (SQP) baseline. In variable-dimension tests, the solver shows favorable scaling when moving from 64 k to 128 k variables; under dynamically varying degrees of freedom, the iteration count decreases by about 62% with notable time savings. In the RO case, daily operating cost decreases by 4.98% and 1.46% across two scenarios while satisfying water-quality constraints. These results indicate that consolidating established RSQP components with column reordering and sparse computation yields a practical, scalable solver for large-scale process optimization.

1. Introduction

As the process industries advance toward greater integration and intelligence, real-world optimization problems increasingly exhibit typical characteristics such as variable dimensions ranging from thousands to millions, tightly coupled constraints, and limited computational resources. In such large-scale nonlinear programming (NLP) settings—e.g., full-process simulation and dynamic optimization—traditional methods often fail to meet requirements due to the prohibitive storage cost of the Hessian matrix and insufficient convergence robustness [1,2]. Among available methods, SQP—owing to its strong robustness and fast convergence—has become one of the core techniques for large-scale nonlinear optimization [3,4]. However, the computational complexity of its quadratic programming (QP) subproblems grows rapidly with the number of variables, leading to real-time bottlenecks in high-dimensional, low-degrees-of-freedom scenarios.
The core logic of SQP is to approximate the original problem by iteratively solving QP subproblems, and its technical evolution has laid the groundwork for subsequent improvements: in 1963, Wilson first proposed the SQP framework [5]; in 1976, Han combined a second-order approximation of the Lagrangian with a penalty function and established global convergence [6,7]; in 1978, Powell introduced a penalty-free SQP variant that avoids the difficulty of choosing penalty parameters and significantly improves stability [8,9,10]; in 1989, Nocedal and Wright incorporated trust-region constraints to address instabilities of second-order models, further enhancing numerical reliability [11]; and in 1992, Gill et al. developed sparse SQP tailored to exploit sparsity, providing an efficiency foundation for high-dimensional problems [12,13,14]. Despite these advances, the fundamental bottlenecks remain in high-dimensional, low-degrees-of-freedom settings: the storage and computational cost of the full-space Hessian and the tight coupling of QP subproblem size to the number of variables have yet to be fundamentally resolved.
To overcome these bottlenecks, RSQP algorithm, developed from dimensionality-reduction ideas, has become an effective approach for such problems. By employing three core strategies—variable decomposition (splitting primary and dependent variables), low-rank Hessian approximation, and reduced-dimensional search-direction computation—RSQP shrinks the QP subproblem size from the original variable dimension to the degree-of-freedom dimension, thereby substantially lowering computational cost.
Early work on RSQP focused on laying the foundations of variable decomposition and reduced-dimension QP. Biegler and co-workers introduced the degrees-of-freedom concept from chemical engineering into SQP, proposing a split between independent and dependent variables. This transformation converts process models containing on the order of 105 state variables into QP subproblems with only a few hundred primary variables, thereby establishing the prototype of RSQP. Nocedal and Byrd (1990–1998) further incorporated the limited-memory Broyden–Fletcher–Goldfarb–Shanno (L-BFGS) method, replacing the dense Hessian with O(m) vector pairs and reducing storage and computational complexity from O(n2) to O(mn), which opened the door to problems with tens of thousands of variables and beyond.
Since the early 2000s, research has shifted toward global convergence and robustness to ill-conditioning. In 2003, Tits et al. proposed projected SQP, which uses a generalized projection operator to map infeasible QP solutions back to the feasible region, thereby eliminating reliance on penalty functions and markedly improving stability near bounds; it also indirectly enhances adaptability to the initial point [15,16]. In 2005, Shao Zhijiang’s team combined dynamic basis transformation with hybrid automatic differentiation to monitor the Jacobian condition number in real time, reducing the failure rate of parameter estimation for a methanol–hydrocarbon reactor by 30% and accelerating gradient evaluation by two orders of magnitude, providing an important reference for improving RSQP’s numerical stability [17]. In 2006, Jiang Aipeng et al. employed an L-BFGS implicit representation of the Hessian, cutting memory usage for a 30,000-variable polypropylene optimization problem from 2400 MB to 800 MB and enabling online solutions for ten-thousand-variable problems [18]. In 2015, Biegler’s group proposed a new EO optimization framework that exploits structural sparsity and vectorized automatic differentiation, extending RSQP to the million-variable scale and breaking traditional dimensional limits in process optimization [19]. Taken together, these advances complete the theoretical foundation of RSQP in finite-dimensional, deterministic settings and bring the algorithmic core to maturity.
Although the RSQP method and its variants have evolved into a relatively mature theoretical framework—and its core architecture has not undergone disruptive changes in recent years, which partly explains the limited surge of publications—the field is far from stagnant. Current frontiers are shifting from framework-level innovation to deeper performance and domain integration, leveraging stochastic analysis, infinite-dimensional theory, and GPU parallelism to push RSQP toward more complex mathematical settings and broader applications. Curtis and Robinson proposed a stochastic RSQP for models with stochastic objectives and deterministic equality constraints, proving worst-case complexity on par with unconstrained stochastic gradient methods and, for the first time, providing performance guarantees for constrained optimization with high-noise simulations [20]. Uihlein and Wollner extended RSQP to Hilbert spaces; via a two-phase feasibility/optimality strategy and adaptive line search, they achieved superlinear convergence without requiring LICQ/MFCQ, laying a new foundation for PDE-constrained optimization [21]. Ma et al. proposed a hybrid approach to handle the inconsistency of subproblems and corrected key numerical errors, thereby enabling the new algorithm to exhibit improved robustness and computational efficiency [22]. The group led by Leyffer designed a unified funnel restoration SQP that restricts search directions through a projection operator, ensuring global convergence without penalty functions; its funnel mechanism can be embedded directly into RSQP as an alternative to tuning penalty parameters [23]. Fang et al. mapped the multiple-shooting and reduced-space decomposition onto GPUs and employed a block-sparse Schur complement technique, achieving real-time solutions within 5 min for state-control problems of dimension 107, along with a theoretical analysis of parallel scalability [24].
In summary, after more than forty years of development, the RSQP method has progressed from a dimensionality-reduction strategy to a mature algorithmic framework. Recent international research has further brought stochasticity, infinite-dimensional settings, and industrial-scale problems into scope, achieving closed-loop validation in complex systems such as chemicals and energy. Nevertheless, adaptive selection of basic variables and reordering for ill-conditioned Jacobians remain common bottlenecks, which motivates the column-reordering space-decomposition strategy pursued in this work.
In response to the above challenges, this paper designs and implements, in C++, an RSQP solver based on a column-reordering space-decomposition strategy and sparse-matrix techniques. The core innovation is to optimize the column ordering of the Jacobian, dynamically generating an optimal column-exchange scheme so that the reordered matrix is closer to diagonal dominance, thereby improving the numerical stability of the basis matrix and the efficiency of variable decomposition. Combined with efficient sparse-matrix storage and computation, this further and significantly reduces the storage cost of the Hessian and the solution cost of the QP subproblems.
This work evaluates the algorithm with two categories of case studies. First, small-scale cases—including non-convex and exponential characteristics—are used to verify that the RSQP solver attains convergence accuracy consistent with the commercial solver Fmincon. Second, large-scale variable-dimension cases are used to assess scalability and memory optimization. For the engineering application, the solver is applied to the optimization of a single-stage, three-pass high-pressure RO unit for high-salinity wastewater treatment at a coal-fired power plant, achieving reductions in product-water cost of 4.98% and 1.46% under two typical operating scenarios, while all key water-quality indicators satisfy the imposed constraints.
The main contributions of this paper are as follows:
(1)
For large-scale nonlinear optimization in process industries, a solver algorithm based on a column-reordering space-decomposition strategy is designed. It reconstructs the reduced QP subproblem, projecting the high-dimensional optimization problem onto a low-dimensional subspace for solution, thereby significantly reducing computational complexity.
(2)
Implemented in C++ with a top-down design, an RSQP solver is developed in a modular manner, partitioned into functional modules such as program invocation, input checking, preliminary preprocessing, and iterative solving, with clear interfaces that improve maintainability and extensibility.
(3)
In implementing the RSQP algorithm, we make full use of efficient sparse-matrix storage and computation methods to further improve computational efficiency and memory utilization for large-scale problems, enhancing the algorithm’s engineering applicability in high-dimensional sparse settings.
(4)
Through small- and large-scale case studies with diverse characteristics, as well as an industrial application test, we systematically evaluate performance across different problem sizes and structures, providing a practical solution for large-scale nonlinear optimization in process industries.

2. Theoretical Foundations

2.1. Mathematical Model of the Optimization Problem

An optimization problem seeks, under given constraints, a decision vector that maximizes or minimizes an objective function. Its mathematical model can be written in the following general form:
m i n         f x s . t . g i x 0 , i = 1,2 , , m h j ( x ) = 0 , j = 1,2 , , p
where x = ( x 1 , x 2 , , x n ) is the decision-variable vector, f x is the objective function, g i ( x ) are inequality constraints, and h j ( x ) are equality constraints; m and p denote the numbers of inequality and equality constraints, respectively.
In an optimization problem, the decision variables must satisfy the prescribed constraints. The set of all such points constitutes the feasible region, that is, the set of admissible values of the decision variables for which all constraints hold. In particular, the inequality constraints g i ( x ) 0 and the equality constraints h j ( x ) = 0 partition the space into feasible and infeasible regions. Every point in the feasible region is a feasible solution, but not every feasible solution is optimal; an optimal solution is one that makes f ( x ) attain its minimum (or maximum) over the feasible region.
When both the objective and all constraint functions are linear, the problem is a linear optimization problem for which mature and relatively simple algorithms exist. In many real applications, however, the objective and some constraints are nonlinear, yielding a nonlinear program whose solution is considerably more challenging.

2.2. Necessary and Sufficient Conditions

Every feasible solution yields a value of the objective; the key is to determine whether a given feasible point is optimal.
Optimal solutions must satisfy certain necessary and sufficient optimality conditions, derived from the gradients of the objective and constraints, and typically treated separately for unconstrained and constrained problems. For an unconstrained problem with objective f ( x ) , an optimizer x must satisfy
f ( x ) = 0
This means that, at an optimal solution, the gradient of the objective function must be zero. A point with zero gradient is a critical point of the objective and may be a local optimum, a saddle point, or an unstable point. To determine whether the point is actually optimal, one typically examines second-order optimality conditions, namely the definiteness of the Hessian matrix: if the Hessian is positive definite, the point is a local minimum, whereas if it is negative definite, the point is a local maximum. Specifically, for a continuously differentiable objective function f ( x ) , if at some point x , the following is satisfied:
f ( x ) = 0 and   H ( x ) 0
Here, H ( x ) denotes the Hessian matrix of the objective f ( x ) at x ; and > 0 indicates that the Hessian is positive definite. Then, x is a local minimizer.
For constrained optimization problems, beyond the objective’s gradient being zero, an optimal solution must also satisfy the constraints and additional, more intricate conditions. The most used theoretical tools are the Lagrange multiplier method and the Karush–Kuhn–Tucker (KKT) conditions. The Lagrange multiplier method reformulates the problem by constructing a Lagrangian. Specifically, for an optimization problem with inequality constraints g i ( x ) 0 and equality constraints h j ( x ) = 0 , one introduces Lagrange multipliers λ i and μ j to incorporate the constraints into the objective, thereby converting it into an unconstrained problem to be solved. The construction of this function is as follows:
L ( x , λ , μ ) = f ( x ) + i = 1 m λ i g i ( x ) + j = 1 p μ j h j ( x )
Its optimal solution x must satisfy the KKT conditions, namely, the stationarity, primal feasibility, dual feasibility, and complementary slackness conditions; the specific forms required are as follows:
x L ( x , λ , μ ) = f ( x ) + i = 1 m λ i g i ( x ) + j = 1 p μ j h j ( x ) = 0
g i ( x ) 0 , h j ( x ) = 0
λ i 0 , μ j R
      λ i g i ( x ) = 0
For constrained optimization problems, if the objective function and the constraint functions are sufficiently smooth, second-order sufficient conditions can help determine the nature of an optimal solution. Building on the KKT conditions, if certain requirements on the objective’s Hessian and the constraint matrices are satisfied, one can further ensure that the solution is a local optimum.

2.3. SQP Algorithm

The SQP algorithm is a powerful iterative optimization method that is widely used to solve optimization problems with nonlinear constraints. By constructing and solving a QP subproblem at each iteration, SQP progressively approaches the optimal solution of the original nonlinear optimization problem.
Specifically, its basic principles are as follows:
Quadratic approximation of the objective: At the current iterate x k , perform a second-order Taylor expansion of the objective function f ( x ) to obtain the quadratic approximation of the objective as follows:
f ( x k + d ) f ( x k ) + f ( x k ) T d + 1 2 d T H k d
Here, d is the search direction, f ( x k ) is the derivative of f ( x k ) , and H k is the Hessian matrix of the objective function; its full Hessian is as follows:
H ( x k ) = 2 f ( x k ) + i = 1 m λ i 2 g i ( x k ) + j = 1 p μ j 2 h j ( x k )
Because in practice, the second-derivative matrix is difficult to obtain or requires substantial computation to construct, the SQP algorithm typically approximates it by a quasi-Newton matrix B ( x k ) as a surrogate for H ( x k ) . The quasi-Newton Hessian B ( x k ) is updated as the iterations proceed; common update strategies include the BFGS (Broyden–Fletcher–Goldfarb–Shanno) update, the DFP (Davidon–Fletcher–Powell) update, and the symmetric rank-one (SR1) correction. Many studies indicate that the BFGS update is the most effective. When the curvature condition for the BFGS update is not satisfied, one may adopt Powell’s damped BFGS update or simply skip the update. The BFGS update is as follows:
Let   y k = x L ( x k + 1 , λ k , μ k ) x L ( x k , λ k , μ k ) , s k = x k + 1 x k
Then   B k + 1 = B k + y k T y k s k T y k B k s k s k T B k s k T B k s k
Linearization of the constraints: For the inequality and equality constraints, perform a first-order Taylor expansion at the current point x k to obtain their linearized forms.
g i ( x k + d ) g i ( x k ) + g i ( x k ) T d 0 , i = 1,2 , , m h j ( x k + d ) h j ( x k ) + h j ( x k ) T d = 0 , j = 1,2 , , p
Construction of the quadratic programming subproblem: Combining the quadratic approximation of the objective and the linearization of the constraints, we formulate the following QP subproblem:
m i n f ( x k ) T d + 1 2 d T B k d s . t . g i ( x k ) + g i ( x k ) T d 0 , i = 1,2 , , m h j ( x k ) + h j ( x k ) T d = 0 , j = 1,2 , , p
Solving the subproblem and updating the iterate: By solving the above quadratic programming subproblem, obtain the search direction d k , and then update the iterate via a line search or another stepsize rule.
x k + 1 = x k + α k d k
Here, α k is the stepsize, which is typically required to satisfy suitable sufficient-decrease or feasibility conditions.
In this manner, SQP uses local quadratic and linear approximations at each iteration to progressively approach the optimum of the original problem; compared with first-order methods, it leverages second-order information from the objective and constraints and is therefore theoretically capable of faster convergence.

3. Proposed Method

3.1. Algorithmic Principles and Workflow

To address large-scale nonlinear optimization problems in process industries, this paper proposes an RSQP algorithm that combines a column-reordering-based space-decomposition strategy with sparse-matrix techniques. The core innovation is that, by structurally optimizing the constraint Jacobian via column reordering and projecting the high-dimensional optimization space onto a low-dimensional subspace through space decomposition, the algorithm needs to handle only a low-dimensional sparse projected Hessian rather than the high-dimensional global Hessian of the original problem. In parallel, it integrates sparse-matrix storage and computational techniques to further reduce matrix operations and memory usage, improving efficiency from both dimensionality reduction and sparsification. Consequently, the method significantly enhances computational stability and iteration speed when solving large-scale problems with high variable dimensionality and low degrees of freedom, and is particularly well suited to process systems modeling and optimization. Detailed RSQP principles and related formulas are provided in Appendix A.
The overall workflow of the RSQP algorithm is shown in Figure 1. First, perform initialization and preprocessing to set the initial point and related parameters. Next, solve a linear system to obtain the range-space search direction and, on this basis, estimate or ignore the quadratic term. The algorithm then solves the reduced QP subproblem to obtain the null-space search direction, from which the final search direction is computed. A line-search strategy is applied to determine the next iterate. Finally, check the convergence criteria: if not satisfied, continue iterating; if satisfied, output the optimization results and terminate. This process illustrates how, for large-scale nonlinear optimization, space decomposition and subproblem solutions effectively reduce computational complexity and improve convergence efficiency.

3.2. Column-Reordering-Based Space Decomposition

Space decomposition partitions variables and applies basis transformations to split the high-dimensional optimization space into lower-dimensional subspaces, thereby greatly shrinking the problem size and effectively reducing computational complexity.
Before decomposition, the RSQP algorithm divides all variables into independent (also called basic or free) and dependent (also called non-basic or non-free) variables; that is, the full variable vector x R n is split into dependent variables y R m and independent variables Z R n m , and the corresponding Jacobian can be written as:
J ( x ) = c x = c y c z = c 1 y 1 c 1 y 2 c 1 y m c 1 z 1 c 1 z 2 c 1 z n m c 2 y 1 c 2 y 2 c 2 y m c 2 z 1 c 2 z 2 c 2 z n m c m y 1 c m y 2 c m y m c m z 1 c m z 2 c m z n m                                             = C N R m × n
Based on this partition, the search space is decomposed via a coordinate-basis factorization; the explicit formulas are given in (17):
Z k = C k 1 N k I n m     Y k = I m 0
At this point, the formula for the range-space stepsize d y is given in (18):
d y = ( J k T Y k ) 1 c k = C k 1 c k
The coordinate-basis decomposition fully exploits the sparsity of the Jacobian J k T . When computing the range-space search direction d y , J k T Y k is simplified to the principal-constraint submatrix C k , greatly reducing the algorithm’s time and memory complexity. However, as indicated by (18), if the Jacobian C k formed by the dependent variables is ill-conditioned or nearly singular, the computation of the range-space step d y may become numerically unstable or difficult to carry out, thereby affecting the accuracy of the range-space search direction. To address this, we adopt a column-reordering strategy: by applying simple column swaps to the original Jacobian—equivalently, reselecting the basic variables—we reconstruct the Jacobian to enhance the robustness of the principal-constraint submatrix.
Executing the column-reordering strategy requires checking whether the smallest singular value of C k is too small, whether its condition number is excessively large, or whether its rank is less than m . The specific steps are as follows:
First, perform a singular value decomposition (SVD) of ck:
C k = U k k V k T
Here, U k is an m × m orthogonal matrix, U k T U k = I m ( I m is the m × m identity matrix). k is an m × n diagonal matrix whose main-diagonal entries σ 1 , σ 1 , , σ p , p = min ( m , n ) are non-negative real numbers and satisfy σ 1 σ 2 σ p 0 ; these entries are the singular values of C k . V k T is an n × n orthogonal matrix, V k T V k = I n .
Take the smallest singular value among them and check whether it is much smaller than 1:
σ m i n ( C k ) = m i n ( σ 1 , σ 2 , , σ m ) < ε 1
Here, ε 1 is typically set to 10−8. If σ m i n ( C k ) is too small, it indicates that the matrix C k may be nearly singular, and a basis change should be considered.
Set a threshold and count the number of nonzero singular values in the diagonal matrix k :
R a n k ( C k ) = i ( σ i > ϵ 2 )
Here, ϵ 2 is typically set to 10−10. If R a n k ( C k ) < m , this indicates that the constraint matrix is degenerate, and some variables need to be reselected as basic variables.
Compute the condition number of matrix C k :
κ ( C k ) = σ k m a x σ k m i n > ϵ 3
Here, ϵ 3 is typically set to 1010. If the condition number is excessively large, the matrix is ill-conditioned and numerical computations may be unstable, so a basis change may be required. In addition, if the stepsize α is too small, a basis transformation may also be necessary to avoid stalling or being trapped in a local optimum.
In addition, since the reduced-space SQP algorithm is essentially an iterative optimization method, even if the Jacobian matrix is nonsingular at the current iteration, there is no guarantee that it will retain good numerical properties in subsequent iterations. Therefore, if the Jacobian becomes ill-conditioned or singular during any iteration, it is still necessary to repartition the basic variables to ensure computational stability. The specific transformation steps are as follows:
Invoke the column approximate minimum degree (COLAMD) sublibrary of the open-source sparse-matrix package SuiteSparse 7.7.0 to perform a column ordering of the Jacobian J ( x ) (i.e., apply column reordering) to make C k more stable; during reordering, record the column swaps in the permutation matrix P .
The COLAMD sublibrary used here for column ordering of the Jacobian matrix is one of the core submodules of the open-source sparse matrix computation library SuiteSparse. SuiteSparse was developed by Professor David Amestoy’s team at the University of Florida and is widely used in scientific computing and engineering optimization. The core function of COLAMD is to perform column approximate minimum-degree ordering of sparse matrices; its basic principle is to analyze the sparsity structure of the matrix and select a column ordering that minimizes the number of new nonzero elements (hereinafter referred to as fill-ins) introduced during matrix factorizations such as LU and QR. The fewer the fill-ins, the more significant the reduction in memory usage—an effect particularly notable for high-dimensional sparse Jacobians; at the same time, it reduces the propagation of rounding errors in numerical computation, thereby improving numerical stability and avoiding factorization failures or biased results caused by ill-conditioning.
In the basis repartitioning procedure of the RSQP algorithm in this paper, invoking the COLAMD sublibrary to reorder the columns of the Jacobian serves two purposes: first, by optimizing the column order, the reordered Jacobian becomes closer to a diagonally dominant structure, reducing the likelihood of numerical singularity when selecting the subsequent basis matrix; second, COLAMD automatically generates the corresponding permutation matrix that records the column exchanges, i.e., the permutation matrix P which can be directly used in the subsequent decomposition of the variable space to ensure that the partition of basic and non-basic variables matches the optimized matrix structure, thereby further ensuring the stability and efficiency of solving the reduced QP subproblems.
Adjustments to the variable partition also affect how the Hessian is computed and updated. For the quadratic-term update, one can derive that, in the new basis, the reduced Hessian takes the following form:
B ¯ = Z ¯ T H ¯ Z ¯ = Z ¯ T P T H P Z ¯ = Z ¯ T P T T T B T P Z ¯
Here, T = [ I   0 ] is the basis-transformation matrix, B = Z T H Z is the original Hessian matrix, and the transformation relations for the other variables are as follows:
λ ¯ = P T λ
x ¯ = P T x
g ¯ = P T g
The workflow of the space-decomposition algorithm based on the column-reordering strategy is illustrated in Figure 2.
First, the algorithm reads the Jacobian and decomposes it by partitioning the variables. It then checks a series of criteria to decide whether a basis transformation is needed: whether the solver is configured to enforce a basis change at every step, whether initialization of basic variables is required on the first call (if so, a flag is modified so that subsequent iterations skip reinitialization), and whether the smallest singular value, rank, and condition number of the matrix meet the required thresholds.
If a basis transformation is necessary, the algorithm executes column reordering, reconstructs the C and N matrices, and recalculates the other variables according to the recorded transformation matrix. If all numerical criteria are satisfied, the algorithm directly completes the basic-variable partition. For the decomposition procedure, the workflow further checks whether to use coordinate-basis decomposition or a custom decomposition method; if neither is selected, the solver defaults to coordinate-basis decomposition to ensure proper iterative solving.
Ultimately, the algorithm outputs the null-space and range-space matrices, completing the decomposition. By examining the numerical properties of the Jacobian at each step, incorporating dynamic column-reordering and basis-transformation mechanisms, and providing flexible choices for decomposition strategies, the workflow ensures numerical stability and adaptability of the decomposition results. This makes it suitable for space decomposition and variable management in large-scale nonlinear optimization problems.

3.3. Sparse-Matrix Processing Techniques

In the practical implementation of the RSQP algorithm, sparse-matrix handling techniques play a crucial role. Large-scale nonlinear optimization solvers must process a wide range of operations involving dense matrices, sparse matrices, vectors, and the management of optimization variables. Choosing appropriate sparse-matrix techniques therefore not only boosts computational efficiency but also reduces memory usage.
To achieve this, the RSQP solver in this work employs a Compressed Sparse Column (CSC) storage format for sparse matrices. This is combined with multiple optimized data structures—including vectors, matrices, hash tables, stacks, and queues—and mainstream numerical libraries to realize efficient storage, computation, and management of matrices and related data in large-scale nonlinear optimization. As a result, both the overall solving efficiency and the data-handling capability of the solver are significantly improved. Further definitions, schematics, and implementation details are provided in Appendix B.

3.4. Solver Algorithm Framework Design

Under the Windows 10 operating system, with VSCode (1.105.1) as the development platform and C++ as the programming language, this paper implements the software development of the RSQP solver algorithm. Before diving into the detailed design of the solver’s core algorithms, it is crucial to construct a sound software framework. The framework is intended to ensure efficient collaboration among modules and good scalability. A carefully designed framework not only enhances the execution efficiency of the algorithm but also provides the flexibility and maintainability required to adapt to evolving application demands.
To achieve these goals, the RSQP solver adopts a modular and top-down design philosophy. Based on the core functional requirements of the solver—such as program invocation, input checking, preprocessing, iterative solving, output control, and flexible invocation—the solver is divided into several independent functional modules. These modules cooperate through well-defined interfaces and efficient data transfer mechanisms.
The final RSQP solver structure is shown in Figure 3. Among them, the program invocation, output control, and flexible invocation modules directly expose interfaces to the user, while the other modules are encapsulated within the solver. This design not only satisfies the fundamental solving requirements but also supports appropriate extension of each module through reserved interfaces, facilitating secondary development.
(1)
Program Invocation Module
This module mainly describes the user-facing interface of the solver. It includes the solver’s invocation function RSQP() and the necessary interface encapsulation files, ensuring that users can seamlessly call the solver to perform optimization tasks.
(2)
Input Validation Module
This module serves as the input component and acts as the front-end processing unit of the optimization solver. It adopts a multi-level validation strategy to achieve standardized data management. Its primary functions include: receiving user-defined mathematical elements such as the objective function, constraints, initial solution, and optimization parameters; performing completeness checks and constructing a three-tier data validation mechanism; establishing an exception grading system in accordance with IEEE standards, classifying the results into fatal errors, recoverable errors, and warnings. Finally, the validated data is encapsulated into a SolverInput object with Jacobian/Hessian matrix attributes, providing the solver with a standardized input interface.
(3)
Preprocessing Module
This module functions as the preprocessing unit and serves as the numerical stabilizer in the optimization computation chain. It is responsible for performing the necessary adjustments to the data filtered and validated by the input module before the iterative solving process begins. Specifically, its tasks include scaling the objective function and constraints to eliminate the impact of differing units or magnitudes on optimization results. In addition, this module configures the variables required by the optimization algorithm—such as maximum iteration count, convergence tolerance, and algorithmic schemes—based on user-specified options combined with the solver’s default parameters. The preprocessing module is also responsible for initializing the data structures required by the algorithm, including setting variable initial values and decomposing or transforming constraint conditions. These preprocessing steps improve the stability and convergence of the subsequent optimization process.
(4)
Iterative Solving Module
This module is primarily responsible for the iterative solution of the optimization problem and serves as the solver’s core processing unit. It consists of four key components: space decomposition, search direction computation, line search, and convergence testing. Specifically, the space decomposition module partitions variables and performs basis transformations, decomposing the high-dimensional optimization space into lower-dimensional subspaces. This decomposition greatly reduces the problem scale to be solved and effectively lowers the computational complexity of the optimization process. Building upon this decomposition, the search direction computation module calculates the optimization direction at each step by solving a reduced-dimensional QP subproblem with high precision. The line search module, guided by evaluation functions and descent criteria, determines a suitable step length in each iteration. It ensures that the objective function decreases sufficiently and monotonically, while also preventing divergence caused by overly large step sizes. Finally, the convergence testing module monitors the algorithm’s convergence, determining whether the solution meets the stopping criteria based on the current error or residual.
(5)
Output Module
This module serves as the output component, responsible for printing error messages, intermediate results during the iterative process, final solutions, and statistical information. In traditional solvers, this module typically acts as the primary interface for user interaction. It outputs exception information received from the preceding modules and monitors the current iteration state, providing detailed feedback based on the convergence status. If the solver has not converged, it reports comprehensive data on the optimization iterations, including the computational results of each iteration, changes in the objective function, and the satisfaction of the constraints. If convergence has been achieved, the module outputs the optimal solution, the optimal objective value, memory consumption, and time statistics, while also supporting multiple export formats such as plain text and CSV files to facilitate further analysis and processing by the user. If no feasible solution is found, the module outputs a notification indicating solver failure.
(6)
Flexible Invocation Module
To address the interaction limitations of traditional solvers, the flexible invocation module provides an extensible design interface that significantly enhances solver adaptability by allowing users to directly intervene in the iterative solving process.
Specifically, this module introduces a five-dimensional layered callback mechanism to restructure the user interface, establishing programmable access points along five critical dimensions of the algorithm execution pipeline: preprocessing, algorithm selection, iteration stepping, convergence verification, and output control. The essence of this mechanism lies in defining standardized function interfaces through function pointers, thereby decoupling the algorithmic kernel from user-defined logic.
At the implementation level, the solver’s core program encapsulates key parameters generated during the iterative process into context objects, which are then exposed to users via a predefined CallbackProtocol interface. This protocol defines four standard callback hooks: PreIteration() (before iteration), InIteration() (during iteration), PostIteration() (after iteration), and ConvergenceCheck() (for convergence testing). In addition, callback points such as SpaceDecom() and MeritFunction() are incorporated into the algorithm selection module, allowing users to inject custom logic or algorithms by implementing their own callback functions. Through this design, users can flexibly extend and tailor the solver to meet specific problem requirements or research needs.
Taking the space decomposition algorithm in the algorithm selection dimension as an example, its interface reconstruction is illustrated in Figure 4.
The solver’s space decomposition module returns the partitioned matrix [ C   N ] to the user, and after the user applies their own space decomposition method for iterative computation, a null-space matrix is returned to the solver. The solver itself does not concern itself with the specific logic of the user’s decomposition method.
From the above process, it can be seen that this design elevates the interface extension dimension from fixed parameters of order O ( 1 ) to functional spaces of order O ( n ) . While maintaining the spatiotemporal complexity of the core algorithm, it enables users to inject domain knowledge according to problem-specific characteristics. For optimization problems that require customized algorithmic strategies, this approach can significantly improve development efficiency without introducing any additional computational overhead.
This architecture design, which separates control flow from functional business logic, enables the iterative sequence of the algorithm kernel to support a wider range of extension scenarios without modifying the core code: (1) Preprocessing enhancement: inserting data standardization steps before iterations begin, such as applying condition number correction to ill-conditioned Hessian matrices. (2) Process monitoring: recording additional information on the iterative trajectory through callbacks during iterations, for example, updating memory matrices in the construction of L-BFGS algorithms. (3) Convergence strategy extension: overloading the convergence check function to implement hybrid termination criteria, such as dual or multiple combinations of gradient norm thresholds, KKT violation levels, and relative improvement criteria. (4) Flexible algorithm selection: adapting the implementation of specific algorithms based on user application scenarios.
Through the above modular partitioning, combined with layered computation strategies, the global optimization problem is decoupled into independently manageable subtasks, greatly reducing the complexity of solver implementation. This design not only improves code maintainability and extensibility but also provides a flexible framework for performance optimization and functional expansion of the solver.
The relationships among solver modules and the program control flow are shown in Figure 5.

4. Experimental Analysis and Validation

This chapter consists of three groups of experiments. Experiment I selects small-scale test cases with typical nonlinear characteristics to provide a preliminary verification of the feasibility of the solver algorithm. Experiment II considers variable-dimensional test cases, in which the problem size is gradually increased to further verify the effectiveness of the solver in handling high-dimensional problems. Experiment III builds a first-stage three-pass RO process model based on practical process industry applications, and conducts optimization under the criterion of minimizing operating costs, thereby validating the solver’s performance in a real industrial scenario.
To accurately evaluate the solver’s performance while avoiding discrepancies caused by different hardware configurations, and to more directly reflect the impact of dimensionality on computational performance, all experiments are conducted in the VSCode software platform (version 1.102.1) with a C++ compilation environment, running under the Windows 10 operating system. Prior to solving, the solver is allocated a 2.8 GHz single-core CPU and 1 GB of memory. Consequently, this work primarily evaluates the solver’s effectiveness through solution time, while memory usage is roughly estimated using the computer’s task manager.

4.1. Small-Scale Case Studies: Computation and Analysis

To verify the solver’s performance in basic scenarios, this section selects six benchmark test cases featuring typical nonlinear characteristics such as non-convexity and exponential-type behavior. Through convergence tests conducted within low-dimensional variable spaces, the robustness of the algorithm is systematically evaluated under complex function landscapes. The mathematical descriptions of each case study, along with the RSQP iteration trajectories, are provided in Case 1 through Case 6.
Case 1 is a high-dimensional exponential-type objective function coupled with a spherical constraint and a nonlinear equality constraint. This test is designed to examine stability in scenarios prone to exponential explosion. Its specific formulation is given as follows:
Objective Function and Constraints:
min e x 1 x 2 x 3 x 4 x 5 s . t . x 1 2 + x 2 2 + x 3 2 + x 4 2 + x 5 2 = 10 x 2 x 3 5 x 4 x 5 = 0 x 1 3 + x 2 3 = 1
Variable Bounds:
l b = 2.3 , 2.3 , 3.2 , 3.2 , 3.2 T u b = 2.3 , 2.3 , 3.2 , 3.2 , 3.2 T
Initial Point:
x 0 = 2 , 2 , 2 , 1 , 1 T
Minimum Objective Function Value:
f ( x ) = 0.1239
The iteration procedure is presented in Table A1.
Case 2 features a negative product objective function with mixed cubic/square constraints, aiming to evaluate the solver’s capability of escaping from local optima in non-convex problems. The specific formulation is as follows:
Objective Function and Constraints:
min x 1 x 2 x 3 x 4 s . t .     x 1 3 + x 2 2 = 1 x 1 2 x 4 x 3 = 0     x 4 2 x 2 = 0
Initial Point:
x 0 = 0.8 , 0.8 , 0.8 , 0.8 T
Minimum Objective Function Value:
f ( x ) = 0.25
The iteration procedure is presented in Table A2
Case 3 is a chained polynomial objective with a set of linear equality constraints, aimed at examining the convergence accuracy of piecewise linear structures. Its specific form is described as follows:
Objective Function and Constraints:
min x 1 x 2 2 + x 2 x 3 2 + x 3 x 4 4 + x 4 x 5 2 s . t . x 1 + 2 x 2 + 3 x 3 = 6 x 2 + 2 x 3 + 3 x 4 = 6 x 3 + 2 x 4 + 3 x 5 = 6
Initial Point:
x 0 = 35 , 31 , 11 , 5 , 5 T
Optimal Value of Variables:
x = 1 , 1 , 1 , 1 , 1 T
Minimum Objective Function Value:
f ( x ) = 0
The iteration procedure is presented in Table A3:
Case 4 features a quadratic non-convex objective function with ellipsoidal inequality constraints, designed to test the efficiency of boundary search under constraints. The specific description is as follows:
Objective Function and Constraints:
min x 1 2 2 + x 2 2 x 1 x 2 7 x 1 7 x 2 s . t .   4 x 1 2 + x 2 2 25
Initial Point:
x 0 = 1 , 1 T
Optimal Value of Variables:
x = 2 , 3 T
Minimum Objective Function Value:
f ( x ) = 30
The iteration procedure is presented in Table A4:
Case 5 involves a mixed exponential–polynomial objective function coupled with a spherical constraint and a cubic equality, designed to evaluate the robustness of the solver in handling highly nonlinear coupled systems. Its specific formulation is as follows:
Objective Function and Constraints:
min e x 1 x 2 x 3 x 4 x 5 1 2 x 1 3 + x 2 3 + 1 2 s . t . x 1 2 + x 2 2 + x 3 2 + x 4 2 + x 5 2 = 10 x 2 x 3 5 x 4 x 5 = 0 x 1 3 + x 2 3 = 1
Variable bounds:
l b = 2.3 , 2.3 , 3.2 , 3.2 , 3.2 T u b = 2.3 2.3 3.2 3.2 3.2 T
Initial Point:
x 0 = 2 , 2 , 2 , 1 , 1 T
Minimum Objective Function Value:
f ( x ) = 0.0539498478
The iteration procedure is presented in Table A5:
Case 6 is a variant of the classical Rosenbrock problem (with a parabolic equality constraint), designed to verify the iteration stability on ill-conditioned surfaces. Its specific description is as follows:
Objective Function and Constraints:
min     1 x 1 2 s . t .       10 x 2 x 1 2 = 0
Initial Point:
x 0 = 1.2 , 1 T
Minimum Objective Function Value:
f ( x ) = 0
The iteration procedure is presented in Table A6:
The iteration trajectories of small-scale Cases 1 through 6 are shown more intuitively in Figure 6, Figure 7, Figure 8, Figure 9, Figure 10 and Figure 11.
In the benchmark tests, a comparison with the full-space standard SQP algorithm implemented in Fmincon (MATLAB 2022b) shows that the RSQP solver exhibits a very similar convergence trend. The objective function descent curves of the two methods almost overlap, and the final convergence accuracy remains at the same order of magnitude. This indicates that the RSQP solver possesses numerical stability comparable to that of well-established solvers.
It is worth noting that in cases involving non-convex constraints, the RSQP solver requires slightly more iterations than Fmincon. This is because the space decomposition strategy introduces additional basis transformation calibrations to ensure the stability of the reduced-degree-of-freedom subspace. Although the iteration steps increase, the convergence process remains stable without oscillations or divergence.
A deeper comparison further reveals that RSQP has potential advantages in memory management and architectural scalability. Its modular design reserves interfaces for large-scale problem solving, whereas Fmincon’s full-space strategy already shows limitations when extending to higher dimensions. This design trade-off allows RSQP to acceptably increase the number of iterations in small-scale problems in exchange for improved generalization capabilities in industrial-scale applications.
Additionally, regarding memory usage, since the test problems are of small scale, the difference in memory consumption between the two algorithms for storing dense matrices is minor. In fact, for matrices with high density, the improved reduced-space SQP algorithm may even use slightly more memory than traditional SQP. However, in small-scale cases, this overhead is within an acceptable range.

4.2. Variable-Dimension Case Studies and Analysis

To fully highlight the unique advantages of the RSQP algorithm in high-dimensional, low-degree-of-freedom scenarios typical of process simulation, this section presents three sets of scalable-dimension test problems. By dynamically adjusting the size of the decision variables, the study systematically compares the computational efficiency of the RSQP solver with MATLAB’s Fmincon under both global and decomposition strategies, thereby providing a comprehensive quantitative evaluation of the algorithm’s engineering practicality.
Case Study 1: Degree of Freedom = 1
Objective Function and Constraints:
m i n 1 2 i = 1 n x i 2 s . t . x 1 ( x i + 1 1 ) 10 x i + 1 = 0 ,   i = 1 , , n 1
Initial Point:
x 0 = x 1 , x 2 , . . . x i T ,   x i = 0.1
Case Study 2: Degree of Freedom = 1/2n
Objective Function and Constraints:
m i n 1 2 i = 1 n ( x i ) 2 s . t . x i ( x i + n 2 1 ) 10 x i + n 2 = 0 ,   i = 1 , , n 2
Initial Point:
x 0 = x 1 , x 2 , . . . x i T ,   x i = 0.1
Case Study 3: Degree of Freedom = 2
Objective Function and Constraints:
m i n 1 2 i = 1 n ( x i + x i + 1 ) 2 s . t . x i + 2 x i + 1 + 3 x i + 2 1 = 0 ,   i = 1 , , n 2
Initial Point:
x 0 = 4 , x 2 , x 3 , . . . x i ,   x i = 1
The results of the variable-dimension cases are shown in Table 1.
In Case 1, namely the large-scale low-degree-of-freedom test, the variable dimension reaches up to 128,000 with the degrees of freedom fixed at 1, and the RSQP solver demonstrates significant advantages. When the dimension reaches 32,000, RSQP completes the solution in only 26.191 s, whereas Fmincon already takes 178.334 s at 2000 dimensions, a performance gap of approximately 6.809 times. More notably, as the dimension increases from 64,000 to 128,000, the runtime of RSQP grows by about 4.128 times, far below the theoretical complexity expectation. In contrast, the full-space SQP algorithm encounters memory overflow at 4000 dimensions due to matrix decomposition, showing that the space decomposition strategy reduces memory consumption by at least 65%. The number of iterations remains stable, with the basis transformation consistently maintained at 1, verifying the robustness of the quadratic correction strategy.
In Case 2, namely the medium-to-high dimensional dynamic degree-of-freedom scenario, the dimension is adjusted up to 6000, with the degree-of-freedom ratio reaching 50%. RSQP achieves a performance boost through basis transformations. When the degrees of freedom increase from 1000 to 2000, the number of iterations decreases by about 62%, and computation time drops by approximately 42.165%. Particularly, at 6000 dimensions, RSQP successfully converges in 41.749 s, while the full-space SQP algorithm already suffers memory overflow at 3000 dimensions, highlighting the adaptability of the decomposition strategy to degree-of-freedom-sensitive problems. The turning point where the number of basis transformations increases from 0 to 1 reveals the algorithm’s self-adjustment mechanism in response to sudden changes in degrees of freedom.
In Case 3, namely the relatively extreme industrial-scale dimension test, the dimension is adjusted up to 50,000 with the degrees of freedom fixed at 2, and RSQP exhibits superlinear computational characteristics. When the dimension increases from 4000 to 50,000—a 12.5-fold increase—the runtime grows by about 39.364 times, which is significantly better than the cubic-level complexity of traditional algorithms. It is noteworthy that in this test, the RSQP iteration count remains stable at 6, and the number of basis transformations remains at 1, demonstrating that the algorithm’s stability under high-dimensional stress is unaffected by problem scale.

4.3. Single-Stage Three-Pass Reverse Osmosis Process Model

To evaluate the effectiveness of the RSQP solver on real industrial problems, we apply it to the high-salinity wastewater treatment process of a coal-fired power plant in Inner Mongolia. The process employs a single-stage, three-pass high-pressure RO system; its technical principle is shown in Figure 12, and the plant setup is shown in Figure 13. The RO process involves complex mass-transfer and fluid-mechanics phenomena, and its mathematical model is high-dimensional and strongly nonlinear, placing stringent demands on the efficiency and stability of the optimization algorithm.
Based on a rigorous mechanistic model and an economic model of the RO unit, we formulate a large-scale NLP using a finite-difference simultaneous-equations approach [25,26,27,28]. The optimization objective is to minimize the system’s daily operating cost of water production; the decision variables include the operating pressures of each pass and the allocation of flow rates, subject to strict product-water quality requirements and equipment constraints. The complete mathematical model—covering mass conservation, membrane transport equations (solution–diffusion model), concentration–polarization effects, and economic metrics—is provided in Appendix D.
This case study is intended to assess, through a complex optimization problem with a clear engineering background, the computational performance and practical applicability of the RSQP solver under conditions that closely approximate real industrial scenarios.

4.4. Operation Optimization Based on Minimizing Daily Operating Costs

According to the actual operating conditions of the coal-fired power plant’s high-salinity wastewater RO system, Table 2 presents data for two typical operating scenarios.
For Case 1 and Case 2, a target function φ is defined and set to zero, with the objective of minimizing φ. The RO model involved contains nonlinear equality constraints, making this an NLP problem. The number of finite difference nodes is set to 56, with a total of 12,185 variables and 12,173 constraint equations, resulting in 12 degrees of freedom. The feedwater flow rate, operating pressure, and booster pump pressure of the RO process are kept constant. The RSQP solver is used to solve the problem, and its iteration curves are shown in Figure 14 and Figure 15.
Before optimization, the optimized economic cost was 2264.5585 CNY for Case 1 and 2088.4695 CNY for Case 2. The detailed breakdown of cost components is shown in Table 2.
An optimization problem is formulated based on minimizing the daily operating cost, described as follows [29]:
Objective Function:
m i n x O C ,   x = P f , Q f , P b p , T T
Equality Constraints:
RO process mechanism model: Equations (A10)–(A40)
RO economic evaluation model: Equations (A41)–(A46)
Inequality Constraints:
P f L P f P f U
P b p L P b p P b p U
C p , o u t C l i m i t
V f L V f V f U
ϕ L ϕ ϕ U
T f L T f T f U
Initial and Termination Conditions:
P b = P f , z = 0 P r , z = L
C b = C f , z = 0 C r , z = L
V = V f = Q f n e W h s p , z = 0 V f = Q r n e W h s p , z = L
During the optimization process, to ensure the safety of the RO process and meet practical operating conditions, upper- and lower-bound constraints are imposed on the feedwater flow rate, operating pressure, and booster pump pressure. The specific data are shown in Table 3.
The product water concentration of the RO system is set to 800 mg/L, and the minimum permeate flow rate is set to 21 m3/h. The data obtained from the simulation calculations are used as the initial values for optimization. The RSQP solver is then applied to optimize both Case 1 and Case 2.
The iteration trajectories for Case 1 and Case 2 are shown in Figure 16 and Figure 17, respectively.
Additional optimization results across more dimensions are presented in Table 4.
After optimization, data results before and after process optimization for the two typical RO operating scenarios were obtained. The detailed data are presented in Table 5.
From an engineering perspective, the optimization strategy of the RSQP algorithm achieves an effective balance between energy consumption and water quality. In the optimization of Case 1, the system significantly improved product water quality and reduced operating costs by adjusting the feed pressure and booster pump pressure. Before optimization, the permeate concentration was 594.32 mg/L, which was below the target value of 800 mg/L, while the permeate flow rate was 22.16 m3/h, exceeding the minimum requirement of 21 m3/h. After optimization using the RSQP solver, the feed pressure increased from 36.87 bar to 40.31 bar, whereas the booster pump pressure was dramatically reduced from 35 bar to 15.18 bar. This redistribution of pressures optimized energy utilization efficiency. While the permeate flow rate was reduced to the critical value of 21 m3/h, the permeate concentration increased to 800 mg/L, still meeting the constraint requirements. Meanwhile, the water recovery rate decreased from 76.95% to 72.92%, indicating that the system sacrificed some recovery efficiency to satisfy the product water concentration target.
In Case 2, the optimization goal was more complex, requiring the permeate concentration to be reduced from 901.42 mg/L to below 800 mg/L, while increasing the permeate flow rate from 20 m3/h to 21 m3/h. After optimization, the system not only reduced the concentration to 700.39 mg/L, significantly outperforming the target limit, but also increased the flow rate to 21 m3/h, achieving both objectives. This improvement was achieved through a fine-tuning of the feed pressure, which decreased from 36.87 bar to 35.78 bar, and a significant reduction in booster pump pressure, from 36 bar to 15.38 bar. Combined with an adjustment in feedwater flow rate from 25 m3/h to 32.43 m3/h, system efficiency was markedly improved. The water recovery rate increased from 80% to 84%, and the salt rejection rate rose from 95.87% to 96.79%, demonstrating that the optimization strategy effectively enhanced resource utilization.
The comparative information of each cost item before and after optimization is shown in Table 6.
The comparison of each cost item before and after optimization is shown in Figure 18 and Figure 19.
From an economic perspective, the total operating cost of Case 1 decreased from CNY 2264.56 to CNY 2151.83, a reduction of CNY 112.73, or approximately 4.98%. This reduction was primarily due to a significant drop in the RO energy consumption cost O C E N , which fell from CNY 972.69 to CNY 854.56, saving CNY 118.12. The main factor behind the energy savings was the reduction in booster pump pressure from 35 bar to 15.18 bar, greatly reducing the electricity consumption of the high-pressure pump. However, the chemical cost O C C H and intake energy cost O C I P increased by CNY 4.35 and CNY 2.89, respectively.
The chemical cost rose because the permeate concentration increased from 594 mg/L to 800 mg/L, requiring more chemicals to maintain water quality. The optimization also reduced equipment wear, slightly lowering maintenance costs O C M N by CNY 1.84. Other costs, such as membrane replacement and labor, remained stable, indicating that optimization did not affect long-term equipment investment or staffing needs.
In Case 2, the total operating cost decreased from CNY 2088.47 to CNY 2058.03, a reduction of CNY 30.44 or approximately 1.46%. The primary optimization again lies in reducing the RO energy consumption cost O C E N , which dropped from CNY 822.54 to CNY 763.67, saving CNY 58.88. This was mainly achieved by lowering the booster pump pressure from 36 bar to 15.38 bar, combined with a slight adjustment of feed pressure from 36.87 bar to 35.78 bar, optimizing the energy distribution. However, the chemical cost O C C H increased significantly by CNY 16.14, due to the need to reduce permeate concentration from 901 mg/L to 700 mg/L, which required additional chemicals to enhance desalination.
The intake energy cost O C I P also rose by CNY 10.71, directly related to the increase in feed flow rate from 25 m3/h to 32.43 m3/h, leading to higher intake energy consumption. Maintenance costs O C M N increased slightly by CNY 1.58 because of the higher demand for equipment maintenance caused by increased flow rates. Membrane replacement and labor costs remained unchanged, indicating that the optimization strategy did not affect equipment lifespan or staffing structure.
Through comparison and analysis, the optimization strategy of the RSQP solver provides effective guidance for improving this RO system. The optimization results achieve a practical balance between energy consumption and water quality. In both cases, the optimization primarily focused on reducing RO energy consumption, achieving significant savings by adjusting booster pump pressure—approximately CNY 112 for Case 1 and CNY 30 for Case 2. However, meeting water quality requirements led to an increase in chemical costs, rising by about CNY 4 in Case 1 and CNY 16 in Case 2, becoming the main offsetting factor.
These results indicate that future efforts should focus on: 1. Improving chemical efficiency: Explore desalination technologies with lower chemical dependency or optimize chemical dosing strategies to control increases in O C C H . 2. Balancing intake energy consumption: Coordinate flow and pressure optimization to minimize rises in O C I P , for example, by using variable-frequency pumps to adjust intake flow rates. 3. Long-term equipment monitoring: Ensure that low-pressure operation modes do not negatively impact membrane lifespan, preventing hidden increases in O C M E .
In summary, while ensuring permeate water quality, the RSQP solver’s operational optimization strategy improved the system’s economic efficiency, demonstrating its feasibility in this RO system.

5. Summary

This work targets large-scale nonlinear optimization and builds an efficient, stable solution framework centered on RSQP, validated end-to-end through theory, solver engineering, numerical tests, and an industrial application. The main contributions are:
(1)
Theory. We review NLP fundamentals and optimality conditions; present the core mechanics of SQP (quadratic approximation, constraint linearization, and QP subproblem formulation/solution); and introduce RSQP, which employs a column-reordering-based space decomposition to project the high-dimensional problem into a low-dimensional subspace, solving a reduced QP and markedly lowering computational cost.
(2)
Solver development. For high-dimensional/low-degrees-of-freedom problems in process industries, we integrate sparse-matrix storage/computation. A top-down modular architecture implements the column-reordering space-decomposition module. The numeric core is built in C++ with STL, Armadillo, and SuiteSparse, and exposes extensible interfaces for user-defined functions, improving usability and maintainability.
(3)
Numerical tests. On small-scale benchmarks (including non-convex/exponential cases) and variable-dimension tests, RSQP attains accuracy/stability comparable to commercial software; objective trajectories align closely. In variable-size tests, RSQP breaks dimensional limits, achieving notable speedups and ~65% memory reduction versus Fmincon; when variables increase from 64 k to 128 k, runtime rises by ~4.128× with iteration counts essentially stable. Under dynamic degrees of freedom, autonomous basis transformation cuts iterations by >50% and solves stably up to 6 k dimensions. Near-industrial tests show runtime growth at only ~⅓ of the theoretical rate, supporting applicability to 10 k-scale optimization.
(4)
Engineering application. For a high-salinity wastewater RO unit (single-stage, three-pass), we construct a rigorous mechanistic/economic model and formulate a large-scale NLP via a finite-difference simultaneous-equations approach, then optimize daily operating cost with RSQP. Two typical scenarios reduce product-water cost by 4.98% and 1.46% while satisfying all quality and equipment constraints, confirming feasibility and effectiveness in process-simulation settings.
Algorithmic characteristics. RSQP’s strengths lie in efficient basis transformation and reliable convergence: by reducing redundant searches, residuals remain below 1 × 10−8 under complex constraints, meeting engineering accuracy. Nonetheless, runtime still trails mainstream solvers, due to: (i) the high space–time complexity of SVD inflating basis-decision cost; (ii) repeated Armijo–Wolfe checks in line search increasing the burden of the L1 merit; and (iii) under-exploitation of Jacobian sparsity constraining linear-algebra efficiency. Hence, there is ample room for improvement: introduce fast SVD approximations or iteration-aware preconditioning to cut basis-decision cost; refine line-search strategy and merit evaluation to reduce condition checks; and strengthen sparse-matrix handling to streamline linear algebra. These upgrades are especially critical for time-sensitive engineering scenarios.
Future work. We will advance this line of research along three directions:
(1)
Broader comparisons. Conduct systematic evaluations against advanced SQP variants (e.g., interior-point SQP, filter SQP, stochastic SQP) on a unified platform, quantifying accuracy, efficiency, and robustness to ill-conditioning to delineate strengths and scope.
(2)
Performance and robustness. For million-variable problems, integrate GPU parallelism and distributed memory; embed trust-region and interior-point strategies; and develop adaptive regularization for stable Hessian updates on non-smooth/ill-conditioned models.
(3)
Cross-domain validation. Extend beyond high-salinity wastewater to petrochemical processes (e.g., FCC and ethylene pyrolysis) to validate generality on ultra-large-scale, strongly nonlinear problems and enhance engineering impact.
In summary, spanning theory, implementation, and application, this work provides an integrated solution for large-scale nonlinear optimization in process industries, with interim validation on a real project and a general simulation platform, offering a viable path toward efficient and stable solutions at extreme scales.

Author Contributions

Conceptualization, C.Z. and R.Z.; methodology, C.Z. and R.Z.; software, H.W.; validation, C.Z., R.Z. and X.Z.; formal analysis, C.Z.; investigation, C.Z. and R.Z.; resources, A.J.; data curation, X.Z.; writing—original draft preparation, C.Z.; writing—review and editing, R.Z., A.L. and H.W.; visualization, C.Z.; supervision, A.J. and H.W.; project administration, A.J. and H.W.; funding acquisition, A.J. and H.W. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported in part by the “Pioneer” and “Leading Goose” R&D Program of Zhejiang Province of China under grant number 2023C01024.

Data Availability Statement

Data sharing is not applicable.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A. Basic Principles of RSQP

For optimization problems in process systems, the objective function is typically an economic or performance index, the constraint equations are the process model equations, and most variable constraints correspond to equipment upper and lower bounds. A small number of inequality constraints can be converted into equality constraints by introducing slack variables; the resulting optimization model can be formulated as the following NLP problem:
min f ( x ) s . t .     c ( x ) = 0 x L x x U
The reduced-space SQP algorithm is developed as an improvement over SQP; its basic principles are described as follows [30,31]. For SQP, the QP subproblem at x k can be written as:
min f ( x k ) d k + 1 2 d k T H ( x k ) d k s . t . c ( x k ) + J ( x k ) T d k = 0   x L x k + d k x U
where d k denotes the search-direction vector; assuming the stepsize α takes its maximum ( α = 1 ), f ( x k ) denotes the derivative of the objective f at x k , abbreviated as g k ; J ( x k ) T denotes the Jacobian matrix of the constraints, abbreviated as J k T ; x L and x U are the lower and upper bounds of the variables; H is the Hessian of the true Lagrangian. The Lagrangian is given by:
L ( x , λ , v , ξ ) = f ( x ) + λ T h ( x ) + v T ( x x U ) ξ T ( x x L )
Here, x denotes the vector of decision variables, f ( x ) is the objective function, h ( x ) represents the equality constraints with multipliers λ, while x U and x L are the upper and lower bounds of x , associated with multipliers v and ξ, respectively. Thus, L(x,λ,v,ξ) is the Lagrangian function incorporating both equality and bound constraints.
The reduced-space SQP algorithm decomposes the optimal KKT conditions of the above problem using an appropriate splitting strategy. After decomposition, the resulting Hessian is the projected Hessian in a low-dimensional space, which greatly reduces memory usage. Specifically, during the iterations, the search space is split into two subspaces, Y and Z , where Z R n × ( n m ) is formed by the null-space vectors of the Jacobian and Y R n × m by the range-space vectors of the Jacobian. The vector Z satisfies the stated condition.
J k T Z k = 0
The search direction d k can be written as a displacement along the null-space direction:
d k = Y k d y + Z k d z
Here, d y and d z denote the vectors of motion in the null space and the range space, d y R m , d z R n m respectively.
Substituting (A4) and (A5) into the equality constraints of the QP subproblem (A2) yields:
c k + J k T Y k d y = 0
If the Jacobian of the constraints is row-wise linearly independent, then the matrix J k T Y k is nonsingular, and hence, by (A6), d y is uniquely determined:
d y = ( J k T Y k ) 1 c k
Consequently, the search direction can be written as:
d k = Y k ( J k T Y k ) 1 c k + Z k d z
Substituting the search direction d k from (A8) into the above QP subproblem and discarding constant terms independent of d z , the QP subproblem (A2) can be rewritten as the following QP in the variable d z R n m :
m i n ( Z k T g k + Z k T H k Y k d y ) T d z + 1 2 d z T ( Z k T H k Z k ) d z x L x k Y k d y Z k d z x U x k Y k d y
Here, the ( n m ) × 1 matrix is the quadratic term Z k T H k Y k d y , the ( n m ) × ( n m ) matrix H k is the Hessian, and d z is an ( n m ) dimensional vector. For optimization problems with relatively few degrees of freedom, n ( n m ) , the storage required for the Hessian in (A9) and the computational effort for its updates are greatly reduced; at each iteration, this QP subproblem need only be solved for d z in the reduced (low-dimensional) space, thereby substantially improving the efficiency of the algorithm.
For the QP subproblem in (A9), the quadratic term is not directly available and is relatively costly to compute; it can typically be estimated via a Broyden correction scheme or simply omitted. Under certain circumstances, for example, when the null space is constructed using a standard orthonormal basis, the reduced-space SQP algorithm admits two-step superlinear convergence even when the quadratic term is neglected.

Appendix B. Sparse Storage Formats and Implementation Details

The following introduces the data structures involved in the development of the RSQP solver, together with their specific features and processing methods.
(1)
Data Structure for Dense Matrices
When most elements in a matrix are nonzero, it is typically stored and processed as a dense matrix. Dense matrix structures are simple and intuitive to operate, and are usually implemented with two-dimensional arrays (e.g., std::vector<std::vector<double>>) or specialized linear algebra libraries (e.g., arma::mat in Armadillo 14.0.1). This storage format allows efficient matrix computations, particularly in computation-intensive tasks, and generally provides good performance.
However, for large-scale problems—especially in high-dimensional optimization where the proportion of nonzero elements is very small—dense matrix storage can result in excessive memory consumption and limit computational efficiency.
The storage structure of a dense matrix is illustrated in Figure A1.
Figure A1. Schematic diagram of a dense matrix structure.
Figure A1. Schematic diagram of a dense matrix structure.
Algorithms 18 00699 g0a1
On the left side of Figure A1 is the actual matrix. For consistency with the program implementation, the row and column indices start from zero (as will be the case in later matrix illustrations). Elements with a value of zero are not shown. On the right side is the schematic representation of how the matrix is stored in the program: it is evident that, regardless of whether a matrix element is zero or nonzero, the two-dimensional array records all entries in memory in full.
(2)
Sparse Matrix Data Structure
When most elements in a matrix are zero, sparse matrix techniques can be used to store only the nonzero elements. This approach significantly reduces memory usage and improves storage efficiency. Moreover, during matrix computations, sparse matrices can skip zero elements and perform operations only on nonzero elements, which greatly reduces computational load and time cost, thereby improving efficiency.
Common sparse matrix storage formats include the Coordinate List (COO) format, the Compressed Sparse Row (CSR) format, and the CSC format.
The COO format represents each nonzero element in a sparse matrix as a triplet consisting of the value, row index, and column index. Its storage structure is illustrated in Figure A2.
Figure A2. Schematic Diagram of the COO Storage Structure.
Figure A2. Schematic Diagram of the COO Storage Structure.
Algorithms 18 00699 g0a2
For example, as shown on the left side of the figure, the element 5 located at the first row and second column is represented in the program on the right side by storing its row index, column index, and value in three one-dimensional arrays: row_indices, column_indices, and values.
For highly sparse and high-dimensional matrices, storing only the nonzero elements greatly reduces memory consumption. Moreover, the COO storage format supports fast access to any element through its indices. Although this format provides flexibility, its efficiency in handling computation-intensive operations is relatively low, making it generally unsuitable for large-scale matrix computations.
In the COO format, elements in the same row are stored repeatedly with their row indices. The CSR format, on the other hand, eliminates this redundancy by using a row pointer array to specify the range of nonzero elements belonging to each row in the value array, thereby compressing the storage of row indices.
Specifically, the CSR format stores the starting position of each row (i.e., the row pointer in the program), the column indices, and the values of the nonzero elements. Its storage structure is illustrated in Figure A3.
Figure A3. Schematic Diagram of the CSR Storage Structure.
Figure A3. Schematic Diagram of the CSR Storage Structure.
Algorithms 18 00699 g0a3
For example, consider the elements in the 3rd row of the matrix on the left side of the figure: the 3rd row contains a total of row_pointer[4]—row_pointer[3] nonzero elements. The column indices and values of these elements are stored in the column_indices and value arrays, from the row_pointer[3]th element to the row_pointer[4]—1st element.
This format is highly efficient for operations such as sparse matrix-vector multiplication, making it particularly advantageous for solving large-scale sparse optimization problems.
The CSC format is similar to the CSR format, except that the storage method changes from row compression in CSR to column compression. Its storage structure diagram is shown in Figure A4.
Figure A4. CSC Storage Structure Diagram.
Figure A4. CSC Storage Structure Diagram.
Algorithms 18 00699 g0a4
Its storage structure diagram is shown in Figure A4, where three one-dimensional arrays, respectively, store the starting position of each column, the row indices, and the nonzero element values. The access process will not be repeated here. When algorithms based on column operations are called, CSC can fully leverage its advantages and significantly improve computational efficiency.
(3)
Vector Data Structures
Vectors in the optimization solver are used to represent optimization variables, the gradient of the objective function, and constraints. Common vector data structures include one-dimensional arrays, dynamic arrays, and specialized mathematical library objects.
Considering that the database selection has already been made earlier, we can directly use them here: including the contiguous storage vector std::vector in C++, the column-major dense vector arma::vec in Armadillo, the delayed evaluation sparse vector arma::sp_vec based on the COO format, the column-major compatible dense data cholmod_dense from SuiteSparse, and the CSC-format implicitly represented sparse vector cholmod_sparse. It should be noted that conversions between different mathematical library data formats are required.
(4)
Stack and Queue
Stacks and queues are commonly used to manage temporary data during the solving process.
Stack is a last-in-first-out (LIFO) data structure, suitable for storing and restoring states in the solving process. Stacks are often used for handling backtracking operations, such as saving intermediate values during iterative solving so that subsequent iterations can quickly restore to the previous result when needed.
Queue is a first-in-first-out (FIFO) data structure, suitable for task scheduling or sequential data processing. In the solving process, when a set of tasks or data needs to be processed in order, queues are very effective.
In the solver designed and implemented in this study, the data structures of stacks and queues are relatively simple. Therefore, they can be implemented using std::stack and std::queue from the C++ Standard Library, which meets the needs of temporary data management and task scheduling during the solving process.
(5)
Hash Tables and Maps
Hash tables and maps are typically used to store and retrieve information about nonlinear structures. In the solver, hash tables can be used to store the mapping between decision variables and objective function values during the optimization process, or to store intermediate results. With hash tables, the solver can efficiently access and update these data. By mapping key–value pairs into an array, hash tables enable fast lookup, insertion, and deletion operations. For large-scale data storage and rapid retrieval, hash tables provide unparalleled advantages. C++’s std::unordered_map offers an efficient implementation and is widely applied in data-intensive computational tasks.
In summary, this paper adopts the CSC format to store and process sparse matrix data, while making comprehensive use of the built-in vector and matrix data types provided by STL, Armadillo, and SuiteSparse libraries. In scenarios requiring efficient management of sparse matrices, hash table mappings are employed to accelerate data lookup and updates. Additionally, stacks, queues, and other common data structures are integrated to speed up iterative solving.

Appendix C. Complete Tables and Case Study Details

Appendix C provides the complete numerical results and benchmark settings that support and extend the essential findings summarized in the main text.
Table A1. Iteration trajectory of small-scale Case 1.
Table A1. Iteration trajectory of small-scale Case 1.
I t e r M e r i t
C o u n t
f ( x ) M a x C o n s t r a i n t S t e p s i z e D i r e c t i o n a l D e r i v a t i v e F i r s t - O r d e r O p t i m a l i t y H e s s i a n P r o c e d u r e
130.05641610.410.1961.3
250.1188830.0576410.07990.804
370.1238750.00272710.005060.372
490.1238931.255 × 10−511.86 × 10−50.031
5110.1238932.298 × 10−1012.74 × 10−100.745modified
Table A2. Iteration Trajectory of Small-Scale Case 2.
Table A2. Iteration Trajectory of Small-Scale Case 2.
I t e r M e r i t
C o u n t
f ( x ) M a x C o n s t r a i n t S t e p s i z e D i r e c t i o n a l D e r i v a t i v e F i r s t - O r d e r O p t i m a l i t y H e s s i a n P r o c e d u r e
13−0.245760.28810.170.296
25−0.2669370.015741−0.01350.238
37−0.2505860.0306410.01650.437
49−0.25010.00173310.0005280.029modified
511−0.250.000162310.00010.0342modified
613−0.251.158 × 10−718.08 × 10−80.00154modified
Table A3. Iteration Trajectory of Small-Scale Case 3.
Table A3. Iteration Trajectory of Small-Scale Case 3.
I t e r M e r i t
C o u n t
f ( x ) M a x C o n s t r a i n t S t e p s i z e D i r e c t i o n a l D e r i v a t i v e F i r s t - O r d e r O p t i m a l i t y H e s s i a n P r o c e d u r e
194373.121.421 × 10−140.0156−3.68 × 104869
213280.5519.415 × 10−140.251.08 × 104110
3154.530441.776 × 10−141−4.848.63
4173.512338.882 × 10−161−0.9044.97
5190.85863701−1.473.35
6210.2569538.882 × 10−161−0.3941.12
7230.03169101−0.1130.425
8250.00077049401−0.008290.0915
9273.73693 × 10−78.882 × 10−161−3.13 × 10−50.0149
10293.73693 × 10−7015.53 × 10−200.00134
Table A4. Iteration Trajectory of Small-Scale Case 4.
Table A4. Iteration Trajectory of Small-Scale Case 4.
I t e r M e r i t
C o u n t
f ( x ) M a x C o n s t r a i n t S t e p s i z e D i r e c t i o n a l D e r i v a t i v e F i r s t - O r d e r O p t i m a l i t y H e s s i a n P r o c e d u r e
13−36.0762201−9.5910.2
25−30.252426.3317.028.77
37−30.23593.37610.6350.898
49−30.00210.589710.2520.872
511−30.0020.0171710.003910.207
613−300.0041210.002050.0821
715−307.403 × 10−613.64 × 10−60.00314modified
817−306.147 × 10−813.07 × 10−80.000296modified
Table A5. Iteration Trajectory of Small-Scale Case 5.
Table A5. Iteration Trajectory of Small-Scale Case 5.
I t e r M e r i t
C o u n t
f ( x ) M a x C o n s t r a i n t S t e p s i z e D i r e c t i o n a l D e r i v a t i v e F i r s t - O r d e r O p t i m a l i t y H e s s i a n P r o c e d u r e
130.04829470.48510.1687.65
250.04382790.1981−0.001570.015
370.05382010.00511210.009820.0355
490.05382490.00223415.7 × 10−50.000772modified
5110.05394971.859 × 10−610.0001250.000398modified
6130.05394981.839 × 10−1311.1 × 10−71.46 × 10−6modified
Table A6. Iteration Trajectory of Small-Scale Case 6.
Table A6. Iteration Trajectory of Small-Scale Case 6.
I t e r M e r i t
C o u n t
f ( x ) M a x C o n s t r a i n t S t e p s i z e D i r e c t i o n a l D e r i v a t i v e F i r s t - O r d e r O p t i m a l i t y H e s s i a n P r o c e d u r e
131.569454.41−2.371.83
290.28000913.650.0625−12.32.04modified
3140.49459812.240.1251.962.65
4200.67313811.620.06253.081.49modified
5270.81498711.320.03124.762.77modified
6341.028711.090.03127.245.03modified
7460.74141211.320.000977−27010.4
8480.60798511.321−0.1271.56modified
9560.570580.071030.0156−2.361.51
10640.5354760.075490.0156−2.211.46
11720.5025320.079540.0156−2.071.42
12790.4416780.096690.0312−1.881.33
13860.3881940.11090.0312−1.661.25
14920.2972110.16460.0625−1.361.09
15980.2275520.20080.0625−1.040.954
161040.1742190.22380.0625−0.7960.835
171090.09799850.30470.125−0.5230.626
181140.05512410.32790.125−0.2940.47
191180.0137810.38370.25−0.110.235
2012100.32970.500
2112300.3297100
2212500100

Appendix D. The Process and Economic Models of the Single-Stage Three-Pass RO Unit

Mechanistic model of the single-stage three-pass reverse osmosis process:
The separation process of the feed water within the membrane channel is shown in Figure A5.
Figure A5. Separation Process of Feedwater in the Membrane Channel.
Figure A5. Separation Process of Feedwater in the Membrane Channel.
Algorithms 18 00699 g0a5
In the diagram, the two plates of width (w) and length (l) represent the RO membranes. As the feed water flows through the central channel, permeate (product water) is separated on both sides of the membranes, while the feed itself becomes further concentrated and exits to the right as brine. Specifically, when the feed enters the membrane channel under high pressure, separation occurs under the net driving force, producing two streams: part of the water permeates the membrane to form permeate with relatively low salinity, and the remainder, which does not permeate, becomes progressively concentrated and continues along the channel as brine with increasing salinity.
The material balance equations for the solution and solute are as follows:
Q p = Q f Q r
Q f C f = Q p C p + Q r C r
where Q f , Q p , and Q r represent the feedwater flow rate, permeate (fresh water) flow rate, and brine flow rate, respectively. Similarly, C f , C p , and C r represent the feedwater concentration, permeate concentration, and brine concentration, respectively.
The total permeate flow rate Q p of the RO system is expressed as the integral of the membrane element’s water flux:
Q p = n l W 0 L J v d z
where J v ( z ) denotes the water flux of the membrane element at position z along the membrane channel, and n l represents the number of RO membrane leaves. Referring to the membrane module schematic shown in Figure A5, and based on the solution–diffusion model, the relationship between the channel flow parameters and membrane parameters can be obtained. The water flux J v ( z ) and solute flux J s ( z ) of the RO membrane are expressed as follows:
J v ( z ) = A w ( P f P d ( z ) P p ( z ) Δ π ( z ) )
J s ( z ) = B s ( C m ( z ) C s p ( z ) )
where A w and B s represent the transport parameters of the Ro membrane for the solvent and solute, respectively; C m z and C p z denote the solute concentrations at the feed side and permeate side of the membrane surface, respectively. P f is the feedwater pressure after being pressurized by the high-pressure pump, and P d z , P p z , and Δ π ( z ) represent the pressure drop, permeate-side pressure, and osmotic pressure difference at position zin the Ro membrane channel, respectively.
Δ P b ( z ) = P b ( z ) P p ( z )
Δ P z = ( P b z P p z )
Δ π ( z ) = R T ( C m ( z ) C p ( z ) )
where R represents the gas constant and T denotes the water temperature. Using Equations (A15)–(A17), the water flux J v ( z ) of the Ro membrane can be simplified as:
J v z = A w ( Δ P z Δ π z )
At the membrane surface, there is a relationship between the solvent flux J v z and the solute flux J s z :
J s z = J v z × C p z
Changes in the operating temperature of the Ro system affect the mass transfer coefficients of the RO membrane; therefore, both A w and B s are temperature dependent. Their specific expressions are as follows:
A w = A 0 exp ( α 1 T 273.15 273.15 α 2 ( P f P d ( z ) ) )
B s = B 0 exp ( β 1 T 273.15 273.15 )
where A 0 and B 0 are the permeation coefficients of the RO membrane module under standard conditions; α 1 , α 2 , and β 1 are constants; and T denotes the operating temperature of the system in kelvin.
In the RO process, concentration polarization is an important factor affecting mass transfer efficiency, and its factor ϕ ( z ) can be expressed as:
ϕ ( z ) = C m ( z ) C p ( z ) C b ( z ) C p ( z ) = exp ( J v ( z ) k c ( z ) )
where k c ( z ) denotes the mass transfer coefficient at position z in the membrane channel, which is calculated as:
S h ( z ) = k c ( z ) d e D A B ( z ) = 0.065 R e z 0.875 S c z 0.25
where S h z , R e z , and S c z denote the Sherwood number, Reynolds number, and Schmidt number, respectively, at position z ; and d e represents the hydraulic diameter of the feed spacer channel. The specific expressions for the Reynolds number R e z and the Schmidt number S c z are as follows:
R e = ρ z V b z d e μ z
S c = μ ( z ) ρ ( z ) D A B ( z )
where V b z represents the brine flow velocity at position z in the membrane channel; ρ z denotes the permeate water density at position z in the RO channel; μ z is the dynamic viscosity at position z ; and D A B z represents the solute diffusivity at position z in the RO channel. These parameters can be calculated using regression equations:
ρ ( z ) = a 1 M + a 2 M 2 + a 3 M C b ( z )
μ ( z ) = b 1 exp ( b 2 C b ( z ) 1965 273.15 + T )
D A B ( z ) = k 1 exp ( k 2 C b ( z ) 2513 273.15 + T )
where a 1 , a 2 , a 3 , b 1 , b 2 , k 1 , and k 2 are regression coefficients, and M is a process variable related to the temperature T . Neglecting the influence of pollutants in the RO process, and following the law of mass conservation together with the above mechanisms, the pressure loss Pd(z) of the RO process is given by:
d P d z d z = λ z ρ z d e V b z 2 2
λ ( z ) = K λ R e ( z ) 0.3
where λ z represents the friction factor, V b z is the axial velocity of the feedwater at position z in the RO channel, and K λ Is an empirical parameter related to the membrane element. The formula for the pressure drop in the membrane channel is:
d P b z d z = d P d z d z = λ ρ z d e V b z 2 2
The feedwater velocity V b z and solute concentration C b z in the RO feed channel are expressed as:
d V b z d z = 2 J v z h s p
d C b z d z = 2 J v z h s p V b z ( C b z C p z )
where h s p represents the height of the feed spacer channel in the membrane element.
For a single-stage multi-pass RO system, the brine produced by the previous pass is used as the feedwater for the next pass to continue the separation process. The brine from the preceding pass and the feedwater of the subsequent pass are related as follows:
Q f , j + 1 = Q r , j N P j N P j + 1
C f , j + 1 = C r , j
P f , j + 1 = P r , j + P b p , j
where j denotes the j -th pass of the RO system, N P j is the number of pressure vessels in the j -th pass, and P b p , j represents the booster pump pressure for the j -th pass.
Based on the above mechanism equations, the water recovery rate Rec-RO and salt rejection rate Ry-RO of the RO system can be expressed as follows:
R ec RO = Q p 1 + Q p 2 + Q p 3 Q f × 100 %
R y R O = ( 1 Q p 1 C p 1 + Q p 2 C p 2 + Q p 3 C p 3 Q f C f ) × 100 %
Q h p p = Q f + Q p , 3 N P 3
C h p p = Q f C f + Q p , 3 C p , 3 Q f + Q p , 3
where Q h p p and C h p p represent the flow rate and concentration, respectively, of the mixed water entering the high-pressure pump after combining the permeate from the third pass with the feedwater.
Economic Model of the Single-Stage Three-Pass RO Process:
To enable simulation and optimization of the single-stage three-pass high-pressure RO unit, an accurate economic evaluation model must first be established. Under steady operating conditions, the primary cost components are:
(1)
chemical dosing cost (OCCH);
(2)
raw-water intake energy cost (OCIP);
(3)
RO unit operating energy cost (OCEN);
(4)
membrane replacement cost (OCME);
(5)
maintenance cost (OCMN);
(6)
labor cost (OCLB).
The specific formulations of these cost components are given in Equations (A41)–(A46) [28].
O C C H = k Q f
O C I P = P 0 Q f P e l c c × P L F
O C E N = [ P f Q f / ( ε p ε V F D ) + P b p Q f 2 / ε b p Q p ] × P e l c
O C M E = P r i M E N M ζ r e / 360
O C M N = σ O C R O
O C L B = P r i L B N L B
The specific form of the daily operating cost is given in Equation (A47):
O C = O C C H + O C I P + O C E N + O C M E + O C M N + O C L B
where k denotes the conversion coefficient for chemical-additive cost; P 0 denotes the outlet pressure; P e l c denotes the electricity price; P L F denotes the load factor; c denotes the intake-pump efficiency; ε p denotes the mechanical efficiency of the high-pressure pump; ε V F D denotes the mechanical efficiency of the variable-frequency drive; ε b p denotes the mechanical efficiency of the booster pump; P r i M E denotes the cost of a single membrane element; N M denotes the number of membrane elements; ζ r e denotes the replacement frequency of membrane elements; σ denotes the proportion of maintenance cost; P r i L B denotes the cost per laborer; and N L B denotes the number of laborers.

References

  1. Gui, W.; Wang, C.; Xie, Y.; Song, S.; Meng, Q.; Ding, J. The necessary way to realize great leap forward development of process industries. China Sci. Found. 2015, 29, 337–342. [Google Scholar]
  2. Gui, W.; Zeng, Z.; Chen, X.; Xie, Y.; Sun, Y. Knowledge-driven process industry smart manufacturing. Sci. China Inf. Sci. 2020, 50, 1345–1360. [Google Scholar] [CrossRef]
  3. Yang, Y. A Combination of Interior Point Method and SQP Method. Master’s Thesis, Beijing Jiaotong University, Beijing, China, 2014. [Google Scholar]
  4. Liu, P. Control Variable Parameterization-Based Optimal Control Problems Computational Methods Research. Ph.D. Thesis, Zhejiang University, Hangzhou, China, 2017. [Google Scholar]
  5. Wilson, R.B. A Simplicial Method for Convex Programming; Harvard University: Cambridge, MA, USA, 1963. [Google Scholar]
  6. Han, S.P. Superlinearly convergent variable metric algorithms for general nonlinear programming problems. Math. Program. 1976, 11, 263–282. [Google Scholar] [CrossRef]
  7. Han, S.P. A globally convergent method for nonlinear programming. J. Optim. Theory Appl. 1977, 22, 297–309. [Google Scholar] [CrossRef]
  8. Powell, M.J.D. A fast method for solving nonlinear optimization problems. In Proceedings of the 1977 Conference on Advances in Optimization and Control, Würzburg, Germany, 5–9 September 1977; University of Dundee: Dundee, UK, 1978; pp. 145–160. [Google Scholar]
  9. Powell, M.J.D. Algorithms for nonlinear constraints that use Lagrangian functions. Math. Program. 1978, 14, 224–248. [Google Scholar] [CrossRef]
  10. Powell, M.J.D. The convergence of variable metric methods for nonlinearly constrained optimization calculations. Nonlinear Program. 1978, 3, 27–64. [Google Scholar]
  11. Nocedal, J.; Wright, S.J. Sequential Quadratic Programming. In Numerical Optimization; Springer: New York, NY, USA, 1989; pp. 529–562. [Google Scholar]
  12. Gill, P.E.; Murray, W.; Saunders, M.A.; Wright, M.H. Sparse matrix methods in optimization. SIAM J. Sci. Statist. Comput. 1984, 5, 562–589. [Google Scholar] [CrossRef]
  13. Gill, P.E.; Murray, W.; Saunders, M.A.; Wright, M.H. Some Theoretical Properties of an Augmented Lagrangian Merit Function. In Advances in Optimization and Parallel Computing; Pardalos, P.M., Ed.; Stanford University: Stanford, CA, USA, 1992; pp. 101–128. [Google Scholar]
  14. Gill, P.E.; Murray, W.; Poncele’on, D.B.; Saunders, M.A. Solving Reduced KKT Systems in Barrier Methods for Linear Programming; Watson, G.A., Griffiths, D., Eds.; Longman Scientific & Technical: Harlow, UK, 1994; Volume 303, pp. 89–104. [Google Scholar]
  15. Jian, J. A subfeasible direction method combining SQP technology with generalized projection. J. Appl. Math. Ser. A 1996, 1, 65–74. [Google Scholar]
  16. Tits, A.L.; Wächter, A.; Bakhtiari, S.; Urban, T.J.; Lawrence, C.T. A primal-dual interior-point method for nonlinear programming with strong global and local convergence properties. SIAM J. Optim. 2003, 14, 173–199. [Google Scholar] [CrossRef]
  17. Jiang, A.; Guo, Z.; Chen, S.; Zheng, X.; Qi, D.; Fang, X.; Qian, J. Operation optimization of distillation column based on reduced SQP algorithm and hybrid derivative method. J. Chem. Ind. Eng. 2006, 57, 1378–1384. [Google Scholar]
  18. Jiang, A.; Shao, Z.; Qian, J. Optimization of reaction parameters based on rSQP and hybrid automatic differentiation algorithm. J. Zhejiang Univ. Eng. Sci. 2004, 38, 1606–1610. [Google Scholar]
  19. Dowling, A.W.; Biegler, L.T. A framework for efficient large scale equation-oriented flowsheet optimization. Comput. Chem. Eng. 2015, 72, 185–197. [Google Scholar] [CrossRef]
  20. Curtis, F.E.; O’Neill, M.J.; Robinson, D.P. Worst-case complexity of an SQP method for nonlinear equality constrained stochas-tic optimization. Math. Program. 2024, 205, 431–483. [Google Scholar] [CrossRef]
  21. Uihlein, A.; Wollner, W. Stabilized SQP methods in Hilbert spaces. arXiv 2024, arXiv:2312.14801. [Google Scholar] [CrossRef]
  22. Ma, Y.; Gao, X.; Liu, C.; Li, J. Improved SQP and SLSQP algorithms for feasible path-based process optimisation. Comput. Chem. Eng. 2024, 188, 108751. [Google Scholar] [CrossRef]
  23. Leyffer, S.; Vanaret, C.; Gould, N. A Unified Funnel Restoration SQP Algorithm; Optimization Online: Argonne, IL, USA, 2024. [Google Scholar]
  24. Fang, L.; Vondele, S.; Meyers, J. An SQP-based multiple shooting algorithm for large-scale PDE-constrained optimal control problems. J. Comput. Phys. 2023, 477, 111927. [Google Scholar] [CrossRef]
  25. Jiang, A.; Cheng, W.; Wang, J.; Xing, C.; Ding, Q.; Jiang, Z. Operational optimizations of full-flowsheet spiral-wound seawater reverse osmosis system. CIESC J. 2014, 65, 1333–1343. [Google Scholar]
  26. Jiang, A.; Cheng, W.; Jiang, Z.; Lin, Y. A strategy of membrane cleaning and replacing schedule for spiral-wound SWRO system. CIESC J. 2015, 66, 4092–4100. [Google Scholar]
  27. Zhang, Q. Study on integrated optimal control strategy of reverse osmosis desalination system. Master’s Thesis, Hangzhou Dianzi University, Hangzhou, China, 2019. [Google Scholar]
  28. Xie, F. Modeling and optimization of zero discharge system for high-salinity wastewater from coal-fired power plants. Master’s Thesis, Hangzhou Dianzi University, Hangzhou, China, 2024. [Google Scholar]
  29. Cao, W. Cost evaluation based on energy and membrane consumption for sea water reverse osmosis system. Water Supply Drain. 2020, 56, 73–79. [Google Scholar]
  30. Jiang, A. Large-Scale Reduced-Space SQP Algorithms and Their Application to Process Systems Optimization. Ph.D. Thesis, Zhejiang University, Hangzhou, China, 2005. [Google Scholar]
  31. Wang, K. Research on Reduced-Space Theory and Algorithms for Large-Scale Nonlinear Optimization of Process Systems. Ph.D. Thesis, Zhejiang University, Hangzhou, China, 2008. [Google Scholar]
Figure 1. General workflow of the reduced-space SQP algorithm.
Figure 1. General workflow of the reduced-space SQP algorithm.
Algorithms 18 00699 g001
Figure 2. Workflow of the space-decomposition algorithm based on the column-reordering strategy. Figure 2 is divided into four main parts: (1) variable partitioning; (2) determining whether a basis change is required; (3) performing the basis transformation; (4) computing the null-space matrix.
Figure 2. Workflow of the space-decomposition algorithm based on the column-reordering strategy. Figure 2 is divided into four main parts: (1) variable partitioning; (2) determining whether a basis change is required; (3) performing the basis transformation; (4) computing the null-space matrix.
Algorithms 18 00699 g002
Figure 3. RSQP Solver Structure Diagram.
Figure 3. RSQP Solver Structure Diagram.
Algorithms 18 00699 g003
Figure 4. Interface Reconstruction Diagram.
Figure 4. Interface Reconstruction Diagram.
Algorithms 18 00699 g004
Figure 5. Invocation Relationships Among Solver Modules and the Program’s Control Flow. The red dashed box in Figure 5 highlights the core steps of the RSQP algorithm. It should be noted that, considering the possibility that the initial point may already be the optimal solution, the termination condition check and the output printing module are placed at the very beginning of the iteration process. In this setup, the convergence testing module is responsible for determining whether the iteration should terminate and for updating the current state of the iteration point, while the output module prints the corresponding iteration information or termination message based on the iteration status. In view of the length constraints, this work focuses only on a detailed analysis of the space decomposition module and the handling of sparse matrices.
Figure 5. Invocation Relationships Among Solver Modules and the Program’s Control Flow. The red dashed box in Figure 5 highlights the core steps of the RSQP algorithm. It should be noted that, considering the possibility that the initial point may already be the optimal solution, the termination condition check and the output printing module are placed at the very beginning of the iteration process. In this setup, the convergence testing module is responsible for determining whether the iteration should terminate and for updating the current state of the iteration point, while the output module prints the corresponding iteration information or termination message based on the iteration status. In view of the length constraints, this work focuses only on a detailed analysis of the space decomposition module and the handling of sparse matrices.
Algorithms 18 00699 g005
Figure 6. Convergence Curve for Case 1.
Figure 6. Convergence Curve for Case 1.
Algorithms 18 00699 g006
Figure 7. Convergence Curve for Case 2.
Figure 7. Convergence Curve for Case 2.
Algorithms 18 00699 g007
Figure 8. Convergence Curve for Case 3.
Figure 8. Convergence Curve for Case 3.
Algorithms 18 00699 g008
Figure 9. Convergence Curve for Case 4.
Figure 9. Convergence Curve for Case 4.
Algorithms 18 00699 g009
Figure 10. Convergence Curve for Case 5.
Figure 10. Convergence Curve for Case 5.
Algorithms 18 00699 g010
Figure 11. Convergence Curve for Case 6.
Figure 11. Convergence Curve for Case 6.
Algorithms 18 00699 g011
Figure 12. Diagram of the Principles of Forward Osmosis and Reverse Osmosis.
Figure 12. Diagram of the Principles of Forward Osmosis and Reverse Osmosis.
Algorithms 18 00699 g012
Figure 13. Diagram of the Single-Stage Three-Pass High-Pressure RO Unit.
Figure 13. Diagram of the Single-Stage Three-Pass High-Pressure RO Unit.
Algorithms 18 00699 g013
Figure 14. Case 1 Simulation Convergence Curve.
Figure 14. Case 1 Simulation Convergence Curve.
Algorithms 18 00699 g014
Figure 15. Case 2 Simulation Convergence Curve.
Figure 15. Case 2 Simulation Convergence Curve.
Algorithms 18 00699 g015
Figure 16. Case 1 Optimization Convergence Curve.
Figure 16. Case 1 Optimization Convergence Curve.
Algorithms 18 00699 g016
Figure 17. Case 2 Optimization Convergence Curve.
Figure 17. Case 2 Optimization Convergence Curve.
Algorithms 18 00699 g017
Figure 18. Case 1 Cost Comparison.
Figure 18. Case 1 Cost Comparison.
Algorithms 18 00699 g018
Figure 19. Case 2 Cost Comparison.
Figure 19. Case 2 Cost Comparison.
Algorithms 18 00699 g019
Table 1. Solution Results of Variable-Dimension Problems.
Table 1. Solution Results of Variable-Dimension Problems.
CaseNumber of VariablesDegrees of FreedomRSQPFMINCON SQP
IterationsTime (s)Basis TransformationsIterationsTime (s)
11000180.2291325.263
2000190.41112178.334
40001911##
80001102.8161##
16,0001108.4481##
32,00011026.1911##
64,000111101.7221##
128,000112419.9361##
21000500154.4960210.42
200010001725.9910277.961
40002000615.03212989.919
60003000641.7491##
34000260.7111##
8000261.7251##
16,000264.3621##
20,000266.1891##
50,0002627.9881##
Note: # denotes memory overflow or timeout.
Table 2. Data of Two Typical Operating Scenarios.
Table 2. Data of Two Typical Operating Scenarios.
Typical ConditionFeed Temperature/°CFeed Concentration (kg/m3)Feed Flow Rate (m3/h)Operating Pressure (bar)Booster Pump Pressure (bar)
Case 11023.328.836.8735
Case 21521.82536.8736
Table 3. Upper- and Lower-Bound Constraints of RO System Variables.
Table 3. Upper- and Lower-Bound Constraints of RO System Variables.
ParameterValue
Maximum element feed pressure P f u p 82.53 bar
Maximum element pressure drop P d u p 1.03 bar
Maximum interstage booster pump pressure P b p u p 40 bar
Maximum element feed flow Q f u p 13.6 m3/h
Maximum element permeate flow Q p u p 1.04 m3/h
Minimum element channel flow Q b l o 2.3 m3/h
Maximum element recovery R u p 15%
Feed surface velocity V b u p 0.35 m/s
Minimum feed surface velocity V b l o 0.038 m/s
Maximum element concentration polarization φ u p 1.5
Table 4. Optimization results of the RSQP solver under two typical operating scenarios.
Table 4. Optimization results of the RSQP solver under two typical operating scenarios.
Comparison MetricCase 1Case 2
Iteration count1919
Function evaluation count5759
Basis change count11
Gradient evaluation count2829
Constraint residual3.919 × 10−89.5771 × 10−9
Time (seconds)20.33123.412
Table 5. Comparison of Daily Operating Costs of the RO System Before and After Optimization.
Table 5. Comparison of Daily Operating Costs of the RO System Before and After Optimization.
RO
System Parameters
Case 1Case 2
Before OptimizationAfter OptimizationBefore OptimizationAfter Optimization
Feed Pressure
(bar)
36.870040.307036.870035.7844
Feed Flow Rate (m3/h)28.800032.926125.000032.4267
Booster Pump Pressure
(bar)
35.000015.180936.000015.3830
Permeate Flow Rate
(m3/h)
22.162921.000020.000021.0000
Permeate Concentration
(mg/L)
594.3214800.0000901.4206700.3871
Water Recovery Rate
(%)
76.954572.916780.000084.0000
Salt Rejection Rate
(%)
97.449396.566695.865096.7872
Operating Cost
(CNY/day)
2264.55852151.82652088.46952058.0259
Table 6. Changes in Cost Items Before and After Optimization.
Table 6. Changes in Cost Items Before and After Optimization.
Cost ItemCase 1Case 2
Before Optimization (CNY)After Optimization (CNY)Change (CNY)Before Optimization (CNY)After Optimization (CNY)Change (CNY)
O C C H 102.5965106.9436+4.347189.0595105.1964+16.1369
O C I P 68.103570.9891+2.885659.117669.8293+10.7117
O C E N 972.6862854.5628−118.1234822.5446763.6691−58.8755
O C M E 186.0822186.08220186.0822186.08220
O C M N 35.090033.2489−1.841131.665633.2489+1.5833
O C L B 900.0000900.00000900.0000900.00000
Total2264.55852151.8265−112.7322088.46952058.0259−30.4436
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Zhao, C.; Liu, A.; Jiang, A.; Zheng, X.; Wang, H.; Zhao, R. Design and Implementation of a Reduced-Space SQP Solver with Column Reordering for Large-Scale Process Optimization. Algorithms 2025, 18, 699. https://doi.org/10.3390/a18110699

AMA Style

Zhao C, Liu A, Jiang A, Zheng X, Wang H, Zhao R. Design and Implementation of a Reduced-Space SQP Solver with Column Reordering for Large-Scale Process Optimization. Algorithms. 2025; 18(11):699. https://doi.org/10.3390/a18110699

Chicago/Turabian Style

Zhao, Chuanlei, Ao Liu, Aipeng Jiang, Xiaoqing Zheng, Haokun Wang, and Rui Zhao. 2025. "Design and Implementation of a Reduced-Space SQP Solver with Column Reordering for Large-Scale Process Optimization" Algorithms 18, no. 11: 699. https://doi.org/10.3390/a18110699

APA Style

Zhao, C., Liu, A., Jiang, A., Zheng, X., Wang, H., & Zhao, R. (2025). Design and Implementation of a Reduced-Space SQP Solver with Column Reordering for Large-Scale Process Optimization. Algorithms, 18(11), 699. https://doi.org/10.3390/a18110699

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop