Next Article in Journal
Numerical Investigation of Heat Transfer Characteristics in an Industrial-Scale Continuous Annular Cooler for Iron Ore Sintering Process
Previous Article in Journal
Combustion and Emissions Optimization of Diesel–Methanol Dual-Fuel Engine: Emphasis on Valve Phasing and Injection Parameters
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Simultaneous Framework for Dynamic Optimization Based on Density Functions

College of Information Engineering, Zhejiang University of Technology, Hangzhou 310023, China
*
Author to whom correspondence should be addressed.
Processes 2025, 13(4), 1184; https://doi.org/10.3390/pr13041184
Submission received: 13 November 2024 / Revised: 4 December 2024 / Accepted: 6 December 2024 / Published: 14 April 2025
(This article belongs to the Section Automation Control Systems)

Abstract

:
Regarding the discretization issue in the process of a simultaneous approach for dynamic optimization problems, a configuration strategy based on the density function has been proposed for the finite element distribution of dynamic optimization problems. By utilizing the error at the non-collocation points, a bilevel problem has been constructed and solved, and the number and distribution of the finite elements have been evaluated. For the inner problem in the bilevel problem, a new smoothing function has been introduced to improve the solution accuracy of the inner problem. The grid density function has been constructed using the error at the non-collocation points on each finite element. Finally, the grid density function has been used to update the positions of the finite element endpoints, with the aim of reallocating the finite elements. Finally, two case studies have been provided to specifically demonstrate the role of the proposed method in reducing the optimization problem scale with required solution accuracy.

1. Introduction

Dynamic optimization is widely used in process systems engineering, with high demands for real-time solving in specific applications such as nonlinear model predictive control (NMPC) and online parameter estimation [1,2,3]. When using a direct approach to solve dynamic optimization problems, the original problem needs to be discretized first. Currently, the most popular discretization methods include the finite element method [4,5,6], the multiple shooting method [7,8,9,10], and control vector parameterization [11,12]. The control vector parameterization method only discretizes the control variables, which results in smaller problem sizes and significant speed advantages in solving. However, collocation may struggle to meet precision requirements and cannot effectively solve problems with state constraints. While the multiple shooting method enhances solution accuracy, the additional computation of sensitivity matrices during the solving process increases complexity. The simultaneous solution method based on finite element collocation discretizes both state and control variables, allowing for the direct treatment of path constraints and achieving higher precision. Nevertheless, the size of the resulting nonlinear programming problem after discretization is closely related to the number and distribution of selected finite elements. Generally, the more segments the finite elements are divided into in the time domain, the smaller the error in the numerical solution. However, more finite elements imply a larger scale of the nonlinear programming problem, leading to longer solving times. Similarly, reducing the number of finite elements can speed up solving but might compromise precision.
In order to simultaneously improve the numerical accuracy and efficiency of discretely solving ordinary differential equations (ODEs) and differential algebraic equations (DAEs), Wright et al. [8] devised a strategy for adaptive mesh refinement using finite elements by employing subdivision criteria functions. These criteria functions are designed to consider the impact of the size of individual finite elements on errors in other finite elements, and they are applied to solve two-point boundary value problems. Auzinger et al. [10] proposed a new estimation method for the global error resulting from discretization using the finite element collocation method and provided a comprehensive analysis of the correctness of this method when applied to general nonlinear regularization problems. Furthermore, Auzinger et al. [13] later introduced a method for globally equalizing errors. Starting from a coarse equal distribution of finite elements, this method refines the elements to ensure that errors generated in each segment of finite elements are uniformly distributed, effectively meeting user-specified accuracy requirements. This refinement strategy has shown good results in the numerical solution process of singular optimal control problems. Wright [14] employed an adaptive piecewise polynomial interpolation method to solve two-point boundary value problems, categorizing finite element refinement strategies into two types: for elements with small and evenly distributed errors, a subdivision strategy based on the previous finite element distribution is used; for elements with large and unevenly distributed errors, endpoints of the original finite elements need to be removed and the finite element allocation needs to be redone.
Vasantharajan and Biegler [15] introduced error constraints into the process of solving dynamic optimization problems to ensure more accurate and reliable results. To control approximation errors, the authors developed two different strategies: the error uniform distribution method and the error enforcement constraint method. These strategies are embedded in the solving process of the nonlinear programming problems obtained after discretization, and they adaptively adjust the lengths of finite elements during the optimization process. In the work of Seferlis and Hrymak [16], a method was employed to insert new grid points adaptively into finite elements to alter the distribution of the grid, thereby enhancing the numerical solution accuracy. The new grid distribution evenly distributes errors in the solution results across each finite element. Additionally, Tanartkit and Biegler [17,18] proposed a dual-layer strategy where the outer problem determines the number of finite elements required to meet a given tolerance, while the inner problem aims to solve the dynamic optimization problem and pass the solution results to the outer problem. Subsequently, Biegler et al. [19] further improved this strategy by introducing a simultaneous method based on error estimation. By adjusting the sizes of finite elements and the distribution of grid points in the mesh, this method captures switching points of control variables in optimal control problems and redistributes the grid based on the positions of these switching points to ensure precise control and state curves. Huntington and Rao [19] improved solution accuracy by varying the number of finite elements. They compared the global and local implementations of the orthogonal collocation method for solving optimal control problems to determine the accuracy and computational efficiency of each method. In the local method, the number of collocation points within each finite element remains constant while the number of elements changes. The global collocation form uses a single finite element over the entire interval with varying collocation point numbers. Zhao and Tsiotras introduced a method of grid point allocation using density functions [20], with the key aspect being the choice of the density function. By constructing a density function based on prior knowledge gained from previous solutions, grid point positions in the discretized mesh are recalculated using the density function, leading to more accurate results when solving the problem with the new mesh. Additionally, Darby et al. [21,22] proposed an hp-adaptive pseudospectral method. It divides the entire time domain into multiple intervals based on the curvature of the control trajectory. For intervals where the control trajectory is sufficiently smooth, the method of enhancing interpolation order (p-method) achieves faster accuracy improvement within a subinterval. For less smooth intervals, the method of subdividing the subintervals (h-method) works better. This method enables the use of pseudospectral methods to solve complex optimal control problems where global pseudospectral methods are not feasible. However, it requires multiple iterations to solve nonlinear programming problems, increasing computational burden. Consequently, using this method for online applications, especially for large-scale dynamic optimization problems, can be challenging. Paiva and Fontes [23] proposed an adaptive time mesh algorithm considering different refinement levels. The algorithm utilizes information from adjoint multipliers for grid refinement. However, in the process of solving optimization problems, the computational burden increases due to the addition of excessive new collocation points during grid refinement. In subsequent research, Paiva [24] introduced a time mesh refinement strategy based on local errors. After computing the solution on a coarse mesh, local errors are evaluated, providing information on the time subintervals that require refinement. This process is repeated until the local errors reach a user-specified threshold.
In recent years, Tamimi et al. [25] proposed a method for selecting the number of finite elements segments tailored to model predictive control. This method constructs a new optimization problem based on prior information obtained from the previous solution, including the solution time, objective function values, and the number of finite elements. It aids in selecting a “compromise” number of time intervals to achieve the desired accuracy. Subsequently, Haman et al. [26] enhanced the accuracy of the method by increasing the polynomial approximation order and the number of finite elements in each segment. They also merged adjacent grids that already met the accuracy requirements to reduce grid size and improve solution speed. Miller [27] utilized step functions to detect discontinuities in control trajectories and applied targeted refinement methods to adjust the discretized grid in different regions, thereby enhancing solution accuracy and efficiency. This approach is particularly effective for addressing optimal control problems with discontinuous control solutions, providing accurate numerical solutions within fewer iterations and a lower computational time. Furthermore, Huang et al. [28] introduced an adaptive grid allocation method based on pseudospectral techniques. Initially, they estimated the polynomial order based on the error between dynamics and state variable differential approximations in the spectral matrix. Subsequently, they determined whether to segment intervals based on the maximum polynomial order within the intervals. Finally, the positions of grid points were obtained as decision variables during the process of solving the optimal control problem.
Li et al. [29] proposed a novel bilevel method where an inner layer initially estimates the prior error. By constructing and solving a maximization problem, they obtain an upper bound on the approximate error. In the outer layer, the number of finite elements is treated as a decision variable to determine the minimum number of finite elements that satisfy a user-specified tolerance. The computation process of this method is intricate because in each iteration of the outer layer, the number of finite elements is uniformly increased by one segment, and then the maximum discretization error is solved internally and passed on to the outer layer for further iterative grid updates. Although after multiple iterations a grid satisfying the specified tolerance can be obtained, the grid update process in each iteration only utilizes the maximized error from the previous solution, leading to a relatively slow update pace for the distribution of finite elements. Zhao et al. [20] utilized the local curvature function of the control variable u as a density function for iterating over finite elements. They redistribute the finite elements based on the magnitude of the curvature of the control curve, densifying the finite element distribution where the local curvature function has a large value and making it sparser where the curvature function value is small.
In this study, inspired by the work of Li et al. [29], a bilevel strategy is employed to assess whether the discretized grid meets the user-specified tolerance requirements. However, a different approach is taken for updating the discretized grid using the concept of a grid density function. The selection of the density function and the calculation of grid point positions differ from the methodology proposed by Zhao [20]. Using the control trajectory curvature as the grid density function presents several distinct drawbacks. Firstly, the grid density function determined by this method tends to have relatively high calculation errors. In the work by Zhao, the calculation method for local curvature is relatively simplistic, leading to the loss of crucial information during computation and resulting in the density function not accurately reflecting the true control curvature. Secondly, the approach for selecting the grid density function in the literature lacks universality. For certain highly sensitive issues, using curvature as the grid density function may not yield optimal results. This study constructs the grid density function based on errors at non-collocation points within each finite element. Modifications have been made to the calculation method for grid points, enhancing the accuracy and convenience of refining the discretized grid using the grid density function. Moreover, by combining this refined bilevel approach, a more precise determination of the minimum number of finite elements in the discretized grid that satisfies the user-specified accuracy criteria can be achieved.

