Initializing help system before first use

problem.getpwlcons

problem.getpwlcons


Purpose
Returns the piecewise linear constraints y = f(x) in a given range.
Synopsis
npoints = problem.getpwlcons(col, resultant, start, xval, yval, size, first, last);
Arguments
col 
Integer array which will be filled with the indices of the input variables x. It must be of length at least last-first+1. May be None if not required.
resultant 
Integer array which will be filled with the indices of the output variables y. It must be of length at least last-first+1. May be None if not required.
start 
Integer array which will be filled with the start indices of the different constraints in the breakpoint arrays. It must be of length at least last-first+1. The x-values of the breakpoints of piecewise linear constraint i < last will be given in xval[start[i]] to xval[start[i+1]]. May be None if not required.
xval 
Double array of length sizewhich will be filled with the x-values of the breakpoints. May be None if not required.
yval 
Double array of length sizewhich will be filled with the y-values of the breakpoints. May be None if not required.
size 
Maximum number of breakpoints to be retrieved.
first 
First piecewise linear constraint in the range.
last 
Last piecewise linear constraint in the range.
npoints 
The returned number of breakpoints in the xval and yval arrays. If the number of breakpoints is greater than size, then only size elements will be returned.
Example
The following example retrieves all variables and breakpoints in the first two piecewise linear constraints:
col, resultant, start, xval, yval = [], [], [], [], []
npoints = prob.getpwlcons(prob, col, resultant, start, xval, yval, 1e9, 0, 1)
Further information
It is possible to obtain just the number of breakpoints in the range of piecewise linear constraints by calling this function with size set to 0, in which case the required size for the breakpoint arrays will be returned in npoints.
Related topics