Next Article in Journal
Zero-Inflated Generalized Linear Mixed Models: A Better Way to Understand Data Relationships
Previous Article in Journal
Information Use and the Condorcet Jury Theorem
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Data Interpolation by Near-Optimal Splines with Free Knots Using Linear Programming

by
Lakshman S. Thakur
1 and
Mikhail A. Bragin
2,*
1
Department of Operations and Information Management, School of Business, University of Connecticut, Storrs, CT 06269, USA
2
Department of Electrical and Computer Engineering, School of Engineering, University of Connecticut, Storrs, CT 06269, USA
*
Author to whom correspondence should be addressed.
Submission received: 19 April 2021 / Revised: 5 May 2021 / Accepted: 8 May 2021 / Published: 13 May 2021

Abstract

:
The problem of obtaining an optimal spline with free knots is tantamount to minimizing derivatives of a nonlinear differentiable function over a Banach space on a compact set. While the problem of data interpolation by quadratic splines has been accomplished, interpolation by splines of higher orders is far more challenging. In this paper, to overcome difficulties associated with the complexity of the interpolation problem, the interval over which data points are defined is discretized and continuous derivatives are replaced by their discrete counterparts. The l -norm used for maximum rth order curvature (a derivative of order r) is then linearized, and the problem to obtain a near-optimal spline becomes a linear programming (LP) problem, which is solved in polynomial time by using LP methods, e.g., by using the Simplex method implemented in modern software such as CPLEX. It is shown that, as the mesh of the discretization approaches zero, a resulting near-optimal spline approaches an optimal spline. Splines with the desired accuracy can be obtained by choosing an appropriately fine mesh of the discretization. By using cubic splines as an example, numerical results demonstrate that the linear programming (LP) formulation, resulting from the discretization of the interpolation problem, can be solved by linear solvers with high computational efficiency and the resulting spline provides a good approximation to the sought-for optimal spline.

1. Introduction

When an exact functional form in a model is unknown, it is often described by measurements represented by available data points and some expected assumptions about the function. Traditionally, data points were interpolated by polynomials more frequently than by spline functions. In a basic way, spline theory deals with a simple but important question of how one uses a lower degree piecewise polynomial function rather than a single larger degree polynomial to represent given data and attendant properties. Spline theory attempts to obtain appropriate problem formulations to obtain the spline, its existence and characterization of solutions, and properties and computation of such functions. While polynomials have many desirable properties, polynomial interpolation suffers from Runge’s Phenomena [1]—a polynomial oscillation at the edges of an interval. With large data, the derivatives of a single polynomial at each of the data points tend to grow, thereby resulting in multiple local extrema. In particular, it has been shown that polynomials, extensively used, for example, in thermometry [2], are not capable of recovering local behavior with good quantifiable accuracy. Spline interpolation, on the other hand, tends to greatly reduce oscillation between data points due to lower degree of polynomials. Cubic splines, with a multitude of applications, in particular, have been shown to be able to reproduce local characteristics well [2]. In addition, computationally, the problem of finding a polynomial interpolating a large number of data points is equivalent to inverting a Vandermonde matrix with a large condition number, thereby rendering the interpolation problem intractable, inefficient, and unstable in computer implementations [3]. On the other hand, the great flexibility of splines, resulting from the use of several lower degree polynomials smoothly connected at optimally chosen points (usually referred to as “knots”), resolves the major problems mentioned above effectively. In spline applications, the following features are desired: 1. representation of the function with lower degree polynomials, which leads to efficient computations as well as a good approximation of the original function, and 2. continuous or essentially bounded derivatives (often second and third derivatives in most applications, for quadratic and cubic splines, respectively). The boundedness of derivatives in the interpolation by splines is natural since one can always have a function interpolating the given point with arbitrarily high derivatives, for example, the second derivative in the context of quadratic splines. In function approximation, therefore, to estimate the most favorable possible error in function approximation, one would like to determine the smallest curvature (the second derivative) possible of a function that interpolates the points by finding the optimal quadratic spline [4].
Many important applications require interpolation by splines. The recent and ongoing COVID-19 pandemic has spurred advances in spline-related research; specifically, splines have been shown to be useful for modeling and forecasting the spread of COVID-19 [5,6,7,8], and COVID-19 trends [9]. In [10], splines were also used to analyze the relationship between the ambient temperature and the transmission of COVID-19. Moreover, splines were shown to be useful for capturing the nonlinear relationship between fasting blood glucose levels and risk of intensive care unit admission for COVID-19 patients [11] in comparison to other conventional linear, dichotomous, or categorical methods. Optimal spline with free knots as well as more recent application areas of splines will be briefly discussed in Section 2. Section 3 provides our linear programming formulation to obtain near-optimal splines with free knots interpolating a given set of data points efficiently and with the desired level of accuracy. In Section 4, numerical results will be provided to demonstrate computational efficiency of the method developed in terms of the CPU time and accuracy, including Example 1 that shows each step and all computations involved in a five-point cubic spline problem for full clarity of each step. In Section 5, concluding remarks are given.

2. Literature Review

