PiecewiseLinearFunction
(class from pyomo.core.kernel.piecewise_library.transforms)
- class pyomo.core.kernel.piecewise_library.transforms.PiecewiseLinearFunction(breakpoints, values, validate=True, **kwds)[source]
Bases:
objectA piecewise linear function
Piecewise linear functions are defined by a list of breakpoints and a list function values corresponding to each breakpoint. The function value between breakpoints is implied through linear interpolation.
- Parameters:
breakpoints (list) – The list of function breakpoints.
values (list) – The list of function values (one for each breakpoint).
validate (bool) – Indicates whether or not to perform validation of the input data. The default is
True. Validation can be performed manually after the piecewise object is created by calling thevalidate()method. Validation should be performed any time the inputs are changed (e.g., when using mutable parameters in the breakpoints list).**kwds – Additional keywords are passed to the
validate()method when thevalidatekeyword isTrue; otherwise, they are ignored.
Methods
__init__(breakpoints, values[, validate])validate([equal_slopes_tolerance])Validate this piecewise linear function by verifying various properties of the breakpoints and values lists (e.g., that the list of breakpoints is nondecreasing).
Attributes
The set of breakpoints used to defined this function
The set of values used to defined this function
Member Documentation
- validate(equal_slopes_tolerance=1e-06)[source]
Validate this piecewise linear function by verifying various properties of the breakpoints and values lists (e.g., that the list of breakpoints is nondecreasing).
- Parameters:
equal_slopes_tolerance (float) – Tolerance used check if consecutive slopes are nearly equal. If any are found, validation will fail. Default is 1e-6.
- Returns:
a function characterization code (see
util.characterize_function())- Return type:
- Raises:
PiecewiseValidationError – if validation fails
- property breakpoints
The set of breakpoints used to defined this function
- property values
The set of values used to defined this function