Mathematical programming formulations for piecewise polynomial functions

This paper studies mathematical programming formulations for solving optimization problems with piecewise polynomial (PWP) constraints. We elaborate on suitable polynomial bases as a means of efficiently representing PWPs in mathematical programs, comparing and drawing connections between the monomial basis, the Bernstein basis, and B-splines. The theory is presented for both continuous and semi-continuous PWPs. Using a disjunctive formulation, we then exploit the characteristic of common polynomial basis functions to significantly reduce the number of nonlinearities, and to suggest a bound-tightening technique for PWP constraints. We derive several extensions using Bernstein cuts, an expanded Bernstein basis, and an expanded monomial basis, which upon a standard big-M reformulation yield a set of new MINLP models. The formulations are compared by globally solving six test sets of MINLPs and a realistic petroleum production optimization problem. The proposed framework shows promising numerical performance and facilitates the solution of PWP-constrained optimization problems using standard MINLP software.

We consider optimization problems where either or both of the objective function and a subset of the constraints are piecewise polynomial functions. Each polynomial may be nonconvex, and the piecewise polynomial function itself lower semi-continuous. There exist few targeted optimization methods for this class of optimization problems, while some approaches that exploit special structures of nonsmooth optimization problems are applicable, subject to certain modification methods: Womersley and Fletcher [62] developed a descent method for solving composite nonsmooth problems consisting of a finite number of smooth functions. Conn and Mongeau [8] constructed a method based on non-differentiable penalty functions for solving discontinuous piecewise linear optimization problems, sketching an extension to problems with PWP constraints. Scholtes [47] developed an active-set method for dealing with nonlinear programs (NLPs) with underlying combinatorial structure in the constraints. Li [30] used a conjugated gradient method for minimizing an unconstrained, strictly convex, quadratic spline. None of these methods are currently available in standard optimization software.
From a broader perspective, applicable solution approaches to PWP optimization problems include methods based on general nonsmooth optimization, smoothing techniques and mixed integer programming (MIP). Bundle-type and subgradient methods [21], originally developed for nonsmooth convex optimization, may be applied to optimization problems with general nonsmooth structures such as PWPs through Clark's generalized gradients [48]. These generalized methods for nonsmooth optimization are known to have poor convergence properties for nonconvex structures [47]. Smoothing techniques for nonsmooth functions encompass a variety of techniques, seeking to ensure sufficient smoothness for gradient-based methods [64]. Many of these methods are, however, designed for optimizing a nonsmooth function on a convex set, e.g [7,38]. Meanwhile, smoothing techniques for discontinuities by means of step-function approximations (e.g. [64]) are known to be prone to numerical instabilities, particularly for increasing accuracies of the discontinuity [8,60]. Exploitation of MIP for solving PWP optimization problems beyond complete approximative linearization [37] and direct solution as a nonconvex mixed integer nonlinear programming (MINLP) problem appears to be limited.
We adopt disjunctive representations of PWP constraints, drawing upon the extensive work on disjunctive programming (DP) formulations and representation of piecewise linear (PWL) functions [1,39,50,54]. Modeling piecewise functions as disjunctions enables application of MIP techniques, or specialized branch-and-bound or branch-and-cut schemes with a set condition for representing the piecewise constraints [2,28,39]. While adopting MIP techniques and formulations for solving PWP-constrained optimization problems facilitates exploitation of advancements in global optimization solvers [35,36,57], careful constraint formulations are required to overcome the inherent problem complexity. To this end, polynomial spline formulations [49] such as the B-spline is an attractive approach. Polynomial splines are constructed from overlapping (piecewise) polynomials with local support, and embodies a versatile set of techniques for modeling PWPs with favorable smoothness and numerical properties. For decades, polynomial splines, which we simply refer to as splines in this paper, have played an important role in function approximation and geometric modeling. In particular, they have been popular as nonlinear basis functions in regression problems [12,20], for example in kernel methods [22,63], and in finite element methods [23]. Yet, few references [5,15] apply splines within mathematical programming beyond the optimization of spline design parameters [45,59], trajectory optimization [18,34,43], and optimization of piecewise linear splines [33].
The availability of spline-compatible optimization algorithms and codes is limited. In a recent work, [16] develop a spatial branch-and-bound (sBB) algorithm for global optimization of spline-constrained problems. While the algorithm was shown to be highly efficient, it has only support for a limited set of algebraic functions, is only available as a specialized code and requires software for spline generation [17]. To address the comparably high modeling and implementation effort required for using the specialized sBB algorithm of [14,16] proposed an explicit constraint-formulation for continuous splines, yielding an ad-hoc mixedinteger quadratically constrained programming (MIQCP) model. In this paper, we build upon and significantly extend [14,16] to construct a general-purpose framework for mathematical programming of piecewise polynomial constraints, subsuming spline constraints. The framework is based on an epigraph formulation and we show how it accommodates lower semi-continuous PWPs given in the monomial, Bernstein or B-spline basis. The extension to lower semi-continuous PWPs has not been explicitly covered in previous works. However, the epigraph formulation in [14] can be applied to lower semi-continuous PWPs written as B-splines.
The main advancement of our work from previous works is our representation of PWPs as a disjunction of polynomial pieces. This allows us to exploit the fact that all the polynomial pieces can be written as a linear combination of a single multivariate polynomial basis. This leads to formulations that are minimal in the number of nonlinear (non-convex) constraints. Furthermore, we exploit properties of the polynomial bases and the grid structure for bound tightening and derivation of Bernstein cuts. Exact reformulations of the DP models yield MINLP formulations, which we benchmark and compare with existing solution methods.
The remainder of the paper is organized as follows. In Sects. 2 and 3, we present background theory of Bernstein polynomials, piecewise polynomials and polynomial splines. In Sect. 4, we present DP formulations of PWPs which we in Sect. 5 reformulate to MINLP models. In Sect. 6, we present computational results of the proposed formulations, comparing the results with existing methods for optimizing PWP functions. Concluding remarks in Sect. 7 ends the paper.