2. Description of Problem

This paper research the following form of nonlinear dynamic optimization problem:
min u ( t ) : J   =   M ( x ( t f ) ) + t 0 t f L ( x ( t ) , u ( t ) , t ) d t s . t . x ˙ ( t ) = f ( x ( t ) , u ( t ) , t ) x ( t 0 ) = x 0 x min x ( t ) x max u min u ( t ) u max t [ t 0 , t f ]
In this problem, x(t) ∈ Rnx and y(t) ∈ Rny represent the vectors of differential and algebraic state profiles, respectively; and the control profiles u(t) R n u are bounded by u l , u u R n u , respectively; f : R n x + n y + n u R n x , g : R n x + n y + n u R n y are three times differentiable functions [30]. Moreover, both the control variable u(t) and the state variable x(t) are subject to constraints. To solve this problem using a coupled method based on finite element orthogonal configuration, we need to select a discretization method and determine several time intervals to transform it into a nonlinear programming problem to achieve a numerical solution. The specific discretization process is as follows:
The optimal control problem is transformed into an NLP (nonlinear programming) using the finite elements method. First, the continuous time domain is discretized into a finite number of finite elements [ti−1, ti], i = 1, …, N, which satisfies
t 0 < t 1 < t 2 < < t N 1 < t N = t f
where t0 and tN are fixed and where grids t1, …, tN−1 may become variables. Lagrange interpolation polynomials using either Gauss or Radau points on each finite element are adopted as follows [31]:
x K ( t ) = k = 0 K l k ( τ ) x i k u K ( t ) = k = 0 K l ¯ k ( τ ) u i k ,   y K ( t ) = k = 0 K l ¯ k ( τ ) y i k t i = t i 1 + h i τ ,   h i = ( t i t i 1 ) ,   τ [ 0 , 1 ] l k ( τ ) = j = 0 , k K τ τ j τ k τ j ,   l ¯ k ( τ ) = j = 1 , k K τ τ j τ k τ j
where K is the number of collocation points. Lagrange polynomials have the additional benefit of satisfying the following conditions:
t i k = t i 1 + ( t i t i 1 ) τ k x K ( t i k ) = x i k ,   u K ( t i k ) = u i k ,   y K ( t i k ) = y i k
with the collocation equations written as [31]
j = 0 K l ˙ j ( τ k ) x i j h i f ( x i k , y i k , u i k ) = 0 g ( x i k , y i k , u i k ) = 0 , i = 1 , , N ; k = 1 , K
the continuity of the differential state profiles is enforced by the following equation [31]
x i + 1 , 0 = j = 0 K l j ( 1 ) x i j , i = 1 , , N 1
After discretizing the problem and transforming it into the form of a nonlinear programming problem, it is necessary to assess the errors generated during the discretization process. Since at the collocation points the numerical and analytical values of the state are nearly identical within a tolerance range [31,32], there is no need to discuss the approximation errors at these points during the analysis of the discretization errors. Instead, the focus should be on analyzing the errors at non-collocation points, using them as a metric to gauge the accuracy of the solution. Theoretically, the number of non-interpolated points is infinite, which complicates error estimation. To address this challenge, it is essential to select a distinct non-collocation point within each time interval for error analysis. We adopt the same approach as Li et al. [29] by using non-collocation points for error estimation. Consequently, the error e ( t ~ i ) at each finite element non-collocation point is expressed as
e ( t i ˜ ) = x ( t i ˜ ) x N ( t i ˜ ) ,   i { 1 , , N }
where t i ~ represents the position of the non-collocation point on the ith finite elements, and x N ( t ) denotes the value of the state variable obtained from the discretized grid after adding a grid point at the non-collocation point.

