Utilities for Piecewise Functions
-
exception
pyomo.core.kernel.piecewise_library.util.
PiecewiseValidationError
[source] Bases:
Exception
An exception raised when validation of piecewise linear functions fail.
-
pyomo.core.kernel.piecewise_library.util.
characterize_function
(breakpoints, values)[source] Characterizes a piecewise linear function described by a list of breakpoints and function values.
Parameters: Returns: a function characterization code and the list of slopes.
Return type: Note
The function characterization codes are
- 1: affine
- 2: convex
- 3: concave
- 4: step
- 5: other
If the function has step points, some of the slopes may be
None
.
-
pyomo.core.kernel.piecewise_library.util.
generate_delaunay
(variables, num=10, **kwds)[source] Generate a Delaunay triangulation of the D-dimensional bounded variable domain given a list of D variables.
Requires numpy and scipy.
Parameters: - variables – A list of variables, each having a finite upper and lower bound.
- num (int) – The number of grid points to generate for each variable (default=10).
- **kwds – All additional keywords are passed to the scipy.spatial.Delaunay constructor.
Returns: A scipy.spatial.Delaunay object.
-
pyomo.core.kernel.piecewise_library.util.
generate_gray_code
(nbits)[source] Generates a Gray code of nbits as list of lists
-
pyomo.core.kernel.piecewise_library.util.
is_constant
(vals)[source] Checks if a list of points is constant
-
pyomo.core.kernel.piecewise_library.util.
is_nondecreasing
(vals)[source] Checks if a list of points is nondecreasing
-
pyomo.core.kernel.piecewise_library.util.
is_nonincreasing
(vals)[source] Checks if a list of points is nonincreasing