Background on polynomial bases
This section provides background material on polynomial functions to cover the theory needed for developing an optimization framework for piecewise polynomial functions. The theory is presented as a series of propositions that summarize some classical results for polynomials; cf. [13,31,42]. For brevity, most propositions are given without rigorous proofs; each proposition may, however, be proved by simple algebraic manipulations. To further simplify the disposition, we have put some computational details in "Appendix A".
We begin by introducing the monomial and Bernstein basis for polynomials in one variable. Several propositions are provided that ultimately enable computation of lower and upper bounds on any polynomial. These results are then extended to the multivariate case.

Univariate polynomials and the Bernstein basis
Let P p denote the vector space of polynomial functions in one real variable with degree less than or equal to p ∈ N, i.e.
The set {M i } p i=0 is commonly referred to as the monomial basis or power basis of P p . Any polynomial f ∈ P p can be written as where the vector of coefficients a = [a i ] p i=0 ∈ R p+1 , and the vector of monomial basis An alternative basis for P p is the Bernstein basis Since span{B i, p } p i=0 = P p , any polynomial f ∈ P p may be expressed in the Bernstein basis as where the vector of coefficients c = [c i ] p i=0 ∈ R p+1 , and the vector of Bernstein basis The monomial and Bernstein basis are related via the linear mapping M p = Q p B p , where Q p ∈ R ( p+1)×( p+1) is the transformation matrix given in "Appendix A.1". Consequently, a T M p (x) = c T B p (x), given that c = Q T p a. The Bernstein polynomials possess several useful properties that facilitate the study of signs and bounds on polynomial functions. These properties, to be presented next, will later be utilized to devise bounds on PWPs.

Lemma 1 (Convex combination property of Bernstein polynomials) The following holds true for a set of degree p Bernstein polynomials
Proof The lemma is proved by applying Newton's binomial identity to (3).
Observe that Proposition 1 holds for x ∈ [0, 1]. To obtain a bounding box on a general domain [x L , x U ], we perform an affine change of variable. 1]. The polynomial f can be reparametrized from x to u via the linear mapping Proof Cf. [42].
where c L = min{c i } p i=0 and c U = max{c i } p i=0 .
Proof The result follows directly from Propositions 1 and 2.

Multivariate polynomials
A vector space of multivariate polynomials f : R d → R in the variables x = (x 1 , . . . , x d ) ∈ R d , can be constructed by taking the tensor product of univariate polynomial bases. Specifically, we construct a multivariate polynomial basis as where is a vector of p + 1 monomial basis functions in the variable x j . In (7), M d p is a vector of n = ( p + 1) d polynomials of degree less than or equal to dp in d variables: i.e. each multivariate basis function results from d products of univariate polynomial basis functions of degree less than or equal to p. The basis spans a (tensor product) vector space of multivariate polynomials, denoted P d p = span{M d i, p } n−1 i=0 with dim(P d p ) = ( p + 1) d . The exponential growth in the number of basis functions with the number of variables d, is a phenomenon often referred to as the curse of dimensionality [20]. This phenomenon limits most practical applications of tensor product bases to 5-6 variables.
For notational brevity, we assume in the above construction that the polynomial basis and degree are equal for all variables. These assumptions can be removed without loss of generality as the multivariate basis may be constructed from any combination of univariate polynomial bases of varying degrees. Subsequently, we consider also the multivariate Bernstein basis for P d p , which we denote by B d p . Using the multivariate polynomial basis, we may express any f ∈ P d p as The important property of the bounding box in Proposition (1) naturally extends to the multivariate case.
Then, given n = m d = ( p + 1) d , it follows from Lemma 1 that The above relation implies that The identity in (12), combined with Lemma 1, ensures that for all which proves the proposition.
For each variable x j , let R p, j be the reparametrization matrix that reparametrizes the monomial basis from x j ∈ [x L j , x U j ] to u j ∈ [0, 1], computed according to (33) in "Appendix A.2". Furthermore, let Q p be the transformation matrix computed as in (32) in "Appendix A.1". Then, f may be mapped to the multivariate Bernstein basis as follows: where Finally, we may apply Proposition 4 to obtain the bounds where c L = min{c i } n−1 i=0 and c U = max{c i } n−1 i=0 .

Proof
The result follows directly from Proposition 4.