3. Description and Improvement of the Bilevel Method

In the work by Li et al. [29], a bilevel problem was proposed to determine the number of finite elements, where the inner bilevel method involves formulating a dynamic optimization problem that maximizes the error. The error maximization problem can be described as
max u , s :   s s . t . : j = 0 n c l ˙ j ( τ k ) x i j h i f ( x i k , u i k ) , i = 1 , , N , k = 1 , , n c   max i { 1 , , N } { e q ( t ^ i ) } s = 0   x min x p , i x max , i , , N   u min u i u max   s min s s max
where e q ( t ^ i ) = x q ( t ^ i ) x N q ( t ^ i ) . Additionally, s R 1 represents the maximized error, and q denotes the number of components of the state variable x. The upper and lower bounds of the error maximization problem constructed are the same as the original problem, with the upper and lower bounds for maximizing the error s being smax = 1, smin = 0, respectively. When solving this inner layer problem using a nonlinear solver, the presence of non-smooth absolute value and maximum value symbols in Equation (8) poses a challenge that derivative-based optimization methods cannot directly handle. Therefore, it is necessary to smooth out these non-smooth regions.
In the method proposed by Li et al. [29], a softmax function is utilized to smooth out these two non-smooth constraints:
max { α , β } = ln ( exp ( α ) + exp ( β ) ) α = max { α , α } = ln ( exp ( α ) + exp ( α ) )
however, during the calculations, it was observed that a significant error is introduced when smoothing is performed using Equation (9). For instance, when applying Equation (9) for smoothing, the resulting function graph is compared with the original function graph, as shown in Figure 1.
In Figure 1, the function |t| with the absolute value symbol is smoothed using Equation (9). It can be observed from the graph that the smoothing effect is not ideal, especially near zero where the smoothed function values deviate significantly from the original function values. Moreover, the errors calculated using the inner methods are often very small. Therefore, when applying Equation (9) for smoothing, these errors become substantially large, failing to accurately reflect the actual error values. Consequently, using Equation (9) to smooth functions with absolute value symbols is not advisable. Additionally, the removal of the maximum value symbol in Equation (9) for smoothing also introduces errors that need to be addressed. Hence, this paper proposes a new smoothing strategy that can better approximate the actual results.
a = a + a a + a = 0 a + 0 , a 0 a = a + a +
In Equation (10), two non-negative functions are used to replace the absolute value function [33]. Furthermore,
max { a , b } = a + b 2 + a b 2
the approach of eliminating the max function using Equation (11) is shown to be entirely equivalent and does not introduce errors. In practical applications, let
a = a + a a + a = ε a a + ε a , a ε a
where ε a is a very small positive integer. Compared to Equation (9), the smoothing errors generated by using Equations (10) and (12) are smaller. This enables the inner method to better reflect the actual error values during the process of maximizing error.
In contrast to the inner method, the design of the outer method is relatively concise. It involves passing the maximum error calculated by the inner method and comparing it with the given tolerance. Based on this comparison, the positions of the finite element nodes are updated. This can be specifically expressed as follows:
min N ( l ) : { N ( l ) } s . t . : e max ( q ) ε
where l denotes the iteration number and N represents the size of the discretized grid. N is updated after each iteration as follows: N = N + 1. Then, based on the updated value of N, the time domain is uniformly partitioned to create a new distribution of finite elements. If the maximum non-collocation point error is less than the user-defined tolerance, then N is set as the minimum number of finite elements.

4. Finite Element Allocation Strategy Based on Density Function