Spline Applications. Splines have come in common use in multiple and diverse disciplines such as robotics and statistics. Cubic splines are used in the problem of coordination and planning of the robotic motion [12]. The trajectories for robot motion are frequently described by smooth cubic splines [13]. Cubic splines ( r = 3 ) are used to characterize the dependency of the Markov model statistical parameters on the conditional parameters [14]. Many filtering techniques require the use of splines. Splines are used to extract curves to model approximation to the shapes of segmented images that result from smoothing the lines of an object in the presence of its shape uncertainty [15]. In digital signal processing, splines are used to generate new sequences with a higher sampling rate (upsampling) [16]. Other recent spline applications include (1) operations research [17,18,19], (2) dynamic programming [20,21], (3) mathematical programming [22,23,24], (4) statistics [25,26,27,28,29,30,31], (5) control theory [31,32,33,34,35,36], (6) computer graphics [37,38], (7) path planning [31], and (8) portfolio selection under fluctuating interest rates [20,21].
General Overview of Optimal Splines with Free Knots. Spline functions were introduced as early as in the nineteenth century by Lobachevsky ([39], p. 165) and later by Schoenberg [40]. Since then, the subject has grown vigorously and many excellent texts are available on the subject: [25,40,41,42,43,44,45].
Studies have shown that the approximations by splines can be significantly improved if knots are allowed to be free rather than at a priori fixed locations (e.g., data points) [46]. When the knots of a spline are fixed a priori (for example, knots coincide with data points), it is called a spline with fixed knots [47,48]. When the knots are not fixed but are determined optimally, it is called a spline with free or variable knots. Generally, as one would expect, the analysis for fixed knots tends to be simpler than for free knots [25] (p. 190). A spline that is required to pass through the data points exactly when data are fairly accurate is called an interpolatory spline; otherwise, it is an approximating spline. The methods given in this section focus on optimal interpolatory splines, with free knots with cubic splines being a special case. A comparative analysis showing advantages of free-knot splines over data-smoothing techniques has been given in [49]. Typically, the degree of smoothness is controlled by both the number and the position of the knots.
It has been shown in [26] that there always exists an optimal spline with f r = k * for each polynomial comprising the spline and ( n r 1 ) knots, where n is the number of data points and r is the degree of the spline that interpolates them. It is noted that, for a given value k * , an optimal spline with f r = k * is not necessarily unique (since some of the polynomials comprising the spline (but not all) that interpolate given data points may have f r that is less than the optimal value k * ). The apparatus of the proof of the above result is complex, but a simple proof for the quadratic case r = 2 is given in [50].

3. Problem Formulation

3.1. General Problem Formulation

For a given set of data points x i , y i i = 1 n such that A = x 1 < … < x n = B, a spline function S ( x ) of degree r with the knots at x k n o t 1 , , x k n o t K is a real valued function defined on the interval [A,B] such that
(i)
S ( x ) passes through all the data points, i.e., S ( x i ) = y i ;
(ii)
In each interval A , x k n o t 1 , x k n o t 1 , x k n o t 2 , , x k n o t K , B , where K is the number of knots, S ( x ) is given by a polynomial of degree r or less;
(iii)
S ( x ) and its derivatives of orders 1 , 2 , , r 1 are continuous in the interval ( A , B ) and
(iv)
The rth derivative of S ( x ) can be discontinuous at a finite number of points.
Thus, a spline function of degree r is a piecewise polynomial function with ( r 1 ) continuous derivatives. We could also say that it is a member of C r 1 for which the rth derivative is a step function. In other words, it is an rth order indefinite integral of a step function. Polynomial pieces of a spline are “spliced” appropriately at the knots where the rth derivative jumps from one value to another (often with opposite signs), enabling it to turn or change its shape, while all derivatives up to ( r 1 ) t h order remain continuous, imparting smoothness to the spline. It should be noted that x-coordinates of given data points x i , y i i = 1 n are generally not the knot points.
The problem of finding the optimal spline of rth degree is
min f C r 1 f r = min f C r 1 max | f r |
s . t . f x i = y i ,
where x i , y i i = 1 n are given data points.
The formulation (1) and (2), though simple and elegant, is unfortunately not easy to solve. This formulation amounts to the optimization over a Banach space [51] of continuous functions on a compact set [ A , B ] , which is well-known to be notoriously difficult ([31], p. 3). Within (1) and (2), the decision variable is a function f that minimizes f r . While the problem of data interpolation by quadratic splines has been accomplished [4], interpolation by splines of higher orders is far more challenging. Our key contributions to resolve this difficulty are to consider obtaining a near-optimal solution in a computationally efficient manner, and to prove that the near-optimal splines approach optimal splines as discretization mesh is refined. This will be achieved by discretizing the entire space into segments over which the optimization is performed by replacing continuous function with their discrete counterparts and by converting the resulting problem into a linear programming problem that can be solved in polynomial time by using Simplex method [52,53,54], as will be explained next.

3.2. Linear Optimization Formulation for Near-Optimal Solution to (1) and (2)

