XPRSgetgencons, XPRSgetgencons64
XPRSgetgencons, XPRSgetgencons64 |
Purpose
Returns the general constraints
y = f(x1, ..., xn, c1, ..., cm) in a given range.
Synopsis
int XPRS_CC XPRSgetgencons(XPRSprob prob, int type[], int resultant[], int colstart[], int col[], int colsize, int *ncols, int valstart[], double val[], int valsize, int *nvals, int first, int last);
int XPRS_CC XPRSgetgencons64(XPRSprob prob, int type[], int resultant[], XPRSint64 colstart[], int col[], XPRSint64 colsize, XPRSint64 *ncols, XPRSint64 valstart[], double val[], XPRSint64 valsize, XPRSint64 *nvals, int first, int last);
Arguments
prob
|
The current problem.
|
||||||||||
type
|
NULL if not required or an integer array of length at least
last-first+1 which will be filled with the types of the general constraints:
|
||||||||||
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.
|
||||||||||
colstart
|
Integer array of length at least
last-first+2 which will be filled with the start index of each general constraint in the
col array. May be
NULL if not required.
|
||||||||||
col
|
Integer array which will be filled with the indices of the input variables
xi. May be
NULL if not required.
|
||||||||||
colsize
|
Maximum number of input columns to be retrieved.
|
||||||||||
ncols
|
Pointer to return the number of input columns in the
col array. If the number of input columns is greater than
colsize, then only
colsize elements will be returned. May be
NULL if not required.
|
||||||||||
valstart
|
Integer array of length at least
last-first+2 which will be filled with the start index of each general constraint in the
val array. May be
NULL if not required.
|
||||||||||
val
|
Integer array which will be filled with the constant values
ci. May be
NULL if not required.
|
||||||||||
valsize
|
Maximum number of constant values to be retrieved.
|
||||||||||
nvals
|
Pointer to return the number of constant values in the
val array. If the number of constant values is greater than
valsize, then only
valsize elements will be returned.May be
NULL if not required.
|
||||||||||
first
|
First general constraint in the range.
|
||||||||||
last
|
Last general constraint in the range.
|
Example
The following example retrieves all general constraints:
int ngencons; int *type; int *resultant; int *colstart; int *col; int colsize; int ncols; int *valstart; int *val; int valsize; int nvals; ... XPRSgetdblattrib(prob, XPRS_GENCONS, &ngencons); XPRSgetgencons(prob, NULL, NULL, NULL, NULL, 0, &colsize, NULL, NULL, 0, &valsize, 0, ngencons - 1); type = (int*) malloc(ngencons*sizeof(int)); resultant = (int*) malloc(ngencons*sizeof(int)); colstart = (int*) malloc((ngencons+1)*sizeof(int)); col = (int*) malloc(colsize*sizeof(int)); valstart = (int*) malloc((ngencons+1)*sizeof(int)); val = (double*) malloc(valsize*sizeof(double)); XPRSgetgencons(prob, type, resultant, colstart, col, colsize, &ncols, valstart, val, valsize, &nvals, 0, ngencons - 1); ...
Further information
It is possible to obtain just the number of input columns and/or constant values in the range of general constraints by calling this function with
colsize and
valsize set to
0, in which case the required size for the arrays will be returned in
ncols and
nvals (one of them may be
NULL if only the other is required).
Related topics