The grid density function is a non-negative function f ¯ : [ a , b ] R + ,   a ,   b R that satisfies an integral value of 1 over the interval [a, b]. According to the definition, any non-negative function f ¯ : [ a , b ] R + can be considered as a standard grid density function if it has only a finite number of zeros within its domain:
f ¯ ( t ) = f ( t ) a b f ( τ ) d τ
Assuming that any grid density function used for finite element refinement has been normalized, implying that its cumulative distribution function F has its domain transformed from [a, b] to [0, 1], the calculation method is as follows:
F ( t ) = 0 t f ¯ ( τ ) d τ
Clearly, F(0) = 0 and F(1) = 1. The time domain [a, b] can be normalized to [0, 1] and discretized into a grid of size N + 1 to obtain grid points t i i = 0 N , where t0 = 0 and tN = 1. Given a grid density function, the position of the i-th point in the grid can be represented as follows:
F ( t i + 1 ) F ( t i ) = 1 N
Therefore, a new finite element distribution can be generated based on this grid density function, where the density of the finite element endpoints is entirely determined by the magnitude of the density function.
As per the definition, the grid density function only needs to be non-negative (and integrable). The specific choice of the density function for calculating the grid distribution can maximize both the accuracy and efficiency of the solution. In this paper, a different approach and method are adopted for calculating and selecting the density function compared to Zhao et al. [20]. After solving with the inner method, the errors at the non-collocation points on each finite element can be determined. By comparing these errors, the distribution of errors at non-collocation points on each segment can be understood, and segments that do not meet the user-defined tolerance can be identified. Segments with large non-collocation point errors can be further refined to ensure that the discretization errors at non-collocation points on the finite elements meet the user-defined tolerance for subsequent solving processes. However, refining only in areas with large errors does not guarantee that the errors at non-collocation points across the entire time domain of the finite elements will meet the specified tolerance. Previous experimental results suggest that refining only the segments that do not meet the error criteria can lead to new non-collocation points violating the specified tolerance within previously compliant segments. Therefore, the refinement of the discretized grid update cannot simply focus on the segments containing non-collocation points that do not meet the specified tolerance after a single solving iteration.
The errors can be processed by solving with the inner method at the non-collocation points on each segment of the finite element obtained. The error rate of each segment of the finite element can be calculated by dividing the error at each non-collocation point on that segment by the sum of the absolute values of errors at all the non-collocation points on all the segments of the finite element. This ratio is denoted as e i p = e ( t i ~ ) / ( i = 1 N e ( t i ~ ) ) , i 1 , …, N, using e i p as an indicator to construct the error function e(t); e(t) is viewed as piecewise constant over the entire time domain, where its value on each segment of the finite element is denoted as e i p . Therefore, we can derive the grid density function f(t) based on the error function e(t).
f ( t ) = e ( t ) t 0 t N e ( t )
Similarly, the grid density function f(t) is also a piecewise function. Although the piecewise form of f(t) may result in some loss of accuracy during grid point allocation, compared to the density function constructed using cubic spline functions as carried out by Zhao et al. [20], the cost of computation is significantly reduced, enhancing the overall efficiency of the algorithm. Furthermore, as demonstrated in subsequent cases, it also achieves the goal of finite element refinement.
In the computation process of finite element endpoints using the grid density function, the differences in the cumulative probability density function values calculated at adjacent finite element endpoints are equal, being 1 / N . Thus, during each grid update, the updated positions of the finite element endpoints can be calculated using the density function.
This study utilizes a grid density function for solving the finite element endpoints. { t i } i = 1 N 1 represents the computed finite element endpoints, where t0 = 0 and tN = 1:
i 1 N 1 = 0 t j f ( τ ) d τ , j 2 , , N 1
According to Formula (18), the updated finite element endpoints can be calculated using the grid density function. However, the obtained distribution of finite elements cannot be directly utilized in the subsequent iterative calculations. In practical operations, the computed distribution of finite elements often fails to meet the requirements and violates the principle of finite element allocation using density functions: allocating more finite elements in regions with higher density function values. During the process of finite element endpoint calculation, the distribution of finite elements from the previous iteration affects the allocation results of the next iteration. Since the computation of grid points is determined by the cumulative probability density function, and the sizes of finite elements in each segment obtained in subsequent iterations are inconsistent, the sizes of finite elements and the cumulative probability density function are correlated. As a result, finite elements that should have been further refined may not be adequately refined because in the previous distribution of grid points, the segment was too small, causing the corresponding value of the cumulative probability density function to decrease, resulting in fewer computed finite element endpoints. This limitation prevents the further refinement of finite elements with higher density functions. Conversely, for finite elements with initially lower grid density functions, if the element lengths were larger in the previous allocation, their cumulative density function values would increase, leading to the allocation of more finite element endpoints. Based on these scenarios, this study has improved the generation of finite element endpoints. The algorithm for updating finite element endpoints is as follows:
(1)
First, record the finite element distribution obtained from the previous solution as the original distribution, as shown in Figure 2, and derive the error density function based on the errors at non-collocation points on each segment of the original distribution.
(2)
Uniformly redistribute the entire time domain without changing the number of finite elements, ensuring that the length of each segment of finite elements is equal, as illustrated in Figure 3.
(3)
Under the assumption of a uniform distribution of finite elements, construct the grid density function based on Formula (17):
f i = e ( t i ˜ ) i = 0 N ( e ( t i ˜ ) × N T f ) , i 1 , , N
(4)
Based on the values of the grid density function, calculate new finite element endpoints within the uniformly distributed finite elements using Formula (19). Record the relative positions of the new finite element endpoints within each segment of finite elements.
(5)
Map the finite element endpoints from the uniformly distributed finite elements back to the original finite element distribution based on their relative positions within each segment. This process results in the updated finite element distribution. For example, if a grid point in the ith segment within the uniformly distributed grid is located at 2/5 of that segment’s length, it will be mapped back to the non-uniform grid at the 2/5 position of the ith segment, representing the location of the newly generated grid point, as shown in Figure 4.
In the process of generating the grid density function using the error function, there may be extreme cases. For instance, when calculating the errors at non-collocation points of certain finite elements, the errors might be extremely small, leading to very small values of the grid density function for these elements. During subsequent finite element refinement, new finite element endpoints may not be allocated in these regions. While this aligns with the original intent of the density function design—allocating fewer finite elements in regions with small errors—there are too many neighboring finite elements with very small density values. However, we also want to appropriately allocate some collocation points to the finite elements that previously met the tolerance requirements for the finite element regions. Otherwise, there will be a violation of the tolerance requirements again in the regions of the finite elements that previously satisfied the user-specified tolerance. This is an undesired outcome, so
f i = f i ,   f i > σ σ m ,   f i σ
In Formula (20), if the density function is less than a specified threshold, it is replaced by a relatively small constant value to prevent finite elements that originally met the error requirements from becoming ineffective again after grid updates. In conclusion, this section presents a new approach to constructing the grid density function, improving and optimizing the process of calculating finite element endpoints using the grid density function.