This section presents a numerical approach for finding near-optimal splines in maximum norm space (typically referred to as L space) since we minimize f r = max | f r | . The main idea of the approach is to formulate a linear optimization problem, the solution of which approximates f r , with certain tolerance, of the optimal spline interpolating given n data points x i , y i i = 1 n .
The idea is presented by using n equidistant data points (note that in the following development of the formulation, there are no requirements of the point equidistance and the data points are not restricted to be equidistant) such that A = x 1 , B = x n and x i x i 1 = H , H > 0 , i = 2 , , n , and A , B = i = 1 n 1 x i , x i + 1 . In order to discretize the problem, we chose to divide each interval x i , x i + 1 , i = 1 , , n 1 in m subintervals of equal width. Thus, we partition interval [A, B] into l evenly spaced subintervals, where l = n 1 m . Note that the number of points defining the l subintervals is l + 1 and that the points are denoted by x ^ j j = 1 ( n 1 ) m + 1 = l + 1 , such that the relation x ^ ( i 1 ) m + 1 = x i , i = 1 , , n 1 holds between original data points x i and data points x ^ j created by subdivisions.
For example, x ^ 1 = x 1 = A , x ^ 11 = x 2 , x ^ 21 = x 3 , , x ^ ( n 1 ) m + 1 = l + 1 = x n = B . It should also be pointed out that the general formula for x ^ j is x ^ j = B j 1 l + A 1 j + l l , so that x ^ 1 = A , x ^ 2 = B l + A 1 + l l , x ^ 3 = 2 B l + A 2 + l l ,…, x ^ l + 1 = B . Additionally, while H denotes the width of each interval x i , x i + 1 specified in the data, h denotes the width of each smaller interval x ^ j , x ^ j + 1 created after m subdivisions of each interval. In other words, H = m h .
After the interval [A, B] is discretized, the derivatives are replaced by their discrete counterparts. Derivatives of a function are often approximated by finite differences. A discrete analog of the rth derivative of a continuous function is the rth order difference divided by h r . A general formula of the rth order forward difference is based on r consecutive (sub)intervals and is represented as follows [55,56,57]
Δ h r f x = i = 0 r 1 i r i f x + r i h .
Central differences δ h r [ f ] ( x ) = i = 0 r ( 1 ) i r i f x + r 2 i h provide more accurate approximations as compared to forward (or backward) differences: Δ h r f x h r = f r x + O h and δ h r f x h r = f r x + O h 2 ; thus, errors in forward differences are of the order h, while in central differences, they are of the order h 2 . Essentially, this is due to considering the values of the function at h / 2 distance away both to the left and to the right of the function in central differences rather than the entire h distance only on one side of the function in forward differences, resulting in a better approximation of the function derivative by central differences.
Briefly, the first-order difference f x + h 2 f x h 2 h divided by h can be expanded into Taylor series in the following way:
f x + h 2 f x h 2 h
f x h + f x 2 + f x 2 h + 1 48 f ( 3 ) x h 2 f x h f x 2 + f x 2 h 1 48 f ( 3 ) x h 2 =
f x + 1 24 f ( 3 ) x h 2
Additionally,
f x + h f x h f x h + f x + 1 2 f x h f x h = f x + 1 2 f x h ,
from which one can observe that f x + h 2 f x h 2 h f x = O ( h 2 ) while f x + h f x h f x = O ( h ) . Similar arguments hold for higher order finite differences.
Even though the forward difference approximates the rth derivative at x ^ j with the error of the order of O ( h ) , it approximates the rth derivative at midpoint x ^ j + 1 + x ^ j + 2 2 with the error of the order of O ( h 2 ) , as in the discussion of central differences above. Indeed, if we denote z ^ j = x ^ j + 1 + x ^ j + 2 2 , then
f x ^ j r f x ^ j + 1 + r ( r 1 ) 2 f x ^ j + 2 + + ( 1 ) r f x ^ j + 3 h r =
f z ^ j 3 h 2 r f z ^ j h 2 + r ( r 1 ) 2 f z ^ j + h 2 + + ( 1 ) r f z ^ j + 3 h 2 h r ,
which is the rth-order central difference, and therefore, the overall accuracy of the approximation is of the order of O ( h 2 ) .
Our approach to find a near-optimal solution of (1) and (2) is to minimize the maximum of the rth-order differences directly:
min f x ^ 1 , f x ^ 2 , , f x ^ ( m 1 ) n + 1 max | Δ h r f x ^ j h r | s . t . , f x ^ ( m 1 ) i + 1 = y i , i = 1 , n
Note that in this discretized version (and for the rest of the paper), points denoted by f x ^ j are decision variables, where x ^ j , j = 1 , , ( n 1 ) m + 1 are endpoints of subintervals.
Since the objective function in formulation (3) is clearly nonlinear due to m a x and absolute value operators, in order to deal with this nonlinearity, the problem is converted into an equivalent linear counterpart (similar to ([58], p. 28)):
min f x ^ 1 , f x ^ 2 , , f x ^ ( m 1 ) n + 1 k s . t . , Δ h r f x ^ j h r k , j = 1 , , l r Δ h r f x ^ j h r k , j = 1 , , l r f ( x ^ ( m 1 ) i + 1 ) = y i , i = 1 , , n
Since f x ^ ( m 1 ) i + 1 = y i are given as data, the actual decision variables to determine are f x ^ j , with the exception of f x ^ ( m 1 ) i + 1 , i = 1 , , n , although for more convenient implementation, f x ^ ( m 1 ) i + 1 can still be treated as decision variables. Additionally, due to linearity, (4) can be solved with much higher efficiency than (3); regardless of the problem instance, formulation (4) remains the LP problem and the LP optimization methods converge within the polynomial time, as discussed above. The reduction of complexity is generally the goal of all linearization processes used to deal with nonlinearity from a computational perspective.
Theorem 1.
The optimal value of formulation (4) approaches k * , which is the optimal value of the formulation (1) and (2), as the number of subintervals approaches infinity m .
Proof. 
As established above, formulation (4)
min f x ^ 1 , f x ^ 2 , , f x ^ ( m 1 ) n + 1 k s . t . , Δ h r f x ^ j h r k , j = 1 , , l r Δ h r f x ^ j h r k , j = 1 , , l r f x ^ ( m 1 ) i + 1   =   y i , i = 1 , n
is equivalent to formulation (3):
min f x ^ 1 , f x ^ 2 , , f x ^ ( m 1 ) n + 1 max Δ h r f x ^ j h r s . t . , f x ^ ( m 1 ) i + 1   =   y i , i = 1 , n
As the number of subintervals approaches infinity m , the third-order difference approaches the third derivative, so formulation (4) becomes
min f x ^ 1 , f x ^ 2 , max f 3 x ^ j s . t . , f x i   =   y i , i = 1 , n
Despite having the same objective function, formulation (5) is theoretically not equivalent to the formulation of the original problem (1) and (2). Any countable (even infinitely countable) set of decision variables f x ^ j is a set of measure zero (a set of points that can be enclosed by intervals with arbitrarily small width), whereas the space over which problem (1) and (2) is optimized is continuous, namely, the entire interval A , B . In other words, formulations (1) and (2), and (5), though they have the same objective function, are optimized over different decision variable spaces, namely, discrete and continuous, respectively.
Notwithstanding the differences between formulations (1) and (2), and (5) noted above, their respective optimal values differ by an infinitesimally small value as the number of subintervals approaches infinity. Indeed, for an arbitrarily small ε > 0 , we can always find a large enough m, the number of subintervals (of each interval), such that x ^ j x ^ j + 1 < ε . Since the third derivative of f exists almost everywhere for a cubic spline by definition, we can define central differences at the midpoints of each subinterval x ^ j , x ^ j + 1 as δ h r f x ^ j + x ^ j + 1 2 h r = f 3 x + O h 2 . Now, as explained before, note that
δ h r f x ^ j + x ^ j + 1 2 h r = Δ h r f x ^ j 1 h r
Therefore, the optimal solution to (5) differs from the optimal solutions by a quantity of the order of O h 2 . In other words, for any two arbitrarily close decision variables f x ^ j and f x ^ j + 1 , the respective third derivative of f evaluated at any point between them differs from the third derivative evaluated at either of these points by a quantity that is arbitrary small except possibly at the points of discontinuity of f r , which constitute a set of measure zero since f r exists almost everywhere. Therefore, respective optimal values of formulations (5)
min f x ^ 1 , f x ^ 2 , max | f ( r ) x ^ j | s . t . f x i   =   y i , i = 1 , , n
and (1) and (2)
min f C 2 f r s . t . f x i = y i
differ by a quantity of the order of O h 2 . □