Piecewise polynomial functions
In this section, we describe the piecewise polynomial functions (PWPs) to which we first give a formal definition for the continuous case. We then depart from the continuity requirement in order to consider the more general case of lower semi-continuous PWPs. The definitions given below provide a framework for the development of the mathematical programming formulations in Sects. 4 and 5. The definitions are not novel, but help us highlight wellestablished connections between PWPs and splines; cf. [42,49].
where f P : P ⊂ R d → R and f P ∈ P d p for all P ∈ Π, and some degree p ∈ N 0 .
Note that the domain D does not need to be connected or convex. Continuity of f on D is ensured since In the above definition, the polynomial pieces { f P } P∈Π are constructed from some basis that spans the space P d p . A special case occurs when d = 1 and p = 1, for which { f P } P∈Π are linear functions in one variable, and f a continuous piecewise linear function. Furthermore, for d > 1 and p = 1, f is a continuous piecewise multilinear function due to the tensor product construction of P d p . In general, the polynomial pieces are of degree less than or equal to dp ∈ N 0 .

Polytopes on a rectilinear grid
Definition 1 of continuous PWPs does not prescribe the polytopes; they may for instance be given as the convex hull of a finite number of points, or as a system of linear inequalities. Some formulations for piecewise linear functions require the polytopes to be simplices resulting from a triangulation of D [55]. For most practical applications of PWPs, however, the polytopes are assumed to be n-orthotopes (hyperrectangles/boxes) arranged on an axis-aligned rectilinear grid. 1 In the rest of this paper, we will assume that the domain D is partitioned on such a rectilinear grid, for which the polytopes in Π are characterized as follows. For This lets us define the rectilinear grid G := {P k : k ∈ K }, consisting of |G| = m 1 · · · m d boxes given by The grid G is in compliance with Definition 1, since it is a family n-orthotopes P k , which are bounded polytopes. Subsequently, we consider PWPs partitioned on a rectilinear grid and write Π = G. We will also denote with P d p (G) the space of piecewise degree p polynomials with a partition of the domain D given by the rectilinear grid G.