5. Overall Algorithm Flow

The overall algorithm flow for selecting the number and distribution of elements in dynamic optimization problems is provided below, divided into the following stages:
(1)
Determine the initial number of elements and convert the dynamic optimization problem into a nonlinear programming problem based on a uniform distribution.
(2)
Formulate a bilevel optimization problem to determine the number of elements using the original dynamic optimization problem. Calculate the maximum error at non-collocation points for each element through the inner problem. If the errors are all less than the user-defined tolerance and the iteration count is 0, it proves that fewer elements can precisely meet the user-defined tolerance. Decrease the number of elements by 1 and return to step (1) for resolution. If the iteration count is not 0 and meets the user-defined tolerance, the number and distribution of elements for this iteration are the minimum that meets the user-defined tolerance.
(3)
Construct an error function using the errors at non-collocation points on each element. Develop a mesh density function based on the error function for refinement in the current element.
(4)
Utilize the mesh density function to update element endpoints using the element endpoint updating algorithm. Increment the iteration count by one and return to step (1) for further resolution.
The general steps outlined above can be detailed as shown in the following Figure 5. Here, l represents the number of times the grid is updated, N is the number of elements, ε is the user-defined tolerance, and ∇N is the number of elements added in each iteration process.

6. Experimental Case

To illustrate the effectiveness of the proposed method, this section addresses two dynamic optimization problems: a bifunctional catalyst blend in a tubular reactor (BCBTR) and a nonlinear continuous stirred tank reactor (NCSTR). For the BCBTR problem, the optimal control profile is influenced by the initial guess, resulting in multiple optimal solutions. Consequently, the maximum approximation error varies among different control profiles. In the case of the NCSTR problem, the complexity arises from the interdependencies among three of the four control variables [29].
Using the grid distribution generated by the density function, the inner loop method was solved 300 times. Each solving process used randomized initial guesses to enhance the credibility of the resulting grid distribution. Since the multiple solving processes are independent, the 300 runs can occur in parallel. This also reduces the computational burden. According to the research in [29], if a high-priority state variable can be found and the maximum approximation error is defined based on that state variable, the errors of other state variables can also be calculated. In contrast, the state variable selected in this study for the experimental cases below is the same as that chosen by Li et al. in [29]. All cases were executed on a system running Windows Server 2012 R2 Standard, with a CPU model: Intel(R) Xeon(R) Silver 4112 CPU, operating at a frequency of 2.60 GHz, and equipped with 64 GB of RAM.

6.1. Bifunctional Catalyst Blend in a Tubular Reactor [29]

The problem is described as in Equation (21).
max u ( t ) : x 7 ( t f ) s . t . : x ˙ 1 ( t ) = k 1 ( t ) x 1 ( t )   x ˙ 2 ( t ) = k 1 x 1 ( t ) ( k 2 ( t ) +     k 3 ( t ) ) x 2 ( t ) + k 4 ( t ) x 5 ( t )   x ˙ 3 ( t ) = k 2 ( t ) x 2 ( t )   x ˙ 4 ( t ) = k 6 x 4 ( t ) + k 5 ( t ) x 5 ( t )   x ˙ 5 ( t ) = k 3 ( t ) x 2 ( t ) + k 6 ( t ) x 4 ( t )     ( k 4 ( t ) + k 5 ( t ) + k 8 ( t )     + k 9 ( t ) ) x 5 ( t ) + k 7 ( t ) x 6 ( t )     + k 10 ( t ) x 7 ( t )   x ˙ 6 ( t ) = k 8 x 5 ( t ) k 7 ( t ) x 6 ( t )   x ˙ 7 ( t ) = k 9 x 5 ( t ) k 10 ( t ) x 7 ( t )   x ( t 0 ) = [ 1 , 0 , 0 , 0 , 0 , 0 , 0 ] T   t 0 t t f , t 0 = 0 , t f = 2000 0.6 u ( t ) 0.9
It is composed of seven differential equations, where xi, for i = 1, …, 7, represents multiple components of the state variables. The ki, for i = 1, …, 10, is defined as the cubic functions of the control variable u(t), as follows:
k i = c i , 1 + c i , 2 u ( t ) + c i , 3 u 2 ( t ) + c i , 4 u 3 ( t )
where the coefficients ci,j, j = 1, …, 4, are obtained through experiments.
To a priori determine the minimum number of time intervals without a loss of generality, we selected the state variable x7(t) for error analysis. This state variable describes the molar fraction of the product (benzene) [29]. By transforming the original optimization problem (21) into an inner problem within the bilevel method, we constructed a maximization problem for errors and solved it. The expression formula after the transformation using the bilevel method can be found in Appendix A. The results are presented in Table 1.
As shown in Table 1, as the demand for solution accuracy increases, the given tolerance gradually decreases. Consequently, the required number of time intervals to meet the tolerance also increases. The maximum errors obtained are less than the corresponding tolerance values. Furthermore, when the user-defined tolerance is set to 2 × 10−5, it takes 10 time intervals to meet the given tolerance without partitioning through the density function. After solving and utilizing the error information obtained to partition the grid using the density function, only seven finite elements are needed to meet the given tolerance. For other tolerance settings as well, the advantages of grid partitioning based on the density function in terms of solution efficiency and accuracy can be demonstrated.

6.2. A Nonlinear Continuous Stirred Tank Reactor [29]