4. Numerical Testing

The algorithms described above were implemented in CPLEX on an Intel Core i7 CPU Q 720 at 1.60 GHz and 4.00 GB RAM (see the CPLEX code in Appendix A).

4.1. Numerical Examples

In this section, five examples are presented. Example 1 provides a step by step walk-through of the algorithm. Examples 2–4 illustrate the performance of the algorithm in terms of the CPU time for different test functions. Scalability as well as accuracy results are presented in Example 5. In addition, Example 5 gives computational evidence that the optimal value of formulation (4) approaches the optimal value of (1) and (2) as O h 2 .
Example 1.
Walk-Through Example. Consider a problem with five data points: ( x 1 = 1, y 1 = 3), ( x 2 = 2, y 2 = 5), ( x 3 = 3, y 3 = 4.5), ( x 4 = 4, y 4 = 6.6), and ( x 5 = 5, y 5 = 2.6) and let r = 3 . We want to find a near-optimal cubic spline while illustrating all steps of the formulation very clearly and providing all basic details.
We divide each interval into two subintervals, so n = 5 , m = 2 ,   l = ( n 1 ) m = 8 and h = 0.5 with the resulting subintervals [ x ^ 1 , x ^ 2 ] = [ 1 , 1.5 ], [ x ^ 2 , x ^ 3 ] = [ 1.5 , 2 ], [ x ^ 3 , x ^ 4 ] = [ 2 , 2.5 ], [ x ^ 4 , x ^ 5 ] = [ 2.5 , 3 ], [ x ^ 5 , x ^ 6 ] = [ 3 , 3.5 ], [ x ^ 6 , x ^ 7 ] = [ 3.5 , 4 ], [ x ^ 7 , x ^ 8 ] = [ 4 , 4.5 ], and [ x ^ 8 , x ^ 9 ] = [ 4.5 , 5 ]. Note that some of the x ^ j , j = 1 , , 9 are problem data values x i , i = 1 , , 5 : x ^ 1 = x 1 , x ^ 3 = x 2 , x ^ 5 = x 3 , x ^ 7 = x 4 , and x ^ 9 = x 5 . Formulation (4) takes the following form:
min f x ^ 1 , f x ^ 2 , f x ^ 3 , f x ^ 4 , f x ^ 5 , f x ^ 6 , f x ^ 7 , f x ^ 8 , f x ^ 9 k s . t . k f x ^ 1 3 f x ^ 2 + 3 f x ^ 3 f x ^ 4 0.5 3 k ; k f x ^ 2 3 f x ^ 3 + 3 f x ^ 4 f x ^ 5 0.5 3 k ; k f x ^ 3 3 f x ^ 4 + 3 f x ^ 5 f x ^ 6 0.5 3 k ; k f x ^ 4 3 f x ^ 5 + 3 f x ^ 6 f x ^ 7 0.5 3 k ; k f x ^ 5 3 f x ^ 6 + 3 f x ^ 7 f x ^ 8 0.5 3 k ; k f x ^ 6 3 f x ^ 7 + 3 f x ^ 8 f x ^ 9 0.5 3 k ; f x ^ 1   =   y 1 = 3 ; f x ^ 3   =   y 2 = 5 ; f x ^ 5   =   y 3 = 4.5 ; f x ^ 7   =   y 4 = 6.6 ; f x ^ 9 = y 5 = 2.6 ;
where x ^ 1 = x 1 , x ^ 2 = x 1 + x 2 2 , x ^ 3 = x 2 , x ^ 4 = x 2 + x 3 2 , x ^ 5 = x 3 , x ^ 6 = x 3 + x 4 2 , x ^ 7 = x 4 , x ^ 8 = x 4 + x 5 2 , and x ^ 9 = x 5 . The decision variables are: f x ^ 1 , f x ^ 2 , f x ^ 3 , f x ^ 4 , f x ^ 5 , f x ^ 6 , f x ^ 7 , f x ^ 8 , and f x ^ 9 , but f x ^ 1 , f x ^ 3 , f x ^ 5 , f x ^ 7 and f x ^ 9 are known to be y 1 , y 2 , y 3 , y 4 and y 5 , respectively, so the actual decision variables are only f x ^ 2 , f x ^ 4 , f x ^ 6 , and f x ^ 8 . The solution is f ( x ^ 2 ) = 4.9625 , f ( x ^ 4 ) = 4.4125 , f ( x ^ 6 ) = 5.6625 , f ( x ^ 8 ) = 6.0125 , and k = 10.4 .
Figure 1 and Figure 2 present a near-optimal cubic spline, and the cubic polynomials comprising the spline. The splines are represented by discrete points, interpolating the above data points by using m = 10 .
Example 2.
Exponential Function. Consider a problem with n = 20 and m = 50 and a “test” function f ( x ) = e x / 10 .
Example 3.
Trigonometric Function. Consider a problem with n = 20 and m = 50 and a “test” function f ( x ) = s i n ( x ) .
Example 4.
Polynomial Function. Consider a problem with n = 20 and m = 50 and a “test” function:
f x = 98,442 34,295 + 2725 157,757 x + 97,012 788,785 x 2 8448 788,785 x 3 , x 8.125
f x = 6,798,459 34,295 + 671,965 157,757 x 314,828 788,785 x 2 + 8448 788,785 x 3 , x > 8.125
After being discretized, functions f within Examples 2–4 can be represented as 20 points x i , y i i = 1 20 , which are shown in Table 1. Note that in most practical cases, the exact functional form in which the cubic spline is used to approximate is not necessarily polynomial and is unknown, so the optimal k * of optimal splines interpolating given points may differ from the exact k of given test functions (see Table 2). When the test function is polynomial, the optimal k * is very close to the exact k (see Example 5).

