XPRSgetpwlcons, XPRSgetpwlcons64
XPRSgetpwlcons, XPRSgetpwlcons64 |
Purpose
Returns the piecewise linear constraints
y = f(x) in a given range.
Synopsis
int XPRS_CC XPRSgetpwlcons(XPRSprob prob, int col[], int resultant[], int start[], double xval[], double yval[], int size, int *npoints, int first, int last);
int XPRS_CC XPRSgetpwlcons64(XPRSprob prob, int col[], int resultant[], XPRSint64 start[], double xval[], double yval[], XPRSint64 size, XPRSint64 *npoints, int first, int last);
Arguments
prob
|
The current problem.
|
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
NULL 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
NULL 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+2. 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
NULL if not required.
|
xval
|
Double array of length
size which will be filled with the
x-values of the breakpoints. May be
NULL if not required.
|
yval
|
Double array of length
size which will be filled with the
y-values of the breakpoints. May be
NULL if not required.
|
size
|
Maximum number of breakpoints to be retrieved.
|
npoints
|
Pointer to return the number of breakpoints in the selected constraints. If the number of breakpoints is greater than
size, then only
size elements will be returned in the
xval and
yval arrays. May be
NULL if not required.
|
first
|
First piecewise linear constraint in the range.
|
last
|
Last piecewise linear constraint in the range.
|
Example
The following example retrieves all variables and breakpoints in the first two piecewise linear constraints:
int *col; int *resultant; int *start; double *xval; double *yval; int size; int npoints; ... XPRSgetpwlcons(prob, NULL, NULL, NULL, NULL, NULL, 0, &size, 0, 1); col = (int*) malloc(2*sizeof(int)); resultant = (int*) malloc(2*sizeof(int)); start = (int*) malloc(3*sizeof(int)); xval = (double*) malloc(size*sizeof(double); yval = (double*) malloc(size*sizeof(double); XPRSgetpwlcons(prob, col, resultant, start, xval, yval, size, &npoints, 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