This problem was originally proposed by Luus and further analyzed by Balsa-Canto et al. The problem is defined as in Equation (23). The controls involve the flow rates of three feed streams and the electrical power input for photochemical reactions. The system dynamics are described by several simultaneous chemical reactions [29]. This particular problem is challenging due to the highly nonlinear nature of the system and the complexity of the optimal control profiles. Transforming problem (23) into the inner problem within the bilevel method, the determination was based on the maximum approximation error of the state variable x1(t). The expression formula after the transformation using the bilevel method can be found in Appendix A. The results of the solution are presented in Table 2. The results indicate that a larger grid of discretization is required when the accuracy of the state trajectory is higher. Similarly, the advantage of the discretization grid determined using the density function-based bilevel method is particularly evident in scenarios where high precision is demanded. Moreover, the discretization grid determined by this method yields maximum errors in the inner problem that are smaller when a higher precision is required compared to the maximum errors produced by methods not utilizing the density function.
max u ( t )   x 8 ( t f ) s . t . : x ˙ 1 ( t ) = u 4 ( t ) q x 1 ( t ) 17.6 x 1 ( t ) x 2 ( t ) 23 x 1 ( t ) x 6 ( t ) u 3 ( t ) x ˙ 2 ( t ) = u 1 ( t ) q x 2 ( t ) 17.6 x 1 ( t ) x 2 ( t ) + 146 x 2 ( t ) x 3 ( t ) x ˙ 3 ( t ) = u 2 ( t ) q x 3 ( t ) 73 x 2 ( t ) x 3 ( t ) x ˙ 4 ( t ) = q x 4 ( t ) + 35.2 x 1 ( t ) x 2 ( t ) 51.3 x 4 ( t ) x 5 ( t ) x ˙ 5 ( t ) = q x 5 ( t ) + 219 x 2 ( t ) x 3 ( t ) 51.3 x 4 ( t ) x 5 ( t ) x ˙ 6 ( t ) = q x 6 ( t ) + 102 x 4 ( t ) x 5 ( t ) 23 x 1 ( t ) x 6 ( t ) u 3 ( t ) x ˙ 7 ( t ) = q x 7 ( t ) + 46 x 1 ( t ) x 6 ( t ) u 3 ( t ) x ˙ 8 ( t ) = 5.8 ( q x 1 ( t ) u 4 ( t ) ) 3.7 u 1 ( t ) 4.1 u 2 ( t ) + q ( 23 x 4 ( t ) + 11 x 5 ( t ) + 28 x 6 ( t ) + 35 x 7 ( t ) ) 5 u 3 2 ( t ) 0.09 q = ( u 1 ( t ) + u 2 ( t ) + u 4 ( t ) ) x ( t 0 ) = [ 0.1883 , 0.2507 , 0.0467 , 0.0899 , 0.1804 , 0.1394 , 0.1046 , 0 ] T   0 u 1 ( t ) 20 , 0 u 2 ( t ) 6 0 u 3 ( t ) 4 , 0 u 4 ( t ) 20 t 0 t t f , t 0 = 0 , t f = 0.2

7. Conclusions

In the process of solving dynamic optimization problems using a direct approach, the efficiency and accuracy of the solution can be enhanced by optimizing the number and distribution of finite elements during the discretization process. In this study, an improved bilevel method was utilized to select the number of finite elements, and error information generated by the inner method was used to construct a grid density function for refining the finite elements. Experimental cases have demonstrated that compared to traditional uniform distribution strategies for finite elements, the proposed approach can significantly reduce the scale of the solved problem while meeting user-specified accuracy requirements. The use of a grid density function for allocating finite elements resulted in a significantly lower number of finite elements compared to allocations without using a grid density function. For example, in Case 1, when the user-defined tolerance is set to 2 × 10 5 , the number of finite elements required to meet this tolerance using the method of Li et al. is 10. However, by utilizing the density function for allocation, only seven finite elements are needed to satisfy the user-defined tolerance. When the user-defined tolerance requirement is increased to 5 × 10 6 , using Li et al.’s method required 37 finite elements while using the density function only requires 21 finite elements.
Moreover, by enhancing the smoothing strategy for the inner method within the bilevel method, errors near zero points caused by the soft maximum function were eliminated, making the subsequent construction of the grid density function using errors at non-collocation points more precise. This improvement also increased the efficiency of solving the inner problem. However, there are areas for improvement in the method proposed in this study. In the future work, more attention can be paid to the errors of other state variables at non-configured points in order to collectively construct a joint error function, leading to a more accurate grid density function.

Author Contributions

Conceptualization, W.C.; methodology, W.C.; software, Z.W.; validation, Z.W.; formal analysis, W.C.; writing—original draft preparation, Z.W.; writing—review and editing, W.C.; supervision, W.C. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A