4.2. Scalability Results

To test scalability of our approach, formulation (1) and (2) is used to test problems with varying number of subintervals. The computation times are summarized in Table 3.
Example 5.
Scalability and Accuracy Testing. Consider five data points (1, 4); (2, 15); (3, 39.75); (4, 78.25); and (5, 124.75) chosen in such a way that the optimal spline has the known value of a third derivative equal to 6.
As one can see in Table 3, the algorithm scales well since increase in the computation time is almost linear for the number of subintervals. Moreover, as the number of subintervals doubles, the accuracy increases (the gap, the relative difference between k ^ and k * , decreases) by roughly four times.

4.3. Comparison with Other Methods

Our method is compared with the methods implemented in MATLAB R2021a by using data for Example 1. With a mesh of discretization of 0.01, the default spline interpolation [59] computes splines within 0.0156 seconds and obtains the l -norm (max norm) of the third derivative of 12.15, while our method computed splines within 0.071 seconds and obtains the third derivative of 10.767, which is 12.84% lower than the value obtained by MATLAB. The spline interpolation with “optimal” knots [60] obtains the knot location at x = 3, which is one of the data points, and the l -norm of the third derivative is the same as that obtained within [59]. The difference is explained by the fact that results in [60] are motivated by works as in [47,48]; therefore, optimality is with respect to knots selected from an a priori given points, while within our method, the position of knots is not restricted as being fixed, thereby leading to a lower objective function.

5. Conclusions

Used in very diverse areas of applications, classical data interpolation by a general spline with free knots is formulated as a linear programming problem to minimize spline l -norm (max norm) of the derivative of order r, for reduced complexity, and the problem is efficiently solved by using linear programming solvers. Theoretical convergence to the true optimal splines is proven, indicating that the interpolatory data points obtained by solving the LP problem are arbitrarily close to the points on the true optimal splines. Testing results based on cubic interpolatory splines provide good approximations to optimal splines within a fast computation time. The main benefit of the new method is the significant reduction in complexity to obtain near-optimal splines with near-optimal curvature. Another advantage is that the method has a potential to be generalizable for 2D dimensional (and higher) cases, whereby “interpolatory surfaces” can be obtained by using 2D finite differences. Moreover, as indicated in the Introduction section, since the splines are expected to recover local behavior with good quantifiable accuracy, the proposed method is suitable for finding local as well as global minima of the implied underlying function quickly. The complexity involved in finding a global optimum of the resulting spline based on “merge sort” is “subquadratic” O ( n · l o g ( n ) ) . A limitation of this study is that the near-optimal position of knots cannot be efficiently obtained in online implementations since the method only outputs points belonging to the near-optimal splines, although near-optimal positions of knots can be estimated offline based on the points where the third derivative (for cubic splines) changes its sign. Future research will be to obtain an exact functional representation of the optimal splines as well as the exact positions of the knots.

Author Contributions

Conceptualization, L.S.T.; methodology, M.A.B.; validation, M.A.B.; investigation, L.S.T. and M.A.B.; writing–original draft preparation, L.S.T. and M.A.B.; software, M.A.B.; writing–review and editing, L.S.T. and M.A.B. All authors have read and agreed to the published version of the manuscript.

Funding

School of Business Summer Research grant, University of Connecticut.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A. CPLEX Code

  • For illustrative purposes, the CPLEX code is provided for Example 3:
  • //Data File For Example 3
  • nbData = 20;
  • nbPoints = 30;
  • xmin = −100;
  • xmax = 100;
  • kmin = 0;
  • kmax = 100;
  • DataPoints = [0.841470985, 0.909297427, 0.141120008, −0.756802495, −0.958924275, −0.279415498, 0.656986599, 0.989358247, 0.412118485, −0.544021111, −0.999990207, −0.536572918, 0.420167037, 0.990607356, 0.65028784, −0.287903317, −0.961397492, −0.750987247, 0.14987721, 0.912945251];
  • //Main Model
  • int nbPoints = …;
  • int nbData = …;
  • int xmin = …;
  • int xmax = …;
  • int kmin = …;
  • int kmax = …;
  • range points = 1..nbData;
  • range t = 1..(nbData - 1)*nbPoints+1;
  • dvar float x[t] in xmin..xmax;
  • dvar float k in kmin..kmax;
  • float DataPoints[points] = …;
  • minimize k;
  • subject to {
  • forall (p in points) x[nbPoints*(p-1)+1] == DataPoints[p];
  • forall (t in 1..(nbData - 1)*nbPoints-2)
  • (x[t]-3*x[t+1]+3*x[t+2]-x[t+3])*nbPoints*nbPoints*nbPoints<=k;
  • forall (t in 1..(nbData - 1)*nbPoints-2)
  • (x[t]-3*x[t+1]+3*x[t+2]-x[t+3])*nbPoints*nbPoints*nbPoints>=-k;}