The epigraph of piecewise polynomials
A continuous PWP f : D ⊂ R n → R may be modeled by its epigraph epi We assume that D is a bounded domain and that f participates in a constraint of the form f (x) ≤ 0 or in an objective function to be minimized. That is, the constraint f (x) ≤ 0 can be modeled as (x, z) ∈ epi( f ), z ≤ 0, and the objective f can be modeled as the minimization of z subject to (x, z) ∈ epi( f ).
The epigraph of f can be expressed as the union of epigraphs of its pieces f P , i.e.
where epi( As illustrated by Fig. 1, the epigraph of a piecewise function is in general a nonconvex set. Note that epi( f P ) is convex if and only if f P is convex on P. Furthermore, f may be nonconvex, even if f P (and epi( f P )) is convex for all P ∈ Π.
The theory developed in [26,27] shows that epi( f ) can be modeled as a MILP if and only if f is piecewise linear and lower semi-continuous. Based on this theory, Vielma et al. [55,56] derived new MILP models and presented a unifying framework for piecewise linear functions. To follow on these works, we continue by extending Definition 1 to handle lower semi-continuous piecewise polynomials.

Extension to lower semi-continuous piecewise polynomials
Below we provide a definition of PWPs that are not necessarily continuous. This allows us to analyze and integrate in the framework the subset of discontinuous PWPs that are lower semi-continuous. The extended definition lets us tie our PWP framework to the B-spline modeling framework, which facilitates construction of PWPs with predefined smoothness. Before extending Definition 1 of PWPs, we consider the property of lower semi-continuity with some simple examples. Formally, a function f is lower semi-continuous if for any The importance of lower semi-continuity comes from the fact that the epigraph of a function is closed if and only if it is lower semi-continuous. It is hence a requirement for the epigraph model in Sect. 3.2. Since a continuous function is lower semi-continuous, the requirement always holds for continuous PWPs. To illustrate this property, consider the two PWPs in Fig.  2. The PWP in Fig. 2a is lower semi-continuous at x = 2, but not at points x = 1 and x = 3. Thus, it is not a lower semi-continuous PWP and its epigraph is not closed. On the other hand, the PWP in Fig. 2b has one discontinuity (x = 2) at which it is lower semi-continuous, and its epigraph is closed. To allow discontinuities, [55] employed a characterization of the domain using copolytopes (sets defined by a finite set of strict and non-strict linear inequalities). Similarly, we use copolytopes to define not necessarily continuous PWPs as follows.
where f P : P ⊂ R d → R and f P ∈ P d p for all P ∈ Π, and some degree p ∈ N 0 .
With a minor adjustment to the continuous case, we may express the epigraph of a function f defined according to Definition 2, as the union of epigraphs of its pieces f P . That is, we model where we now use epi( Similar to continuous PWPs, we consider a partition of the domain on a rectilinear grid G. However, we now compose the grid of left half-closed boxes: Note that P k , being a left half-closed box, is a special type of copolytope. A technicality arises with this partitioning in that the rightmost boundaries of D are open, and hence D is open, which breaks compatibility with Definition 2. To close these boundaries we must require that the rightmost boundaries of the rightmost boxes are closed; i.e. in (24) we must replace π i The addition of this requirement on the partitioning ensures that the domain is closed and hence compatible with Definition 2.

Relation to splines
With piecewise linear functions one is often concerned with C 0 continuity at intersections x ∈ P 1 ∩ P 2 , where P 1 , P 2 ∈ Π. For PWPs in general, C 1 , C 2 , or higher-order continuity at the intersections is an obtainable and often desired property. Definition 1 only guarantees C 0 continuity, but does not exclude PWPs with higher order continuity.
Splines are PWPs constructed with continuity constraints. The most widely used framework for polynomial splines is the B-spline, in which PWPs with a desired degree of smoothness can be constructed by allowing basis functions to overlap. Consider the multivariate B-spline i=0 is a vector of n j degree p B-spline basis functions in the variable x j , c are coefficients, and t j is a non-decreasing sequence of reals called a knot sequence. The B-spline basis functions in a variable x j , N p (x j ; t j ), are polynomials with local support that are spliced together at the points specified by the knot sequence t j .
The multivariate B-spline basis is denoted is the set of knot sequences that parametrize the partition of the domain D. The vector space of Bsplines spanned by the above basis is denoted S d The B-spline basis can viewed as an extension of the Bernstein basis, generalizing the description of a single polynomial on a continuous interval to piecewise polynomials over a partitioned domain, specified by the knot sequence [13]. It shares the non-negativity and partition-of-unity properties of the Bernstein basis, and is invariant to an affine change of variables. The close relationship is made clear by the Proposition 6 in "Appendix B", which shows that Bernstein and B-spline bases are equivalent for a certain knot sequence.
Multivariate B-splines are defined on a rectilinear grid of left half-closed boxes aligned to the variable axes, due to its construction by the Kronecker product. The partitioning is thus the same as for the piecewise polynomials in Definition 2. The well-known equality S d where G is a rectilinear grid, implies that any spline can be accommodated by the framework in Definition 2, given appropriate knot sequences T . This equality was first stated for the univariate case in the Curry-Schoenberg theorem [9]. In Lemma 2, "Appendix B", we restate this relationship for the multivariate case using our notational framework. Since most PWPs are built as splines, e.g. using cubic spline interpolation or smoothing splines, this relationship holds a practical value and we will later use it to generate PWPs for the numerical study.

Disjunctive formulations for piecewise polynomial functions
In this section, we use disjunctions as a means of representing PWP constraints. Consider a piecewise polynomial f : D → R, defined as in Definition 1 with a rectangular domain can be represented by the disjunction [27]: where we have associated a boolean variable Y P ∈ {True, False} with each polytope P ∈ Π. Each disjunctive term is related to a polytope P, so that x ∈ P and z is restricted to the epigraph epi( f P ) of a piece f P of f . The disjunction thus models epi( f ) as the union of epigraphs in (20). The exclusive OR operator on the boolean variables ensures that exactly one polytope P ∈ Π is selected. DP-1 is also a valid model for lower semi-continuous PWPs according to Definition 2, if we replace in each term the domain constraint with x ∈P, whereP = cl(P). In both cases, DP-1 is a proper disjunction [1,53] in the sense that no single polytope covers the entire feasible region. Observe that Definition 1 ensures continuity in the overlap between the polytopes constituting the disjunction. In the derivations that follow we assume that f is a continuous PWP, but remark that the resulting formulations are also valid for lower semi-continuous PWPs subject to the mentioned domain-substitution.
The disjunction DP-1 contains a nonlinear, possibly nonconvex inequality for each term, thereby severely impeding the scalability of the formulation and hence its practical application. As a partial remedy, we may utilize that each polynomial f P can be expressed as a linear combination of the basis functions spanning P d p , that is, f P ∈ P d p , for all P ∈ Π. This salient characteristic allows us to exploit that the basis functions are independent of P, and hence can be extracted outside the disjunction as a common set of nonlinearities. The reformulation simplifies DP-1 to where the polynomial piece f P is expressed as a linear combination of the n = dim(P d p ) multivariate monomial basis functions β = M d p . We stress that even though it is always possible to substitute nonlinearities with new variables to obtain linear disjunctions as in DP-2, the benefit comes solely from having common basis functions and hence reducing the number of nonlinear constraints.
Generally, DP-2 requires n = dim(P d p ) = ( p + 1) d polynomial constraints to model a PWP, invariant to the discretization of the domain. Consider a PWP defined on a rectilinear grid of |Π| = m d boxes, resulting from a discretization with m ≥ 1 intervals in each of the d variables. DP-1 requires m d polynomial constraints to model this PWP. Thus, when m > p + 1, then m d > (p + 1) d , and the formulation in DP-2 is likely preferable to DP-1. To summarize the above argument: modeling the polynomial function space P d p via its n basis functions, as opposed to modeling each of the |Π| polynomial pieces separately, will generally result in fewer nonlinear constraints. Still, the exponential increase with d in the number of nonlinear constraints puts a practical limit on formulations derived from either DP-1 or DP-2.

Bounds on polynomial constraints
The efficiency of numerical methods for solving DP-2 relies strongly on the ability to derive strong upper bounds on the constraints f P = a T P β ≤ z, for P ∈ Π. Suppose that a T P β ∈ [m L P , m U P ] and that z L ≤ z for any x ∈ D. We may then define M U P := m U P − z L so that, for any x ∈ D, To obtain a valid upper bound M U P , we must determine the values of m U P and z L . We observe that any feasible solution must satisfy a T P β ≤ z for some P ∈ Π. Thus, a valid lower bound on z is z ≥ z L = min{m L P } P∈Π , and we may rewrite the upper bound on the polynomial constraint to It is then obvious that computing M U P for each P ∈ Π requires a lower and upper bound on all polynomials { f P } P∈Π .
Returning to DP-2, there is a subtlety due to the substitution of the nonlinearities that impedes the derivation of tight bounds on the polynomials. The issue is that the bounds on , not only for x ∈ P. This poses numerical problems since the piecewise polynomials may become prohibitively large on [x L , x U ], resulting in undesirably large bounds.
To solve this issue and obtain tighter bounds on the polynomials { f P } P∈Π , we utilize the procedure in Proposition 5 to perform a reparametrization before computing the polynomial bounds.
where the coefficients of the reparametrized polynomial in Bernstein form are given as Using the multivariate Bernstein basis B d p (u) for 0 ≤ u ≤ 1 enables reformulation of DP-2 to the disjunction In DP-3, the prescription of the polytopes in (19) is enforced using u. We have also bounded the Bernstein basis functions to be in [0, 1], in accordance with Lemma 1.
Within each term P ∈ Π in DP-3, the variables x and u are linearly dependent. The reformulation DP-3 enables computation of bounds on the reparametrized polynomials. In particular, by invoking Proposition 4 we obtain c L P ≤ c T P β ≤ c U P , where c L P = min{c i,P } n−1 i=0 and c U P = max{c i,P } n−1 i=0 . This allows us to set and thereby obtain a valid upper bound c T P β − z ≤ M U P for all u ∈ [0, 1] and P ∈ Π. While (28) provides an upper bound on c T P β − z for P ∈ Π, it is global in the sense that it involves all the polynomial pieces via the lower bound min{c L P } P∈Π on z. "Local" bounds that concern only a single polynomial, can be obtained by introducing auxiliary variables {z P } P∈Π and reformulating to With DP-BASIC, it is sufficient to derive an upper bound M U P so that c T P β − z P ≤ M U P . A bound is readily obtained as

Remark 2
The special case of an equality constraint c T P β = z P can be handled by writing 0 ≤ c T P β − z P ≤ 0. Using the same arguments as above we obtain the bounds M L P ≤ c T P β − z P ≤ M U P , where M L P = c L P − max{0, c U P }.

Exploiting the rectilinear grid structure
In the preceding formulations, a disjunction of |Π| = d i=1 m i terms is used to enforce the box constraints x ∈ P k , where P k is given as in (19). This seems unnecessary since the grid structure can be modeled by d disjunctions of m i terms (for i = 1, . . . , d), as shown next.
We introduce a boolean variable Y i j for each interval π i j−1 ≤ x i ≤ π i j , for j = 1, . . . , m i , and i = 1, . . . , d. Then, by adding the conditions we ensure that each variable x i is constrained to a single interval. With this modeling strategy, we modify DP-BASIC to arrive at the following formulation.
Above, the |Π| disjunctions for the polynomial pieces are conditioned on the expression ∧ i=1,...,d Y i k i . This condition will be True only for polytope P k , ensuring that the polynomial pieces are exclusively selected. Otherwise, z P is set to zero.

Partition-of-unity cut
The DP-GRID formulation can be augmented with a partition-of-unity cut that may strengthen its relaxation. The cut is given by the identity for Bernstein polynomials in (12), i.e. 1 T β = 1, where 1 is vector of n ones. Adding this cut to DP-GRID yields a formulation which we name DP-CUT.
The partition-of-unity cut was introduced for B-splines in [14]. The same cut is applicable here, as the Bernstein polynomials are a special case of B-splines (see Sect. 3.4).

Expanded Bernstein basis
The preceding formulations do not utilize the tensor product structure of the multivariate basis B d p ; cf. (9). In these formulations, the multivariate basis is formed by the tensor product of all univariate bases, resulting in constraints with polynomials of degree dp. In the following formulation, the multivariate basis is expanded to exploit the inherent structure due to the tensor product. The expansion lets us add additional polyhedral cuts (as was done for the multivariate basis in Sect. 4.3) and reduce the maximum degree of any polynomial in the set of constraints to max{2, p} (for p ≥ 1). It was demonstrated in [14] that an expansion of the tensor product can yield better mathematical programming formulations for multivariate splines.
Specifically, each univariate Bernstein basis is assigned to the p + 1 auxiliary variables In addition, we include the upper bounds on the Bernstein polynomials given in "Appendix A.3". Denote withB p the upper bounds on the Bernstein polynomials B p . We then include the bounds ξ i ≤B p for i ∈ {1, . . . , d}.
The resulting formulation, with the expanded Bernstein basis and polyhedral cuts, is given below.
DP-EXP uses d( p + 1) + d i=1 ( p + 1) i auxiliary variables to represent the multivariate polynomial basis. The univariate basis functions are expressed by d( p + 1) polynomial constraints of degree p, while d−1 i=1 ( p + 1) i+1 bilinear constraints are used to form the multivariate basis (not counting the p + 1 constraints β 1 = ξ 1 , which are linear). In addition, 2d linear partition-of-unity cuts are included.

Expanded monomial basis
With DP-EXP the maximum degree of the polynomial constraints were reduced to max{2, p} (for p ≥ 1). For general polynomial constraints, it is possible to achieve a maximum degree of 2 by further expansion of the basis. We achieve this by utilizing the monomial basis ξ i in variable u i , setting ξ i 0 = 1 and ξ i j = ξ i j−1 u i for j ∈ {1, . . . , p}. We compute the multivariate basis β d as in DP-EXP, and form the polynomial pieces as where the coefficients are given as Bounds 0 ≤ ξ i ≤ 1 and 0 ≤ β i ≤ 1 for all i ∈ {1, . . . , d}, follow from the fact that 0 ≤ u ≤ 1.
With the expanded monomial basis we obtain the following formulation.

Remark 3
The partition-of-unity cuts that were added for the Bernstein basis in Sect. 4.3, can be applied to the monomial basis via a transformation. Let T p = Q −1 p so that B p = T p M p , where Q p is the transformation matrix in "Appendix A.1". Inserting this mapping into the cut constraints we obtain for the monovariable basis 1 T T p ξ i = 1 for i ∈ {1, . . . , d}. It can be shown that these cuts are redundant since 1 T T p ξ i = ξ i 0 = 1. Furthermore, it can be shown that the transformed upper bounds are redundant as well; that is, ξ i ≤ 1 ≤ Q pB p . We have thus omitted these in DP-MON.

MINLP formulations for piecewise polynomial functions
Algorithmic approaches for mathematical programming problems with disjunctions either reformulate the disjunction to enable mixed-integer programming, or seeks to exploit the disjunctive constraints explicitly in a branch-and-bound or cutting-plane algorithm, possibly through combinations thereof [3,52]. Linear [1] and convex nonlinear disjunctions [6] may be reformulated either by its convex hull representations or by big-M reformulations. Pertaining to the linear disjunction in DP-3, the convex hull formulation [1] is at least as tight as big-M reformulations, though requiring more variables and constraints. Big-M formulations, on the other hand, are known to be prone to the choice of the big-M parameters, and often yield weaker relaxations. For large nonlinear, possibly nonconvex DP problems, it is important to keep the size of reformulation small, in which big-M reformulations may be advantageous [53]. Consequently, we pursue big-M based MINLP reformulations of the DP models of PWP constraints in Sect. 4. Utilizing the bounds derived in Sect. 4.1 upon an elementary big-M reformulation of DP-BASIC yields the MINLP formulation , c U P }, and a binary variable y P replaces Y P , for each P ∈ Π. MINLP-BASIC has n = dim(P d p ) nonlinear constraints; all other constraints are linear. The formulation has |Π| + d + n continuous auxiliary variables {z P } P∈Π , u and β, and |Π| binary variables {y P } P∈Π .

Reformulation of DP-GRID, DP-EXP, and DP-MON
Analogous to the derivation of MINLP-BASIC, a MINLP reformulation of DP-GRID is obtained by introducing a binary variable y i j for each boolean variable Y i j , and applying a big-M reformulation. The last disjunction requires special treatment, since each term contains a conjunction of clauses connected by the AND operator. This means that the term for P k in the disjunction should be True if and only if Y 1 k 1 = · · · = Y d k d = True. A big-M reformulation for a given P k can then be formed as c T leading to the following MINLP formulation.
We note that the MINLP-GRID has d i=1 m i binary variables for polytope selection, in contrast to |Π| = d i=1 m i as for the MINLP-BASIC formulation. In an analogous fashion, we derive MINLP reformulations of DP-CUT, DP-EXP, and DP-MON, and denote them MINLP-CUT, MINLP-EXP, MINLP-MON, respectively. We note here that MINLP-MON consists of linear and bilinear constraints only, and is hence a MIQCP formulation.

Summary of formulations
The size of the formulations in terms of number of variables and constraints are summarized in Table 1. To ease comparisons, we assume that m 1 = · · · = m d = M, so that |Π| = M d , and utilize the geometric series The three formulations MINLP-BASIC, MINLP-GRID, and MINLP-CUT have n = dim(P d p ) = ( p + 1) d nonlinear equality constraints. These constraints model the Bernstein basis functions that span P d p , and are nonconvex since the Bernstein basis functions are polynomials of degree dp. MINLP-EXP has d( p + 1) polynomial constraints of degree p, and g d ( p + 1) − ( p + 1) bilinear constraints. Finally, MINLP-MON has 2d less nonlinear constraints than MINLP-EXP, all being bilinear constraints. The reduction in nonlinear constraints is due to some basis functions being constant (equal to one).
Comparing number of binary variables, MINLP-BASIC seems to be at a disadvantage since M d ≥ d M for M > 1 and d ≥ 1. The one-dimensional case (d = 1) is an exception since MINLP-BASIC then becomes equivalent to MINLP-GRID.

MIQCP-CUT [14]
2 + d(1 *Not counting x and z **Not counting variable bounds Finally, we note that the MIQCP-CUT formulation from [14] scales poorly in the number of nonlinear constraints due to the terms pd M and g d (M + p). It also has 2dp more binary variables than the formulation based on MINLP-GRID.

Numerical study
To benchmark the performance of the proposed MINLP formulations, we conducted a threepart numerical study. In the first part we minimized randomly generated cubic splines of varying input dimensions. In the second part, we solved a set of optimization problems involving five randomly generated PWP constraints of varying degrees. Finally, we solved a realistic production optimization case with ten PWP constraints.
The five formulations MINLP-BASIC, MINLP-GRID, MINLP-CUT, MINLP-EXP, and MINLP-MON, were solved using the global optimization solver BARON [46]. We compare the computational performance of the proposed MINLP formulations with the MIQCP-CUT formulation proposed in [14]. This formulation was also solved using BARON. We further include the results from solving the test problems using the special-purpose spline solver CENSO, which solves spline constrained problems as NLPs using a spatial branch-and-bound algorithm [16].
All solvers were run with an absolute -convergence termination criteria of = 1 · 10 −6 . Remaining settings were left at default values. The problems were solved on a computer equipped with an Intel Core i7-8700K processor and 32 GB of RAM.

Minimization of randomly generated PWPs
Three sets of test problems were created by randomly generating cubic splines. The three sets contain problems with a piecewise polynomial objective function in one, two, and three variables, respectively. For the monovariable problems (random1d), the variable is discretized into ten intervals, leading to ten polynomial pieces. The set of problems in two variables (random2d) have an objective function defined on a 10 × 10 grid with 100 polynomial pieces. Finally, the problems with three variables (random3d) have an objective function defined on a 6 × 6 × 6 grid, for a total of 216 n-orthotopes. Thus, the hardest problems (random3d) contain 216 polynomial pieces of degree dp = 3 × 3 = 9. Properties of the sets of test problems are summarized in Table 2.
The problems are in the epigraph form min D → R is a piecewise polynomial function. Continuous cubic B-splines with equidistant knots are constructed by randomly drawing coefficients from a Gaussian distribution with zero mean and unity standard deviation, that is c i ∼ N (0, 1), ∀i = 0, . . . , n − 1. Figure 3 shows one of the generated univariate cubic splines. Using the procedure described in "Appendix B", the B-spline is transformed into a piecewise polynomial f compatible with Definition 2.   The lowest mean times among the MIP formulations are marked in bold *Solver did not converge before the time limit of 3600 s on some problems Table 3 gives a summary of the full results, which are reported in "Appendix C", Table  6. Comparing the mean solve times, we see that MINLP-EXP outperforms the other MIP formulations, including the MIQCP-CUT formulation, on all three test sets. CENSO [16] had the lowest solve time on all problems.
For the one-dimensional PWPs in random1d, the MINLP-BASIC and MINLP-GRID formulations are equivalent and achieve similar results. For random2d and random3d, MINLP-BASIC seems to perform slightly better than MINLP-GRID when comparing mean solve times. However, for random3d the MINLP-BASIC formulation has a higher variation in the solve times as seen from the standard deviation in Table 6, with some problems not being solved within the time limit. From these results it is difficult to decide which is the better of the two formulations. However, the improvements to MINLP-GRID made in MINLP-CUT and MINLP-EXP, have a large effect on solve times, especially for the three-dimensional PWPs in random3d.
We note that the monomial formulation MINLP-MON performs quite poorly on the ran-dom3d test set. It thus seems that the Bernstein basis is beneficial for these problems.

Optimization with randomly generated PWP constraints
We solved test problems of the following form: x ∈ D = [0, 10] 2 (31) where { f 0 , f 1 , . . . , f 4 } are PWPs in two variables (x). Three sets of test problems were generated, each with 20 problems consisting of either bi-linear, bi-quadratic, or bi-cubic PWPs. The PWPs were randomly generated as described in Sect. 6.1, and constructed on a 10 × 10 grid, partitioning D.
A summary of the results is given in Table 4. A complete table of results is given in "Appendix C", Table 7. A boxplot of the solve times for bi-cubic PWPs is shown in Fig. 4.
Comparing the MIP formulations, MINLP-EXP has the overall best performance on the bi-quadratic and bi-cubic problems in terms of mean solve time. On the most challenging It is clear from the results that MINLP-BASIC is inferior to MINLP-GRID and the formulations derived from MINLP-GRID. This is to be expected based on the formulation sizes in Table 1, which shows that the number of binary variables in MINLP-BASIC scales exponentially with d. The developments made in MINLP-GRID, MINLP-CUT, and MINLP-EXP improve solve times and reduce variability. For example, the addition of cuts in MINLP-CUT and MINLP-EXP is clearly advantageous. We finally note that CENSO has the lowest solve times on all problems.

Production optimization case
To test the formulations on a real large-scale problem we solved a production optimization case adopted from [15]. The case involves eight subsea petroleum wells, each producing a mix of oil, gas, and water. The fluid streams are routed to a topside processing facility via two pipelines (often called risers). The objective is to maximize oil production by routing and choking the well flows, satisfying constraints on momentum balances and variable bounds.
The production system was modeled by a directed acyclic graph G = (N , E), with nodes N = N w ∪ N m ∪ N s and edges E = E d ∪ E r . An illustration of the graph is given in Fig. 5. Notice that each well node i ∈ N w has two leaving discrete edges (i, j) ∈ E d and (i, k) ∈ E d to the manifold nodes j, k ∈ N m . By allowing zero or one of these edges to be active, we model routing of fluid flows and shut-in of wells. The total flow entering a manifold node i ∈ N m is then led to a respective separator node j ∈ N s via a riser edge (i, j) ∈ E r .
The variables in the problem are the pressure p i at each node i ∈ N , the pressure drop Δp e on each edge e ∈ E, the flow rate q e,c of phase c ∈ C on edge e ∈ E, and the binary variable y e on the discrete edge e ∈ E d . The variables y e are used to model on/off switching of the discrete edges (y e = 1 means that the edge is on/open, while y e = 0 means that it is off/closed). In addition, auxiliary variables q e,liq are introduced to model the liquid flow (oil + water) on each riser edge e ∈ E r . For further details about the modeling approach we refer the reader to [15].
The problem includes ten nonlinearities which were modeled using B-splines. The eight wells were modeled by well performance curves f i ( p i ) for i ∈ N w , represented by polynomial basis functions on nine boxes. The pressure drop over the two risers were modeled by B-splines g e (q e,liq , q e,gas , p i ) for e ∈ E r , composed of polynomial basis functions on 64 Fig. 5 Production system flow graph, with nodes represented by grey circles and edges by arrows. Discrete (on/off) edges are dashed. The nonlinearities f 1 and g (9,11) , related to Node 1 and Edge (9,11), are shown boxes. The splines were fitted to simulated data from a multiphase flow simulator calibrated to real well test data. To give an example on problem size, for MINLP-BASIC the complete problem has 216 binary variables, 200 related to the splines, and 16 related to flow routing.
The results for various PWP degrees ( p = 1, 2, 3) are given in Table 5. Among the MIP formulations, MINLP-EXP performed best. With this formulation, BARON solved the problems with p = 1 and p = 2 within the practical time limit of 3600 s. For p = 3, MINLP-EXP gave the best solution, although it did not close the optimality gap. This confirms the merits of MINLP-EXP observed in Tables 6 and 7 for increasing problem sizes.
We again observe that MIQCP-CUT and MINLP-MON performs well for p = 1, but poorly for higher degrees. The NLP solution method employed by CENSO does not seem to be affected much by the degree. In fact, it performs well for p = 2 and p = 3, which can be attributed to the availability of continuous derivatives in NLP searches, 2 and the weak dependence of the linear relaxations on p.

Concluding remarks
This paper has presented a MIP modeling framework for solving mathematical programs with continuous and semi-continuous PWP constraints. The numerical study indicates that among the derived mixed-integer formulations, MINLP-EXP has the best overall performance. Currently, it is the best-performing MIP formulation for PWP-constraints (solved by BARON). Although the MIQCP-CUT formulation is outperformed by several of the MINLP formulations, it has an advantage in that it is rather straightforward to implement when the PWP is given as a B-spline. In this case, the MINLP formulations require an extra preprocessing step to bring the spline to the PWP form in (18). With strong requirements on solve speed the special-purpose spline-based solver CENSO is still the best option, but it comes at the cost of using experimental software.
CENSO holds a great advantage in that it treats each PWP constraint as a single blackbox constraint when searching for feasible solutions. Although the MINLP formulations herein allow the application of general-purpose global optimization solvers, the solution efficiency is still hampered by these solvers' lack of support for treating PWPs as black-box functions. These solvers must satisfy all the constraints in the applied MINLP formulation when searching for feasible solutions (see formulation sizes in Table 1).
There is a growing use of splines for modeling purposes, causing a demand for PWP support in optimization solvers. To this end, the MINLP formulations presented in this paper provide a basis for solving PWP constrained engineering and economic optimization problems. Our strategy of modeling a PWP constraint via its epigraph provides a general framework compatible with semi-continuous piecewise polynomials and B-splines, encompassing a broad set of spline modeling techniques. Furthermore, the formulations herein may for many applications reduce the need for special-purpose solvers like CENSO. Our study confirms that the main difficulties in solving PWP constrained problems lie in the modeling of the polynomial basis P d p (requiring non-convex constraints) and the grid partitioning of the domain (requiring integer variables), which both contribute to the hardness of these problems. Besides optimization software support for PWP constraints, elements from related fields such as sum-of-squares programming, semidefinite relaxations and geometric programming, may be explored in combination with the proposed framework to improve the modeling of P d p (G). We also emphasize that the formulations presented are exact; approximations of these formulations may hence aid efforts toward reducing the computational demand. To complete the comparison of B-splines with our definition of PWPs, we note that a Bspline is lower semi-continuous if no internal knot is repeated more than p times. B-splines, for which the multiplicity of one or more internal knots are p + 1, may be continuous, lower semi-continuous, or discontinuous.

C Numerical results
The results from the numerical study in Sect. 6 are listed in Tables 5, 6 and 7.  *Solver did not converge before the time limit of 3600 s on some problems Table 7 Solve times in seconds for problems constrained by randomly generated PWPs Problem Formulation Solver