Multivariate Piecewise Functions¶
Summary¶
pyomo.core.kernel.piecewise_library.transforms_nd.piecewise_nd (…) 
Models a multivariate piecewise linear function. 
pyomo.core.kernel.piecewise_library.transforms_nd.PiecewiseLinearFunctionND (…) 
A multivariate piecewise linear function 
pyomo.core.kernel.piecewise_library.transforms_nd.TransformedPiecewiseLinearFunctionND (f) 
Base class for transformed multivariate piecewise linear functions 
pyomo.core.kernel.piecewise_library.transforms_nd.piecewise_nd_cc (…) 
Discrete CC multivariate piecewise representation 
Member Documentation¶

pyomo.core.kernel.piecewise_library.transforms_nd.
piecewise_nd
(tri, values, input=None, output=None, bound='eq', repn='cc')[source]¶ Models a multivariate piecewise linear function.
This function takes a Ddimensional triangulation and a list of function values associated with the points of the triangulation and transforms this input data into a block of variables and constraints that enforce a piecewise linear relationship between an Ddimensional vector of input variable and a single output variable. In the general case, this transformation requires the use of discrete decision variables.
Parameters:  tri (scipy.spatial.Delaunay) –
A triangulation over the discretized variable domain. Can be generated using a list of variables using the utility function
util.generate_delaunay()
. Required attributes: points: An (npoints, D) shaped array listing the Ddimensional coordinates of the discretization points.
 simplices: An (nsimplices, D+1) shaped array of integers specifying the D+1 indices of the points vector that define each simplex of the triangulation.
 values (numpy.array) – An (npoints,) shaped array of the values of the piecewise function at each of coordinates in the triangulation points array.
 input – A Dlength list of variables or expressions bound as the inputs of the piecewise function.
 output – The variable constrained to be the output of the piecewise linear function.
 bound (str) –
The type of bound to impose on the output expression. Can be one of:
 ’lb’: y <= f(x)
 ’eq’: y = f(x)
 ’ub’: y >= f(x)
 repn (str) –
The type of piecewise representation to use. Can be one of:
 ’cc’: convex combination
Returns: a block containing any new variables, constraints, and other components used by the piecewise representation
Return type:  tri (scipy.spatial.Delaunay) –

class
pyomo.core.kernel.piecewise_library.transforms_nd.
PiecewiseLinearFunctionND
(tri, values, validate=True, **kwds)[source]¶ Bases:
object
A multivariate piecewise linear function
Multivarite piecewise linear functions are defined by a triangulation over a finite domain and a list of function values associated with the points of the triangulation. The function value between points in the triangulation is implied through linear interpolation.
Parameters:  tri (scipy.spatial.Delaunay) –
A triangulation over the discretized variable domain. Can be generated using a list of variables using the utility function
util.generate_delaunay()
. Required attributes: points: An (npoints, D) shaped array listing the Ddimensional coordinates of the discretization points.
 simplices: An (nsimplices, D+1) shaped array of integers specifying the D+1 indices of the points vector that define each simplex of the triangulation.
 values (numpy.array) – An (npoints,) shaped array of the values of the piecewise function at each of coordinates in the triangulation points array.

__call__
(x)[source]¶ Evaluates the piecewise linear function using interpolation. This method supports vectorized function calls as the interpolation process can be expensive for high dimensional data.
For the case when a single point is provided, the argument x should be a (D,) shaped numpy array or list, where D is the dimension of points in the triangulation.
For the vectorized case, the argument x should be a (n,D)shaped numpy array.

triangulation
¶ The triangulation over the domain of this function

values
¶ The set of values used to defined this function
 tri (scipy.spatial.Delaunay) –

class
pyomo.core.kernel.piecewise_library.transforms_nd.
TransformedPiecewiseLinearFunctionND
(f, input=None, output=None, bound='eq')[source]¶ Bases:
pyomo.core.kernel.block.block
Base class for transformed multivariate piecewise linear functions
A transformed multivariate piecewise linear functions is a block of variables and constraints that enforce a piecewise linear relationship between an vector input variables and a single output variable.
Parameters:  f (
PiecewiseLinearFunctionND
) – The multivariate piecewise linear function to transform.  input – The variable constrained to be the input of the piecewise linear function.
 output – The variable constrained to be the output of the piecewise linear function.
 bound (str) –
The type of bound to impose on the output expression. Can be one of:
 ’lb’: y <= f(x)
 ’eq’: y = f(x)
 ’ub’: y >= f(x)

__call__
(x)[source]¶ Evaluates the piecewise linear function using interpolation. This method supports vectorized function calls as the interpolation process can be expensive for high dimensional data.
For the case when a single point is provided, the argument x should be a (D,) shaped numpy array or list, where D is the dimension of points in the triangulation.
For the vectorized case, the argument x should be a (n,D)shaped numpy array.

bound
¶ The bound type assigned to the piecewise relationship (‘lb’,’ub’,’eq’).

input
¶ The tuple of expressions that store the inputs to the piecewise function. The returned objects can be updated by assigning to their
expr
attribute.

output
¶ The expression that stores the output of the piecewise function. The returned object can be updated by assigning to its
expr
attribute.

triangulation
¶ The triangulation over the domain of this function

values
¶ The set of values used to defined this function
 f (

class
pyomo.core.kernel.piecewise_library.transforms_nd.
piecewise_nd_cc
(*args, **kwds)[source]¶ Bases:
pyomo.core.kernel.piecewise_library.transforms_nd.TransformedPiecewiseLinearFunctionND
Discrete CC multivariate piecewise representation
Expresses a multivariate piecewise linear function using the CC formulation.