References

  1. Runge, C. Über empirische Funktionen und die Interpolation zwischen äquidistanten Ordinaten. Z. Math. Phys. 1901, 46, 224–243. [Google Scholar]
  2. Ciarlini, P.; Ichim, D. Free-knot cubic spline modelling in cryogenic thermometer calibration. Measurement 2006, 39, 815–820. [Google Scholar] [CrossRef]
  3. Lundengård, K. Generalized Vandermonde matrices and determinants in electromagnetic compatibility. Ph.D. Thesis, Mälardalen University, Vasteras, Sweden, 2018. [Google Scholar]
  4. Thakur, L.S. A direct algorithm for optimal quadratic splines. Numer. Math. 1990, 57, 313–332. [Google Scholar] [CrossRef]
  5. Demertzis, K.; Tsiotas, D.; Magafas, L. Modeling and forecasting the COVID-19 temporal spread in Greece: An exploratory approach based on complex network defined splines. Int. J. Environ. Res. Public Health 2020, 17, 4693. [Google Scholar] [CrossRef]
  6. Kounchev, O.; Simeonov, G.; Kuncheva, Z. The tvbg-seir spline model for analysis of covid-19 spread, and a tool for prediction scenarios. arXiv 2020, arXiv:2004.11338. [Google Scholar]
  7. Roy, A.; Karmakar, S. Bayesian semiparametric time varying model for count data to study the spread of the COVID-19 cases. arXiv 2020, arXiv:2004.02281. [Google Scholar]
  8. Appadu, A.R.; Kelil, A.S.; Tijani, Y.O. Comparison of some forecasting methods for COVID-19. Alex. Eng. J. 2021, 60, 1565–1589. [Google Scholar] [CrossRef]
  9. Agiwal, V.; Kumar, J.; Yip, Y.C. Study the trend pattern in COVID-19 using spline-based time series model: A bayesian paradigm. Preprints 2020. [Google Scholar] [CrossRef]
  10. Wang, M.; Jiang, A.; Gong, L.; Luo, L.; Guo, W.; Li, C.; Zheng, J.; Li, C.; Yang, B.; Zeng, J.; et al. Temperature significant change COVID-19 Transmission in 429 cities. medRxiv 2020. [Google Scholar] [CrossRef] [Green Version]
  11. Alahmad, B.; Al-Shammari, A.A.; Bennakhi, A.; Al-Mulla, F.; Ali, H. Fasting blood glucose and COVID-19 severity: Nonlinearity matters. Diabetes Care 2020, 43, 3113–3116. [Google Scholar] [CrossRef]
  12. Kolter, J.Z.; Ng, A.Y. Task-space trajectories via cubic spline optimization. In Proceedings of the 2009 IEEE International Conference on Robotics and Automation, Kobe, Japan, 12–17 May 2009; pp. 1675–1682. [Google Scholar]
  13. Das, A.; Naroditsky, O.; Zhiwei, Z.; Samarasekera, S.; Kumar, R. Robust visual path following for heterogeneous mobile platforms. In Proceedings of the 2010 IEEE International Conference on Robotics and Automation, Anchorage, AK, USA, 3–7 May 2010; pp. 2431–2437. [Google Scholar]
  14. Yu, D.; Deng, L.; Gong, Y.; Acero, A. A novel framework and training algorithm for variable-parameter hidden Markov models. IEEE Trans. Audio Speech Lang. Process. 2009, 17, 1348–1360. [Google Scholar]
  15. Christopoulos, V.; Schrater, P. Handling shape and contact location uncertainty in grasping two-dimensional planar objects. In Proceedings of the 2007 IEEE/RSJ International Conference on Intelligent Robots and Systems, San Diego, CA, USA, 29 October–2 November 2007; pp. 1557–1563. [Google Scholar]
  16. Mitra, S.K. Digital Signal Processing-A Computer Based Approach, 3rd ed.; McGraw-Hill: New York, NY, USA, 2005. [Google Scholar]
  17. Chen, V.C.; Ruppert, D.; Shoemaker, C.A. Applying experimental design and regression splines to high-dimensional continuous-state stochastic dynamic programming. Oper. Res. 1999, 47, 38–53. [Google Scholar] [CrossRef]
  18. De Farias, D.P.; Van Roy, B. The linear programming approach to approximate dynamic programming. Oper. Res. 2003, 51, 850–865. [Google Scholar] [CrossRef] [Green Version]
  19. Alizadeh, F.; Eckstein, J.; Noyan, N.; Rudolf, G. Arrival rate approximation by nonnegative cubic splines. Oper. Res. 2008, 56, 140–156. [Google Scholar] [CrossRef] [Green Version]
  20. Pflüger, D.; Schober, P.; Valentin, J. Solving high-dimensional dynamic portfolio choice models with hierarchical B-splines on sparse grids. SSRN 2019. [Google Scholar] [CrossRef]
  21. Kirkby, L.; Deng, S. Swing option pricing by dynamic programming with b-spline density projection. Int. J. Theor. Appl. Financ. 2020, 22, 1950038. [Google Scholar] [CrossRef]
  22. Séguin, S.; Côté, P.; Audet, C. Self-scheduling short-term unit commitment and loading problem. IEEE Trans. Power Syst. 2016, 31, 133–142. [Google Scholar] [CrossRef]
  23. Rodriguez Sarasty, J.A. Mixed-Integer Programming Approaches for Hydropower Generator Maintenance Scheduling. Ph.D. Thesis, École Polytechnique de Montréal, Montreal, QC, Canada, 2018. [Google Scholar]
  24. Venter, J.V. Variable Selection in Logistic Regression Using Exact Optimisation Approaches. Ph.D. Thesis, North-West University, Potchefstroom, South Africa, 2020. [Google Scholar]
  25. Nurnberger, G. Approximation by Spline Functions; Springer: Berlin/Heidelberg, Germany, 1989. [Google Scholar]
  26. Karlin, S. Interpolation properties of generalized perfect splines and the solutions of certain Extremal problems. Trans. Am. Math. Soc. 1975, 206, 25–66. [Google Scholar] [CrossRef]
  27. Gauthier, J.; Wu, Q.V.; Gooley, T.A. Cubic splines to model relationships between continuous variables and outcomes: A guide for clinicians. Bone Marrow Transplant. 2020, 55, 675–680. [Google Scholar] [CrossRef] [Green Version]
  28. Shepherd, B.E.; Rebeiro, P.F. Assessing and interpreting the association between continuous covariates and outcomes in observational studies of HIV using splines. J. Acquir. Immune Defic. Syndr. 2017, 74, e60. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  29. Minniakhmetov, I.; Dimitrakopoulos, D.; Godoy, M. High-order spatial simulation using Legendre-like orthogonal splines. Math. Geosci. 2018, 50, 753–780. [Google Scholar] [CrossRef] [Green Version]
  30. Tian, Y.; Baro, E.; Zhang, R. Performance evaluation of regression splines for propensity score adjustment in post-market safety analysis with multiple treatments. J. Biopharm. Stat. 2019, 29, 810–821. [Google Scholar] [CrossRef]
  31. Egerstedt, M.B.; Martin, C.F. Control Theoretic Splines: Optimal Control, Statistics, and Path Planning; Princeton University Press: Princeton, NJ, USA, 2009. [Google Scholar]
  32. Kano, H.; Egerstedt, M.; Nakata, H.; Martin, C.F. B-splines and control theory. Appl. Math. Comput. 2003, 145, 263–288. [Google Scholar] [CrossRef]
  33. Zhang, Z.; Tomlinson, J.; Martin, C. Splines and linear control theory. Acta Appl. Math. 1997, 49, 1–34. [Google Scholar] [CrossRef]
  34. Sun, S.; Egerstedt, M.B.; Martin, C.F. Control theoretic smoothing splines. IEEE Trans. Autom. Control. 2000, 45, 2271–2279. [Google Scholar] [CrossRef]
  35. Balseiro, P.; Cabrera, A.; Stuchi, T.J.; Koiller, J. About simple variational splines from the Hamiltonian viewpoint. arXiv 2017, arXiv:1711.02773. [Google Scholar] [CrossRef] [Green Version]
  36. Lai, S.; Lan, M.; Gong, K.; Chen, B.M. Axis-coupled trajectory generation for chains of integrators through smoothing splines. Control. Theory Technol. 2019, 17, 48–61. [Google Scholar] [CrossRef]
  37. Samreen, S.; Sarfraz, M.; Jabeen, N.; Hussain, M.Z. Computer aided design using a rational quadratic trigonometric spline with interval shape control. In Proceedings of the 2017 International Conference on Computational Science and Computational Intelligence (CSCI), Las Vegas, NV, USA, 14–16 December 2017; pp. 246–251. [Google Scholar]
  38. Ibraheem, F.; Hussain, M.Z. Visualization of Constrained Data Using Trigonometric Splines. In Proceedings of the 2017 21st International Conference Information Visualisation (IV), London, UK, 11–14 July 2017; pp. 400–404. [Google Scholar]
  39. Renyi, A. Wahrscheinlichkeitsrechnung; VEB Deutscher Verlag der Wissenschaften: Berlin, Germany, 1962. [Google Scholar]
  40. Schoenberg, I.J. Approximations with Special Emphasis on Spline Functions; Academic Press: New York, NY, USA, 1969. [Google Scholar]
  41. Ahlberg, J.H.; Nilson, E.N.; Walsh, J.L. The Theory of Splines and Their Applications; Mathematics in Science and Engineering; Academic Press: New York, NY, USA, 1967; Volume 38. [Google Scholar]
  42. Greville, T.N.E. Introduction to Spline Functions. In Theory and Applications of Spline Functions; University of Wisconsin: Madison, WI, USA; Academic Press: New York, NY, USA, 1969; pp. 1–35. [Google Scholar]
  43. De Boor, C. A Practical Guide to Splines; Springer: New York, NY, USA, 1978. [Google Scholar]
  44. Schumaker, L.L. Spline Functions: Basic Theory; Wiley: New York, NY, USA, 1981. [Google Scholar]
  45. Dierckx, P. Curve and Surface Fitting with Splines; Clarendon Press: Oxford, UK, 1995. [Google Scholar]
  46. Suchomski, P. Method of optimal variable-knot spline interpolation in the l2 discrete norm. Int. J. Syst. Sci. 1991, 22, 2263–2274. [Google Scholar] [CrossRef]
  47. Gaffney, P.W.; Powell, M.J.D. Optimal interpolation. In Numerical Analysis; Watson, G.A., Ed.; Lecture Notes in Mathematics; No. 506; Springer: Berlin/Heidelberg, Germany, 1976; pp. 90–99. [Google Scholar]
  48. Micchelli, C.A.; Rivlin, T.J.; Winograd, S. The optimal recovery of smooth functions. Numer. Math. 1974, 80, 903–906. [Google Scholar] [CrossRef]
  49. Gervini, D. Free-knot spline smoothing for functional data. J. R. Stat. Soc. Ser. B Stat. Methodol. 2006, 68, 671–687. [Google Scholar] [CrossRef]
  50. Thakur, L.S. Uniformly Extremal Solutions in Sobolev Function Spaces for the Quadratic Case: Characterization and Applications. SIAM J. Optim. 1993, 3, 236–247. [Google Scholar] [CrossRef]
  51. Banach, S. Théorie des Opérations Linéaires [Theory of Linear Operations]; Funduszu Kultury Narodowej: Warszawa, Poland, 1932. [Google Scholar]
  52. Khachiyan, L.G. A polynomial algorithm in linear programming. Dokl. Akad. Nauk SSSR 1979, 20, 191–194. (In Russian) [Google Scholar] [CrossRef]
  53. Khachiyan, L.G. Polynomial algorithms in linear programming (Zhurnal Vychisitel’noi Matematiki i Matematicheskoi Fiziki). USSR Comput. Math. Math. Phys. 1980, 20, 53–72. (In Russian) [Google Scholar] [CrossRef]
  54. Spielman, D.A.; Teng, S.H. Smoothed analysis of algorithms: Why the simplex algorithm usually takes polynomial time. J. ACM (JACM) 2004, 51, 385–463. [Google Scholar] [CrossRef]
  55. Boole, G.A. A Treatise on The Calculus of Finite Differences, 2nd ed.; Macmillan and Company: New York, NY, USA, 1872. [Google Scholar]
  56. Levy, H.; Lessman, F. Finite Difference Equations; Dover Publications: Mineola, NY, USA, 1992. [Google Scholar]
  57. Hildebrand, F.B. Finite-Difference Equations and Simulations; Prentice-Hall: Englewood Cliffs, NJ, USA, 1968. [Google Scholar]
  58. Luenberger, D.G. Linear and Nonlinear Programming; Addison-Wesley: Reading, MA, USA, 1984. [Google Scholar]
  59. Available online: https://www.mathworks.com/help/matlab/ref/spline.html (accessed on 29 April 2021).
  60. Available online: https://www.mathworks.com/help/curvefit/how-to-choose-knots.html (accessed on 29 April 2021).
