Initializing help system before first use

XPRSgetpwlcons, XPRSgetpwlcons64

Purpose
Returns the piecewise linear constraints y = f(x) in a given range.
Topic areas
Synopsis
int XPRS_CC XPRSgetpwlcons(XPRSprob prob, int colind[], int resultant[], int start[], double xval[], double yval[], int maxpoints, int *p_npoints, int first, int last);

int XPRS_CC XPRSgetpwlcons64(XPRSprob prob, int colind[], int resultant[], XPRSint64 start[], double xval[], double yval[], XPRSint64 maxpoints, XPRSint64 *p_npoints, int first, int last);
Arguments
prob 
The current problem.
colind 
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 maxpoints which will be filled with the x-values of the breakpoints. May be NULL if not required.
yval 
Double array of length maxpoints which will be filled with the y-values of the breakpoints. May be NULL if not required.
maxpoints 
Maximum number of breakpoints to be retrieved.
p_npoints 
Pointer to return the number of breakpoints in the selected constraints. If the number of breakpoints is greater than maxpoints, then only maxpoints 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 *colind;
int *resultant;
int *start;
double *xval;
double *yval;
int maxpoints;
int npoints;
...
XPRSgetpwlcons(prob, NULL, NULL, NULL, NULL, NULL, 0, &maxpoints, 0, 1);
colind = (int*) malloc(2*sizeof(int));
resultant = (int*) malloc(2*sizeof(int));
start = (int*) malloc(3*sizeof(int));
xval = (double*) malloc(maxpoints*sizeof(double);
yval = (double*) malloc(maxpoints*sizeof(double);
XPRSgetpwlcons(prob, colind, resultant, start, xval, yval, maxpoints, &npoints, 0, 1);
...
Further information
1. It is possible to obtain just the number of breakpoints in the range of piecewise linear constraints by calling this function with maxpoints set to 0, in which case the required size for the breakpoint arrays will be returned in p_npoints. In this case colind and resultant can also be queried or set to NULL.
2. This function cannot be called while the current problem is being solved or when it is in an interrupted state. Use XPRSpostsolve to restore the problem to a non-solving state.
Related topics

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.