Case 1 transformed into the form of bilevel problem, where the inner problem is expressed as follows:
max u ( t ) : s s . t . : x ˙ 1 ( t ) = k 1 ( t ) x 1 ( t ) x ˙ 2 ( t ) = k 1 x 1 ( t ) ( k 2 ( t ) + k 3 ( t ) ) x 2 ( t ) + k 4 ( t ) x 5 ( t ) x ˙ 3 ( t ) = k 2 ( t ) x 2 ( t ) x ˙ 4 ( t ) = k 6 x 4 ( t ) + k 5 ( t ) x 5 ( t ) x ˙ 5 ( t ) = k 3 ( t ) x 2 ( t ) + k 6 ( t ) x 4 ( t ) ( k 4 ( t ) + k 5 ( t ) + k 8 ( t ) + k 9 ( t ) ) x 5 ( t ) + k 7 ( t ) x 6 ( t ) + k 10 ( t ) x 7 ( t ) x ˙ 6 ( t ) = k 8 x 5 ( t ) k 7 ( t ) x 6 ( t ) x ˙ 7 ( t ) = k 9 x 5 ( t ) k 10 ( t ) x 7 ( t ) max i { 1 , , N } { e 7 ( t ^ i ) } s = 0 x ( t 0 ) = [ 1 , 0 , 0 , 0 , 0 , 0 , 0 ] T t 0 t t f , t 0 = 0 , t f = 2000 0.6 u ( t ) 0.9
where
e 7 ( t i ˜ ) = x 7 ( t i ˜ ) x N ( t i ˜ ) , i { 1 , , N }
The outer problem involves comparing the value of s obtained from each optimization solution with the user-defined tolerance. If the tolerance is not met, the number of finite elements must be increased, and the constructed density function is then used for the distribution of the finite elements.
Case 2 transformed into the form of bilevel problem, where the inner problem is expressed as follows:
max u ( t ) : s s . t . : x ˙ 1 ( t ) = u 4 ( t ) q x 1 ( t ) 17.6 x 1 ( t ) x 2 ( t ) 23 x 1 ( t ) x 6 ( t ) u 3 ( t ) x ˙ 2 ( t ) = u 1 ( t ) q x 2 ( t ) 17.6 x 1 ( t ) x 2 ( t ) + 146 x 2 ( t ) x 3 ( t ) x ˙ 3 ( t ) = u 2 ( t ) q x 3 ( t ) 73 x 2 ( t ) x 3 ( t ) x ˙ 4 ( t ) = q x 4 ( t ) + 35.2 x 1 ( t ) x 2 ( t ) 51.3 x 4 ( t ) x 5 ( t ) x ˙ 5 ( t ) = q x 5 ( t ) + 219 x 2 ( t ) x 3 ( t ) 51.3 x 4 ( t ) x 5 ( t ) x ˙ 6 ( t ) = q x 6 ( t ) + 102 x 4 ( t ) x 5 ( t ) 23 x 1 ( t ) x 6 ( t ) u 3 ( t ) x ˙ 7 ( t ) = q x 7 ( t ) + 46 x 1 ( t ) x 6 ( t ) u 3 ( t ) x ˙ 8 ( t ) = 5.8 ( q x 1 ( t ) u 4 ( t ) ) 3.7 u 1 ( t ) 4.1 u 2 ( t ) + q ( 23 x 4 ( t ) + 11 x 5 ( t ) + 28 x 6 ( t ) + 35 x 7 ( t ) ) 5 u 3 2 ( t ) 0.09 q = ( u 1 ( t ) + u 2 ( t ) + u 4 ( t ) ) max i { 1 , , N } { e 1 ( t ^ i ) } s = 0 x ( t 0 ) = [ 0.1883 , 0.2507 , 0.0467 , 0.0899 , 0.1804 , 0.1394 , 0.1046 , 0 ] T   0 u 1 ( t ) 20 , 0 u 2 ( t ) 6   0 u 3 ( t ) 4 , 0 u 4 ( t ) 20 t 0 t t f , t 0 = 0 , t f = 0.2
where
e 1 ( t i ˜ ) = x 1 ( t i ˜ ) x N ( t i ˜ ) , i { 1 , , N }
The outer problem involves comparing the value of s obtained from each optimization solution with the user-defined tolerance. If the tolerance is not met, the number of finite elements must be increased, and the constructed density function is then used for the distribution of the finite elements.

References

  1. Wang, Y.; Boyd, S. Fast model predictive control using online optimization. IEEE Trans. Control Syst. Technol. 2009, 18, 267–278. [Google Scholar] [CrossRef]
  2. Houska, B.; Ferreau, H.J.; Diehl, M. An auto-generated real-time iteration algorithm for nonlinear MPC in the microsecond range. Automatica 2011, 47, 2279–2285. [Google Scholar] [CrossRef]
  3. Shawash, J.; Selviah, D.R. Real-time nonlinear parameter estimation using the Levenberg–Marquardt algorithm on field programmable gate arrays. IEEE Trans. Ind. Electron. 2012, 60, 170–176. [Google Scholar] [CrossRef]
  4. Cuthrell, J.E.; Biegler, L.T. Simultaneous optimization and solution methods for batch reactor control profiles. Comput. Chem. Eng. 1989, 13, 49–62. [Google Scholar] [CrossRef]
  5. Biegler, L.T. Efficient solution of dynamic optimization and NMPC problems. In Nonlinear Model Predictive Control; Birkhäuser Basel: Basel, Switzerland, 2000; pp. 219–243. [Google Scholar]
  6. Biegler, L.T.; Cervantes, A.M.; Wächter, A. Advances in simultaneous strategies for dynamic process optimization. Chem. Eng. Sci. 2002, 57, 575–593. [Google Scholar] [CrossRef]
  7. Ahmed, A.H.; Wright, K. Error estimation for collocation solution of linear ordinary differential equations. Comput. Math. Appl. 1986, 12, 1053–1059. [Google Scholar] [CrossRef]
  8. Wright, K.; Ahmed, A.H.A.; Seleman, A.H. Mesh selection in collocation for boundary value problems. IMA J. Numer. Anal. 1991, 11, 7–20. [Google Scholar] [CrossRef]
  9. Ascher, U.M.; Petzold, L.R. Projected implicit Runge–Kutta methods for differential-algebraic equations. SIAM J. Numer. Anal. 1991, 28, 1097–1120. [Google Scholar] [CrossRef]
  10. Auzinger, W.; Koch, O.; Weinmüller, E. Efficient collocation schemes for singular boundary value problems. Numer. Algorithms 2002, 31, 5–25. [Google Scholar] [CrossRef]
  11. Zadunaisky, P.E. On the estimation of errors propagated in the numerical integration of ordinary differential equations. Numer. Math. 1976, 27, 21–39. [Google Scholar] [CrossRef]
  12. Stetter, H.J. The defect correction principle and discretization methods. Numer. Math. 1978, 29, 425–443. [Google Scholar] [CrossRef]
  13. Auzinger, W.; Koch, O.; Weinmüller, E. Efficient mesh selection for collocation methods applied to singular BVPs. J. Comput. Appl. Math. 2005, 180, 213–227. [Google Scholar] [CrossRef]
  14. Wright, K. Adaptive methods for piecewise polynomial collocation for ordinary differential equations. BIT Numer. Math. 2007, 47, 197–212. [Google Scholar] [CrossRef]
  15. Vasantharajan, S.; Biegler, L.T. Simultaneous strategies for optimization of differential-algebraic systems with enforcement of error criteria. Comput. Chem. Eng. 1990, 14, 1083–1100. [Google Scholar] [CrossRef]
  16. Seferlis, P.; Hrymak, A.N. Adaptive collocation on finite elements models for the optimization of multistage distillation units. Chem. Eng. Sci. 1994, 49, 1369–1382. [Google Scholar] [CrossRef]
  17. Tanartkit, P.; Biegler, L.T. A nested, simultaneous approach for dynamic optimization problems—I. Comput. Chem. Eng. 1996, 20, 735–741. [Google Scholar] [CrossRef]
  18. Tanartkit, P.; Biegler, L.T. A nested, simultaneous approach for dynamic optimization problems—II: The outer problem. Comput. Chem. Eng. 1997, 21, 1365–1388. [Google Scholar] [CrossRef]
  19. Huntington, G.T.; Rao, A.V. Comparison of global and local collocation methods for optimal control. J. Guid. Control Dyn. 2008, 31, 432–436. [Google Scholar] [CrossRef]
  20. Zhao, Y.; Tsiotras, P. Density functions for mesh refinement in numerical optimal control. J. Guid. Control Dyn. 2011, 34, 271–277. [Google Scholar] [CrossRef]
  21. Darby, C.L.; Hager, W.W.; Rao, A.V. An hp-adaptive pseudospectral method for solving optimal control problems. Optim. Control Appl. Methods 2011, 32, 476–502. [Google Scholar] [CrossRef]
  22. Darby, C.L.; Hager, W.W.; Rao, A.V. Direct trajectory optimization using a variable low-order adaptive pseudospectral method. J. Spacecr. Rocket. 2011, 48, 433–445. [Google Scholar] [CrossRef]
  23. Paiva, L.T.; Fontes, F. Adaptive time-mesh refinement in optimal control problems with state constraints. Discret. Contin. Dyn. Syst. 2015, 35, 4553–4572. [Google Scholar] [CrossRef]
  24. Paiva, L.T.; Fontes, F. Time–mesh refinement in optimal control problems for nonholonomic vehicles. Procedia Technol. 2014, 17, 178–185. [Google Scholar] [CrossRef]
  25. Tamimi, J. Choosing the number of time intervals for solving a model predictive control problem of nonlinear systems. Trans. Inst. Meas. Control 2021, 43, 2799–2808. [Google Scholar] [CrossRef]
  26. Haman, G.V., III; Rao, A. Leveraging a Mesh Refinement Technique for Optimal Libration Point Orbit Transfers. In Proceedings of the AIAA SCITECH 2024 Forum, Orlando, FL, USA, 8–12 January 2024. [Google Scholar]
  27. Miller, A.T.; Hager, W.W.; Rao, A.V. Mesh refinement method for solving optimal control problems with nonsmooth solutions using jump function approximations. Optim. Control Appl. Methods 2021, 42, 1119–1140. [Google Scholar] [CrossRef]
  28. Huang, J.; Liu, Z.; Liu, Z.; Wang, Q.; Fu, J. A pk-adaptive mesh refinement for pseudospectral method to solve optimal control problem. IEEE Access 2019, 7, 161666–161679. [Google Scholar] [CrossRef]
  29. Lazutkin, E.; Geletu, A.; Li, P. An approach to determining the number of time intervals for solving dynamic optimization problems. Ind. Eng. Chem. Res. 2018, 57, 4340–4350. [Google Scholar] [CrossRef]
  30. Tamimi, J.; Li, P. A combined approach to nonlinear model predictive control of fast systems. J. Process Control 2010, 20, 1092–1102. [Google Scholar] [CrossRef]
  31. Chen, W.; Biegler, L.T. Nested direct transcription optimization for singular optimal control problems. AIChE J. 2016, 62, 3611–3627. [Google Scholar] [CrossRef]
  32. Lazutkin, E.; Geletu, A.; Hopfgarten, S.; Li, P. An analytical hessian and parallel-computing approach for efficient dynamic optimization based on control-variable correlation analysis. Ind. Eng. Chem. Res. 2015, 54, 12086–12095. [Google Scholar] [CrossRef]
  33. Qi, X.; Chen, W. Stiction parameter identification for pneumatic valves with a simultaneous approach. J. Process Control 2024, 140, 103269. [Google Scholar] [CrossRef]
