piecewise_nd

(function from pyomo.core.kernel.piecewise_library.transforms_nd)

pyomo.core.kernel.piecewise_library.transforms_nd.piecewise_nd(tri, values, input=None, output=None, bound='eq', repn='cc')[source]

Models a multi-variate piecewise linear function.

This function takes a D-dimensional 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 D-dimensional 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 D-dimensional 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 D-length 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:

TransformedPiecewiseLinearFunctionND