Figure 1. Near-optimal cubic spline for Example 1 with m = 10 .
Figure 1. Near-optimal cubic spline for Example 1 with m = 10 .
Mathematics 09 01099 g001
Figure 2. Polynomials comprising the near-optimal cubic spline for Example 1 with m = 10 .
Figure 2. Polynomials comprising the near-optimal cubic spline for Example 1 with m = 10 .
Mathematics 09 01099 g002
Table 1. Data for Examples 2–4.
Table 1. Data for Examples 2–4.
xExample 2Example 3Example 4
x 1 = 1 y 1 = 1.1051 y 1 = 0.8415 y 1 = 3
x 2 = 2 y 2 = 1.2214 y 2 = 0.9093 y 2 = 3.3113
x 3 = 3 y 3 = 1.3498 y 3 = 0.1411 y 3 = 3.74
x 4 = 4 y 4 = 1.4918 y 4 = −0.757 y 4 = 4.2219
x 5 = 5 y 5 = 1.6487 y 5 = −0.959 y 5 = 4.6928
x 6 = 6 y 6 = 1.8221 y 6 = −0.279 y 6 = 5.0883
x 7 = 7 y 7 = 2.0137 y 7 = 0.6570 y 7 = 5.3443
x 8 = 8 y 8 = 2.2255 y 8 = 0.9894 y 8 = 5.3963
x 9 = 9 y 9 = 2.4596 y 9 = 0.4121 y 9 = 5.1947
x 10 = 10 y 10 = 2.7183 y 10 = −0.5440 y 10 = 4.7732
x 11 = 11 y 11 = 3.0042 y 11 = −1 y 11 = 4.196
x 12 = 12 y 12 = 3.3201 y 12 = −0.537 y 12 = 3.5274
x 13 = 13 y 13 = 3.6693 y 13 = 0.4202 y 13 = 2.8317
x 14 = 14 y 14 = 4.0552 y 14 = 0.9906 y 14 = 2.1731
x 15 = 15 y 15 = 4.4817 y 15 = 0.6503 y 15 = 1.6159
x 16 = 16 y 16 = 4.9530 y 16 = −0.288 y 16 = 1.2244
x 17 = 17 y 17 = 5.4739 y 17 = −0.961 y 17 = 1.0628
x 18 = 18 y 18 = 6.0496 y 18 = −0.751 y 18 = 1.1953
x 19 = 19 y 19 = 6.6859 y 19 = 0.1499 y 19 = 1.6863
x 20 = 20 y 20 = 7.3890 y 20 = 0.9129 y 20 = 2.6
Table 2. Computed optimal values and CPU time for Examples 2–4.
Table 2. Computed optimal values and CPU time for Examples 2–4.
CPU Time (s) k ^ Actual k
Example 2 (Exp.)0.250.00620.0073891
Example 3 (Sine)0.240.89471
Example 4 (Polyn.)0.20.06450.0642609
Table 3. Scalability results for Example 5.
Table 3. Scalability results for Example 5.
No. of Sub-Intervals (m) k ^ k * k ^ k * CPU Time (s)
25.754.17%0.05
45.935481.08%0.05
85.983730.27%0.03
165.995920.07%0.03
325.998980.02%0.04
645.999740.00%0.08
1285.999930.00%0.22
2565.999880.00%0.38
5125.999990.00%0.27
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Thakur, L.S.; Bragin, M.A. Data Interpolation by Near-Optimal Splines with Free Knots Using Linear Programming. Mathematics 2021, 9, 1099. https://0-doi-org.brum.beds.ac.uk/10.3390/math9101099

AMA Style

Thakur LS, Bragin MA. Data Interpolation by Near-Optimal Splines with Free Knots Using Linear Programming. Mathematics. 2021; 9(10):1099. https://0-doi-org.brum.beds.ac.uk/10.3390/math9101099

Chicago/Turabian Style

Thakur, Lakshman S., and Mikhail A. Bragin. 2021. "Data Interpolation by Near-Optimal Splines with Free Knots Using Linear Programming" Mathematics 9, no. 10: 1099. https://0-doi-org.brum.beds.ac.uk/10.3390/math9101099

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