Figure 1. Compares the smoothed absolute value function with the actual function values after smoothing.
Figure 1. Compares the smoothed absolute value function with the actual function values after smoothing.
Processes 13 01184 g001
Figure 2. Original finite element distribution.
Figure 2. Original finite element distribution.
Processes 13 01184 g002
Figure 3. Uniform finite element distribution.
Figure 3. Uniform finite element distribution.
Processes 13 01184 g003
Figure 4. Mapping relationship between finite element endpoints computed based on uniform distribution and the original distribution.
Figure 4. Mapping relationship between finite element endpoints computed based on uniform distribution and the original distribution.
Processes 13 01184 g004
Figure 5. Discretization grid update process flowchart.
Figure 5. Discretization grid update process flowchart.
Processes 13 01184 g005
Table 1. Comparison of results for tubular reactor problem.
Table 1. Comparison of results for tubular reactor problem.
ε Original Bilevel MethodBilevel Method Based on Density Functions
NemaxNemax
2 × 10 5 10 1.927 × 10 5 7 1.131 × 10 5
1 × 10 5 21 9.556 × 10 6 9 8.542 × 10 6
5 × 10 6 37 4.948 × 10 6 21 4.962 × 10 6
Table 2. Comparison of results for NCSTR problem.
Table 2. Comparison of results for NCSTR problem.
ε Original Bilevel MethodBilevel Method Based on Density Functions
NemaxNemax
1 × 10 3 8 6.228 × 10 4 8 7.125 × 10 4
1.125 × 10 4 12 1.191 × 10 4 11 9.45 × 10 6
5 × 10 6 22 4.4 × 10 6 17 1.039 × 10 7
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

Wang, Z.; Chen, W. Simultaneous Framework for Dynamic Optimization Based on Density Functions. Processes 2025, 13, 1184. https://doi.org/10.3390/pr13041184

AMA Style

Wang Z, Chen W. Simultaneous Framework for Dynamic Optimization Based on Density Functions. Processes. 2025; 13(4):1184. https://doi.org/10.3390/pr13041184

Chicago/Turabian Style

Wang, Zekai, and Weifeng Chen. 2025. "Simultaneous Framework for Dynamic Optimization Based on Density Functions" Processes 13, no. 4: 1184. https://doi.org/10.3390/pr13041184

APA Style

Wang, Z., & Chen, W. (2025). Simultaneous Framework for Dynamic Optimization Based on Density Functions. Processes, 13(4), 1184. https://doi.org/10.3390/pr13041184

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